Mercurial > hg > truffle
comparison mx/mx_graal.py @ 15324:5b5f47104c0d
mx: add whitelist for shortunittest
author | Bernhard Urban <bernhard.urban@jku.at> |
---|---|
date | Wed, 23 Apr 2014 13:02:07 +0200 |
parents | 6b3bb5a9a889 |
children | 25ce2866f105 |
comparison
equal
deleted
inserted
replaced
15323:6b3bb5a9a889 | 15324:5b5f47104c0d |
---|---|
903 os.remove(testfile) | 903 os.remove(testfile) |
904 | 904 |
905 _unittestHelpSuffix = """ | 905 _unittestHelpSuffix = """ |
906 Unittest options: | 906 Unittest options: |
907 | 907 |
908 --short-only run short testcases only | |
909 --long-only run long testcases only | |
910 --whitelist run only testcases which are included | 908 --whitelist run only testcases which are included |
911 in the given whitelist | 909 in the given whitelist |
912 | 910 |
913 To avoid conflicts with VM options '--' can be used as delimiter. | 911 To avoid conflicts with VM options '--' can be used as delimiter. |
914 | 912 |
943 description='run the JUnit tests', | 941 description='run the JUnit tests', |
944 add_help=False, | 942 add_help=False, |
945 formatter_class=RawDescriptionHelpFormatter, | 943 formatter_class=RawDescriptionHelpFormatter, |
946 epilog=_unittestHelpSuffix, | 944 epilog=_unittestHelpSuffix, |
947 ) | 945 ) |
948 group = parser.add_mutually_exclusive_group() | |
949 group.add_argument('--short-only', action='store_true', help='run short testcases only') | |
950 group.add_argument('--long-only', action='store_true', help='run long testcases only') | |
951 parser.add_argument('--whitelist', help='run testcases specified in whitelist only', metavar='<path>') | 946 parser.add_argument('--whitelist', help='run testcases specified in whitelist only', metavar='<path>') |
952 | 947 |
953 ut_args = [] | 948 ut_args = [] |
954 delimiter = False | 949 delimiter = False |
955 # check for delimiter | 950 # check for delimiter |
973 with open(join(_graal_home, parsed_args.whitelist)) as fp: | 968 with open(join(_graal_home, parsed_args.whitelist)) as fp: |
974 whitelist = [l.rstrip() for l in fp.readlines()] | 969 whitelist = [l.rstrip() for l in fp.readlines()] |
975 except IOError: | 970 except IOError: |
976 mx.log('warning: could not read whitelist: ' + parsed_args.whitelist) | 971 mx.log('warning: could not read whitelist: ' + parsed_args.whitelist) |
977 | 972 |
978 if parsed_args.short_only: | 973 _unittest(args, ['@Test', '@Parameters'], whitelist=whitelist) |
979 annotations = ['@Test'] | |
980 else: | |
981 annotations = ['@Test', '@Parameters'] | |
982 | |
983 _unittest(args, annotations, whitelist=whitelist) | |
984 | 974 |
985 def shortunittest(args): | 975 def shortunittest(args): |
986 """alias for 'unittest --short-only'{0}""" | 976 """alias for 'unittest --whitelist test/whitelist_shortunittest.txt'{0}""" |
987 | 977 |
988 args.insert(0, '--short-only') | 978 args = ['--whitelist', 'test/whitelist_shortunittest.txt'] + args |
989 unittest(args) | 979 unittest(args) |
990 | 980 |
991 def buildvms(args): | 981 def buildvms(args): |
992 """build one or more VMs in various configurations""" | 982 """build one or more VMs in various configurations""" |
993 | 983 |