Mercurial > hg > truffle
comparison mx/mx_graal.py @ 17438:b8d89559915d
mx: implement with support for Task()
author | Bernhard Urban <bernhard.urban@jku.at> |
---|---|
date | Tue, 14 Oct 2014 17:46:18 +0200 |
parents | d65ca887868d |
children | 7a771b48e392 |
comparison
equal
deleted
inserted
replaced
17437:d65ca887868d | 17438:b8d89559915d |
---|---|
1336 vm(vmargs, vm=v, vmbuild=vmbuild) | 1336 vm(vmargs, vm=v, vmbuild=vmbuild) |
1337 allDuration = datetime.timedelta(seconds=time.time() - allStart) | 1337 allDuration = datetime.timedelta(seconds=time.time() - allStart) |
1338 mx.log('TOTAL TIME: ' + '[' + str(allDuration) + ']') | 1338 mx.log('TOTAL TIME: ' + '[' + str(allDuration) + ']') |
1339 | 1339 |
1340 class Task: | 1340 class Task: |
1341 def __init__(self, title): | 1341 def __init__(self, title, tasks=None): |
1342 self.start = time.time() | 1342 self.start = time.time() |
1343 self.title = title | 1343 self.title = title |
1344 self.end = None | 1344 self.end = None |
1345 self.duration = None | 1345 self.duration = None |
1346 self.tasks = tasks | |
1346 mx.log(time.strftime('gate: %d %b %Y %H:%M:%S: BEGIN: ') + title) | 1347 mx.log(time.strftime('gate: %d %b %Y %H:%M:%S: BEGIN: ') + title) |
1348 def __enter__(self): | |
1349 assert self.tasks is not None, "using Task with 'with' statement requires to pass the tasks list in the constructor" | |
1350 return self | |
1351 def __exit__(self, exc_type, exc_value, traceback): | |
1352 self.tasks.append(self.stop()) | |
1347 def stop(self): | 1353 def stop(self): |
1348 self.end = time.time() | 1354 self.end = time.time() |
1349 self.duration = datetime.timedelta(seconds=self.end - self.start) | 1355 self.duration = datetime.timedelta(seconds=self.end - self.start) |
1350 mx.log(time.strftime('gate: %d %b %Y %H:%M:%S: END: ') + self.title + ' [' + str(self.duration) + ']') | 1356 mx.log(time.strftime('gate: %d %b %Y %H:%M:%S: END: ') + self.title + ' [' + str(self.duration) + ']') |
1351 return self | 1357 return self |
1383 else: | 1389 else: |
1384 vmargs += ['-Xbootclasspath/p:' + jar] | 1390 vmargs += ['-Xbootclasspath/p:' + jar] |
1385 vm(vmargs) | 1391 vm(vmargs) |
1386 | 1392 |
1387 def _basic_gate_body(args, tasks): | 1393 def _basic_gate_body(args, tasks): |
1388 t = Task('BuildHotSpotGraal: fastdebug,product') | 1394 with Task('BuildHotSpotGraal: fastdebug,product', tasks): |
1389 buildvms(['--vms', 'graal,server', '--builds', 'fastdebug,product']) | 1395 buildvms(['--vms', 'graal,server', '--builds', 'fastdebug,product']) |
1390 tasks.append(t.stop()) | |
1391 | 1396 |
1392 with VM('graal', 'fastdebug'): | 1397 with VM('graal', 'fastdebug'): |
1393 t = Task('BootstrapWithSystemAssertions:fastdebug') | 1398 with Task('BootstrapWithSystemAssertions:fastdebug', tasks): |
1394 vm(['-esa', '-XX:-TieredCompilation', '-version']) | 1399 vm(['-esa', '-XX:-TieredCompilation', '-version']) |
1395 tasks.append(t.stop()) | |
1396 | 1400 |
1397 with VM('graal', 'fastdebug'): | 1401 with VM('graal', 'fastdebug'): |
1398 t = Task('BootstrapWithSystemAssertionsNoCoop:fastdebug') | 1402 with Task('BootstrapWithSystemAssertionsNoCoop:fastdebug', tasks): |
1399 vm(['-esa', '-XX:-TieredCompilation', '-XX:-UseCompressedOops', '-version']) | 1403 vm(['-esa', '-XX:-TieredCompilation', '-XX:-UseCompressedOops', '-version']) |
1400 tasks.append(t.stop()) | |
1401 | 1404 |
1402 with VM('graal', 'product'): | 1405 with VM('graal', 'product'): |
1403 t = Task('BootstrapWithGCVerification:product') | 1406 with Task('BootstrapWithGCVerification:product', tasks): |
1404 out = mx.DuplicateSuppressingStream(['VerifyAfterGC:', 'VerifyBeforeGC:']).write | 1407 out = mx.DuplicateSuppressingStream(['VerifyAfterGC:', 'VerifyBeforeGC:']).write |
1405 vm(['-XX:-TieredCompilation', '-XX:+UnlockDiagnosticVMOptions', '-XX:+VerifyBeforeGC', '-XX:+VerifyAfterGC', '-version'], out=out) | 1408 vm(['-XX:-TieredCompilation', '-XX:+UnlockDiagnosticVMOptions', '-XX:+VerifyBeforeGC', '-XX:+VerifyAfterGC', '-version'], out=out) |
1406 tasks.append(t.stop()) | |
1407 | 1409 |
1408 with VM('graal', 'product'): | 1410 with VM('graal', 'product'): |
1409 t = Task('BootstrapWithG1GCVerification:product') | 1411 with Task('BootstrapWithG1GCVerification:product', tasks): |
1410 out = mx.DuplicateSuppressingStream(['VerifyAfterGC:', 'VerifyBeforeGC:']).write | 1412 out = mx.DuplicateSuppressingStream(['VerifyAfterGC:', 'VerifyBeforeGC:']).write |
1411 vm(['-XX:-TieredCompilation', '-XX:+UnlockDiagnosticVMOptions', '-XX:-UseSerialGC', '-XX:+UseG1GC', '-XX:+VerifyBeforeGC', '-XX:+VerifyAfterGC', '-version'], out=out) | 1413 vm(['-XX:-TieredCompilation', '-XX:+UnlockDiagnosticVMOptions', '-XX:-UseSerialGC', '-XX:+UseG1GC', '-XX:+VerifyBeforeGC', '-XX:+VerifyAfterGC', '-version'], out=out) |
1412 tasks.append(t.stop()) | |
1413 | 1414 |
1414 with VM('graal', 'product'): | 1415 with VM('graal', 'product'): |
1415 t = Task('BootstrapWithRegisterPressure:product') | 1416 with Task('BootstrapWithRegisterPressure:product', tasks): |
1416 vm(['-XX:-TieredCompilation', '-G:RegisterPressure=rbx,r11,r10,r14,xmm3,xmm11,xmm14', '-esa', '-version']) | 1417 vm(['-XX:-TieredCompilation', '-G:RegisterPressure=rbx,r11,r10,r14,xmm3,xmm11,xmm14', '-esa', '-version']) |
1417 tasks.append(t.stop()) | |
1418 | 1418 |
1419 with VM('graal', 'product'): | 1419 with VM('graal', 'product'): |
1420 t = Task('BootstrapWithImmutableCode:product') | 1420 with Task('BootstrapWithImmutableCode:product', tasks): |
1421 vm(['-XX:-TieredCompilation', '-G:+ImmutableCode', '-G:+VerifyPhases', '-esa', '-version']) | 1421 vm(['-XX:-TieredCompilation', '-G:+ImmutableCode', '-G:+VerifyPhases', '-esa', '-version']) |
1422 tasks.append(t.stop()) | |
1423 | 1422 |
1424 with VM('server', 'product'): # hosted mode | 1423 with VM('server', 'product'): # hosted mode |
1425 t = Task('UnitTests:hosted-product') | 1424 with Task('UnitTests:hosted-product', tasks): |
1426 unittest(['--enable-timing', '--verbose']) | 1425 unittest(['--enable-timing', '--verbose']) |
1427 tasks.append(t.stop()) | |
1428 | 1426 |
1429 with VM('server', 'product'): # hosted mode | 1427 with VM('server', 'product'): # hosted mode |
1430 t = Task('UnitTests-BaselineCompiler:hosted-product') | 1428 with Task('UnitTests-BaselineCompiler:hosted-product', tasks): |
1431 unittest(['--enable-timing', '--verbose', '--whitelist', 'test/whitelist_baseline.txt', '-G:+UseBaselineCompiler']) | 1429 unittest(['--enable-timing', '--verbose', '--whitelist', 'test/whitelist_baseline.txt', '-G:+UseBaselineCompiler']) |
1432 tasks.append(t.stop()) | |
1433 | 1430 |
1434 for vmbuild in ['fastdebug', 'product']: | 1431 for vmbuild in ['fastdebug', 'product']: |
1435 for test in sanitycheck.getDacapos(level=sanitycheck.SanityCheckLevel.Gate, gateBuildLevel=vmbuild) + sanitycheck.getScalaDacapos(level=sanitycheck.SanityCheckLevel.Gate, gateBuildLevel=vmbuild): | 1432 for test in sanitycheck.getDacapos(level=sanitycheck.SanityCheckLevel.Gate, gateBuildLevel=vmbuild) + sanitycheck.getScalaDacapos(level=sanitycheck.SanityCheckLevel.Gate, gateBuildLevel=vmbuild): |
1436 t = Task(str(test) + ':' + vmbuild) | 1433 with Task(str(test) + ':' + vmbuild, tasks) as t: |
1437 if not test.test('graal'): | 1434 if not test.test('graal'): |
1438 t.abort(test.name + ' Failed') | 1435 t.abort(test.name + ' Failed') |
1439 tasks.append(t.stop()) | |
1440 | 1436 |
1441 # ensure -Xbatch still works | 1437 # ensure -Xbatch still works |
1442 with VM('graal', 'product'): | 1438 with VM('graal', 'product'): |
1443 t = Task('DaCapo_pmd:BatchMode:product') | 1439 with Task('DaCapo_pmd:BatchMode:product', tasks): |
1444 dacapo(['-Xbatch', 'pmd']) | 1440 dacapo(['-Xbatch', 'pmd']) |
1445 tasks.append(t.stop()) | |
1446 | 1441 |
1447 # ensure -Xcomp still works | 1442 # ensure -Xcomp still works |
1448 with VM('graal', 'product'): | 1443 with VM('graal', 'product'): |
1449 t = Task('XCompMode:product') | 1444 with Task('XCompMode:product', tasks): |
1450 vm(['-Xcomp', '-version']) | 1445 vm(['-Xcomp', '-version']) |
1451 tasks.append(t.stop()) | |
1452 | 1446 |
1453 if args.jacocout is not None: | 1447 if args.jacocout is not None: |
1454 jacocoreport([args.jacocout]) | 1448 jacocoreport([args.jacocout]) |
1455 | 1449 |
1456 global _jacoco | 1450 global _jacoco |
1457 _jacoco = 'off' | 1451 _jacoco = 'off' |
1458 | 1452 |
1459 t = Task('CleanAndBuildIdealGraphVisualizer') | 1453 with Task('CleanAndBuildIdealGraphVisualizer', tasks): |
1460 env = _igvFallbackJDK(os.environ) | 1454 env = _igvFallbackJDK(os.environ) |
1461 buildxml = mx._cygpathU2W(join(_graal_home, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'build.xml')) | 1455 buildxml = mx._cygpathU2W(join(_graal_home, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'build.xml')) |
1462 mx.run(['ant', '-f', buildxml, '-q', 'clean', 'build'], env=env) | 1456 mx.run(['ant', '-f', buildxml, '-q', 'clean', 'build'], env=env) |
1463 tasks.append(t.stop()) | |
1464 | 1457 |
1465 # Prevent Graal modifications from breaking the standard builds | 1458 # Prevent Graal modifications from breaking the standard builds |
1466 if args.buildNonGraal: | 1459 if args.buildNonGraal: |
1467 t = Task('BuildHotSpotVarieties') | 1460 with Task('BuildHotSpotVarieties', tasks): |
1468 buildvms(['--vms', 'client,server', '--builds', 'fastdebug,product']) | 1461 buildvms(['--vms', 'client,server', '--builds', 'fastdebug,product']) |
1469 buildvms(['--vms', 'server-nograal', '--builds', 'product']) | 1462 buildvms(['--vms', 'server-nograal', '--builds', 'product']) |
1470 buildvms(['--vms', 'server-nograal', '--builds', 'optimized']) | 1463 buildvms(['--vms', 'server-nograal', '--builds', 'optimized']) |
1471 tasks.append(t.stop()) | |
1472 | 1464 |
1473 for vmbuild in ['product', 'fastdebug']: | 1465 for vmbuild in ['product', 'fastdebug']: |
1474 for theVm in ['client', 'server']: | 1466 for theVm in ['client', 'server']: |
1475 if not isVMSupported(theVm): | 1467 if not isVMSupported(theVm): |
1476 mx.log('The' + theVm + ' VM is not supported on this platform') | 1468 mx.log('The' + theVm + ' VM is not supported on this platform') |
1477 continue | 1469 continue |
1478 with VM(theVm, vmbuild): | 1470 with VM(theVm, vmbuild): |
1479 t = Task('DaCapo_pmd:' + theVm + ':' + vmbuild) | 1471 with Task('DaCapo_pmd:' + theVm + ':' + vmbuild, tasks): |
1480 dacapo(['pmd']) | 1472 dacapo(['pmd']) |
1481 tasks.append(t.stop()) | 1473 |
1482 | 1474 with Task('UnitTests:' + theVm + ':' + vmbuild, tasks): |
1483 t = Task('UnitTests:' + theVm + ':' + vmbuild) | 1475 unittest(['-XX:CompileCommand=exclude,*::run*', 'graal.api']) |
1484 unittest(['-XX:CompileCommand=exclude,*::run*', 'graal.api']) | |
1485 tasks.append(t.stop()) | |
1486 | 1476 |
1487 | 1477 |
1488 def gate(args, gate_body=_basic_gate_body): | 1478 def gate(args, gate_body=_basic_gate_body): |
1489 """run the tests used to validate a push | 1479 """run the tests used to validate a push |
1490 | 1480 |
1502 global _jacoco | 1492 global _jacoco |
1503 | 1493 |
1504 tasks = [] | 1494 tasks = [] |
1505 total = Task('Gate') | 1495 total = Task('Gate') |
1506 try: | 1496 try: |
1507 | 1497 with Task('Pylint', tasks): |
1508 t = Task('Pylint') | 1498 mx.pylint([]) |
1509 mx.pylint([]) | |
1510 tasks.append(t.stop()) | |
1511 | 1499 |
1512 def _clean(name='Clean'): | 1500 def _clean(name='Clean'): |
1513 t = Task(name) | 1501 with Task(name, tasks): |
1514 cleanArgs = [] | 1502 cleanArgs = [] |
1515 if not args.cleanNative: | 1503 if not args.cleanNative: |
1516 cleanArgs.append('--no-native') | 1504 cleanArgs.append('--no-native') |
1517 if not args.cleanJava: | 1505 if not args.cleanJava: |
1518 cleanArgs.append('--no-java') | 1506 cleanArgs.append('--no-java') |
1519 clean(cleanArgs) | 1507 clean(cleanArgs) |
1520 tasks.append(t.stop()) | |
1521 _clean() | 1508 _clean() |
1522 | 1509 |
1523 t = Task('IDEConfigCheck') | 1510 with Task('IDEConfigCheck', tasks): |
1524 mx.ideclean([]) | 1511 mx.ideclean([]) |
1525 mx.ideinit([]) | 1512 mx.ideinit([]) |
1526 tasks.append(t.stop()) | |
1527 | 1513 |
1528 eclipse_exe = mx.get_env('ECLIPSE_EXE') | 1514 eclipse_exe = mx.get_env('ECLIPSE_EXE') |
1529 if eclipse_exe is not None: | 1515 if eclipse_exe is not None: |
1530 t = Task('CodeFormatCheck') | 1516 with Task('CodeFormatCheck', tasks) as t: |
1531 if mx.eclipseformat(['-e', eclipse_exe]) != 0: | 1517 if mx.eclipseformat(['-e', eclipse_exe]) != 0: |
1532 t.abort('Formatter modified files - run "mx eclipseformat", check in changes and repush') | 1518 t.abort('Formatter modified files - run "mx eclipseformat", check in changes and repush') |
1533 tasks.append(t.stop()) | 1519 |
1534 | 1520 with Task('Canonicalization Check', tasks) as t: |
1535 t = Task('Canonicalization Check') | 1521 mx.log(time.strftime('%d %b %Y %H:%M:%S - Ensuring mx/projects files are canonicalized...')) |
1536 mx.log(time.strftime('%d %b %Y %H:%M:%S - Ensuring mx/projects files are canonicalized...')) | 1522 if mx.canonicalizeprojects([]) != 0: |
1537 if mx.canonicalizeprojects([]) != 0: | 1523 t.abort('Rerun "mx canonicalizeprojects" and check-in the modified mx/projects files.') |
1538 t.abort('Rerun "mx canonicalizeprojects" and check-in the modified mx/projects files.') | |
1539 tasks.append(t.stop()) | |
1540 | 1524 |
1541 if mx.get_env('JDT'): | 1525 if mx.get_env('JDT'): |
1542 t = Task('BuildJavaWithEcj') | 1526 with Task('BuildJavaWithEcj', tasks): |
1543 build(['-p', '--no-native', '--jdt-warning-as-error']) | 1527 build(['-p', '--no-native', '--jdt-warning-as-error']) |
1544 tasks.append(t.stop()) | |
1545 | |
1546 _clean('CleanAfterEcjBuild') | 1528 _clean('CleanAfterEcjBuild') |
1547 | 1529 |
1548 t = Task('BuildJavaWithJavac') | 1530 with Task('BuildJavaWithJavac', tasks): |
1549 build(['-p', '--no-native', '--force-javac']) | 1531 build(['-p', '--no-native', '--force-javac']) |
1550 tasks.append(t.stop()) | 1532 |
1551 | 1533 with Task('Checkheaders', tasks) as t: |
1552 t = Task('Checkheaders') | 1534 if checkheaders([]) != 0: |
1553 if checkheaders([]) != 0: | 1535 t.abort('Checkheaders warnings were found') |
1554 t.abort('Checkheaders warnings were found') | 1536 |
1555 tasks.append(t.stop()) | 1537 with Task('FindBugs', tasks) as t: |
1556 | 1538 if findbugs([]) != 0: |
1557 t = Task('FindBugs') | 1539 t.abort('FindBugs warnings were found') |
1558 if findbugs([]) != 0: | |
1559 t.abort('FindBugs warnings were found') | |
1560 tasks.append(t.stop()) | |
1561 | 1540 |
1562 if exists('jacoco.exec'): | 1541 if exists('jacoco.exec'): |
1563 os.unlink('jacoco.exec') | 1542 os.unlink('jacoco.exec') |
1564 | 1543 |
1565 if args.jacocout is not None: | 1544 if args.jacocout is not None: |