Mercurial > hg > graal-compiler
comparison mx/commands.py @ 4684:e136f2d0d002
Activate jtt for the gate
Add --jacoco option to mx to collect coverage info, add jacocoreport command to generate report
Small cosmetic fix to the GraphBuilder
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Fri, 24 Feb 2012 17:16:03 +0100 |
parents | b06ade6e927c |
children | c142a64141a8 |
comparison
equal
deleted
inserted
replaced
4681:84e7d6690293 | 4684:e136f2d0d002 |
---|---|
43 _vm = 'graal' | 43 _vm = 'graal' |
44 | 44 |
45 """ The VM build that will be run by the 'vm' command: product(default), fastdebug or debug. | 45 """ The VM build that will be run by the 'vm' command: product(default), fastdebug or debug. |
46 This can be set via the global '--fastdebug' and '--debug' options. """ | 46 This can be set via the global '--fastdebug' and '--debug' options. """ |
47 _vmbuild = 'product' | 47 _vmbuild = 'product' |
48 | |
49 _jacoco = False | |
50 | |
51 _jacocoExcludes = ['com.oracle.max.graal.hotspot.snippets.ArrayCopySnippets', | |
52 'com.oracle.max.graal.snippets.DoubleSnippets', | |
53 'com.oracle.max.graal.snippets.FloatSnippets', | |
54 'com.oracle.max.graal.snippets.MathSnippetsX86', | |
55 'com.oracle.max.graal.snippets.NodeClassSnippets', | |
56 'com.oracle.max.graal.hotspot.snippets.SystemSnippets', | |
57 'com.oracle.max.graal.hotspot.snippets.UnsafeSnippets'] | |
48 | 58 |
49 _copyrightTemplate = """/* | 59 _copyrightTemplate = """/* |
50 * Copyright (c) {0}, Oracle and/or its affiliates. All rights reserved. | 60 * Copyright (c) {0}, Oracle and/or its affiliates. All rights reserved. |
51 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 61 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
52 * | 62 * |
473 | 483 |
474 build = vmbuild if vmbuild is not None else _vmbuild if _vmSourcesAvailable else 'product' | 484 build = vmbuild if vmbuild is not None else _vmbuild if _vmSourcesAvailable else 'product' |
475 mx.expand_project_in_args(args) | 485 mx.expand_project_in_args(args) |
476 if mx.java().debug: | 486 if mx.java().debug: |
477 args = ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000'] + args | 487 args = ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000'] + args |
488 if _jacoco: | |
489 jacocoagent = mx.library("JACOCOAGENT", True) | |
490 agentOptions = { | |
491 'append' : 'false', | |
492 'bootclasspath' : 'true', | |
493 'includes' : 'com.oracle.max.*', | |
494 'excludes' : ':'.join(_jacocoExcludes) | |
495 } | |
496 args = ['-javaagent:' + jacocoagent.get_path(True) + '=' + ','.join([k + '=' + v for k, v in agentOptions.items()])] + args | |
478 exe = join(_jdk(build), 'bin', mx.exe_suffix('java')) | 497 exe = join(_jdk(build), 'bin', mx.exe_suffix('java')) |
479 return mx.run([exe, '-' + vm] + args, nonZeroIsFatal=nonZeroIsFatal, out=out, err=err, cwd=cwd, timeout=timeout) | 498 return mx.run([exe, '-' + vm] + args, nonZeroIsFatal=nonZeroIsFatal, out=out, err=err, cwd=cwd, timeout=timeout) |
480 | 499 |
481 | 500 |
482 # Table of unit tests. | 501 # Table of unit tests. |
677 | 696 |
678 t = Task('UnitTests:' + vmbuild) | 697 t = Task('UnitTests:' + vmbuild) |
679 unittest([]) | 698 unittest([]) |
680 tasks.append(t.stop()) | 699 tasks.append(t.stop()) |
681 | 700 |
682 # t = Task('JavaTesterTests:' + vmbuild) | 701 t = Task('JavaTesterTests:' + vmbuild) |
683 # jtt([]) | 702 jtt([]) |
684 # tasks.append(t.stop()) | 703 tasks.append(t.stop()) |
685 | 704 |
686 for test in sanitycheck.getDacapos(level=sanitycheck.SanityCheckLevel.Gate, gateBuildLevel=vmbuild): | 705 for test in sanitycheck.getDacapos(level=sanitycheck.SanityCheckLevel.Gate, gateBuildLevel=vmbuild): |
687 t = Task(str(test) + ':' + vmbuild) | 706 t = Task(str(test) + ':' + vmbuild) |
688 if not test.test('graal'): | 707 if not test.test('graal'): |
689 t.abort(test.group + ' ' + test.name + ' Failed') | 708 t.abort(test.group + ' ' + test.name + ' Failed') |
808 build = _vmbuild if _vmSourcesAvailable else 'product' | 827 build = _vmbuild if _vmSourcesAvailable else 'product' |
809 lib = mx.lib_suffix('hsdis-amd64') | 828 lib = mx.lib_suffix('hsdis-amd64') |
810 path = join(_vmLibDirInJdk(_jdk(build)), lib) | 829 path = join(_vmLibDirInJdk(_jdk(build)), lib) |
811 mx.download(path, ['http://lafo.ssw.uni-linz.ac.at/hsdis/' + flavor + "/" + lib]) | 830 mx.download(path, ['http://lafo.ssw.uni-linz.ac.at/hsdis/' + flavor + "/" + lib]) |
812 | 831 |
832 def jacocoreport(args): | |
833 """creates a JaCoCo coverage report | |
834 | |
835 Creates the report from the 'jacoco.exec' file in the current directory. | |
836 Default output directory is 'coverage', but an alternative can be provided as an argument.""" | |
837 jacocoreport = mx.library("JACOCOREPORT", True) | |
838 out = 'coverage' | |
839 if len(args) == 1: | |
840 out = args[0] | |
841 elif len(args) > 1: | |
842 mx.abort('jacocoreport takes only one argument : an output directory') | |
843 mx.run_java(['-jar', jacocoreport.get_path(True), '-in', 'jacoco.exec', '-g', join(_graal_home, 'graal'), out]) | |
844 | |
813 def mx_init(): | 845 def mx_init(): |
814 _vmbuild = 'product' | 846 _vmbuild = 'product' |
815 commands = { | 847 commands = { |
816 'build': [build, '[-options]'], | 848 'build': [build, '[-options]'], |
817 'buildvms': [buildvms, '[-options]'], | 849 'buildvms': [buildvms, '[-options]'], |
825 'gate' : [gate, '[-options]'], | 857 'gate' : [gate, '[-options]'], |
826 'gv' : [gv, ''], | 858 'gv' : [gv, ''], |
827 'bench' : [bench, '[-resultfile file] [all(default)|dacapo|specjvm2008|bootstrap]'], | 859 'bench' : [bench, '[-resultfile file] [all(default)|dacapo|specjvm2008|bootstrap]'], |
828 'unittest' : [unittest, '[filters...]'], | 860 'unittest' : [unittest, '[filters...]'], |
829 'jtt' : [jtt, '[filters...]'], | 861 'jtt' : [jtt, '[filters...]'], |
862 'jacocoreport' : [jacocoreport, '[output directory]'], | |
830 'vm': [vm, '[-options] class [args...]'] | 863 'vm': [vm, '[-options] class [args...]'] |
831 } | 864 } |
865 | |
866 mx.add_argument('--jacoco', action='store_true', dest='jacoco', help='instruments com.oracle.max.* classes using JaCoCo') | |
832 | 867 |
833 if (_vmSourcesAvailable): | 868 if (_vmSourcesAvailable): |
834 mx.add_argument('--vm', action='store', dest='vm', default='graal', choices=['graal', 'server', 'client'], help='the VM to build/run (default: graal)') | 869 mx.add_argument('--vm', action='store', dest='vm', default='graal', choices=['graal', 'server', 'client'], help='the VM to build/run (default: graal)') |
835 mx.add_argument('--product', action='store_const', dest='vmbuild', const='product', help='select the product build of the VM') | 870 mx.add_argument('--product', action='store_const', dest='vmbuild', const='product', help='select the product build of the VM') |
836 mx.add_argument('--debug', action='store_const', dest='vmbuild', const='debug', help='select the debug build of the VM') | 871 mx.add_argument('--debug', action='store_const', dest='vmbuild', const='debug', help='select the debug build of the VM') |
857 global _vm | 892 global _vm |
858 _vm = opts.vm | 893 _vm = opts.vm |
859 if hasattr(opts, 'vmbuild') and opts.vmbuild is not None: | 894 if hasattr(opts, 'vmbuild') and opts.vmbuild is not None: |
860 global _vmbuild | 895 global _vmbuild |
861 _vmbuild = opts.vmbuild | 896 _vmbuild = opts.vmbuild |
897 if opts.jacoco: | |
898 global _jacoco | |
899 _jacoco = True |