OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright 2008 Google Inc. All rights reserved. | 3 # Copyright 2008 Google Inc. All rights reserved. |
4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
6 # met: | 6 # met: |
7 # | 7 # |
8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
(...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
942 choices=PROGRESS_INDICATORS.keys(), default="mono") | 942 choices=PROGRESS_INDICATORS.keys(), default="mono") |
943 result.add_option("--no-build", help="Don't build requirements", | 943 result.add_option("--no-build", help="Don't build requirements", |
944 default=False, action="store_true") | 944 default=False, action="store_true") |
945 result.add_option("--report", help="Print a summary of the tests to be run", | 945 result.add_option("--report", help="Print a summary of the tests to be run", |
946 default=False, action="store_true") | 946 default=False, action="store_true") |
947 result.add_option("-s", "--suite", help="A test suite", | 947 result.add_option("-s", "--suite", help="A test suite", |
948 default=[], action="append") | 948 default=[], action="append") |
949 result.add_option("-t", "--timeout", help="Timeout in seconds", | 949 result.add_option("-t", "--timeout", help="Timeout in seconds", |
950 default=60, type="int") | 950 default=60, type="int") |
951 result.add_option("--arch", help='The architecture to run tests for', | 951 result.add_option("--arch", help='The architecture to run tests for', |
952 default=ARCH_GUESS) | 952 default='none') |
| 953 result.add_option("--simulator", help="Run tests with architecture simulator", |
| 954 default='none') |
953 result.add_option("--special-command", default=None) | 955 result.add_option("--special-command", default=None) |
954 result.add_option("--cat", help="Print the source of the tests", | 956 result.add_option("--cat", help="Print the source of the tests", |
955 default=False, action="store_true") | 957 default=False, action="store_true") |
956 return result | 958 return result |
957 | 959 |
958 | 960 |
959 def ProcessOptions(options): | 961 def ProcessOptions(options): |
960 global VERBOSE | 962 global VERBOSE |
961 VERBOSE = options.verbose | 963 VERBOSE = options.verbose |
962 options.mode = options.mode.split(',') | 964 options.mode = options.mode.split(',') |
963 for mode in options.mode: | 965 for mode in options.mode: |
964 if not mode in ['debug', 'release']: | 966 if not mode in ['debug', 'release']: |
965 print "Unknown mode %s" % mode | 967 print "Unknown mode %s" % mode |
966 return False | 968 return False |
| 969 if options.simulator != 'none': |
| 970 # Simulator argument was set. Make sure arch and simulator agree. |
| 971 if options.simulator != options.arch: |
| 972 if options.arch == 'none': |
| 973 options.arch = options.simulator |
| 974 else: |
| 975 print "Architecture %s does not match sim %s" %(options.arch, options.si
mulator) |
| 976 return False |
| 977 # Ensure that the simulator argument is handed down to scons. |
| 978 options.scons_flags.append("simulator=" + options.simulator) |
| 979 else: |
| 980 # If options.arch is not set by the command line and no simulator setting |
| 981 # was found, set the arch to the guess. |
| 982 if options.arch == 'none': |
| 983 options.arch = ARCH_GUESS |
967 return True | 984 return True |
968 | 985 |
969 | 986 |
970 REPORT_TEMPLATE = """\ | 987 REPORT_TEMPLATE = """\ |
971 Total: %(total)i tests | 988 Total: %(total)i tests |
972 * %(skipped)4d tests will be skipped | 989 * %(skipped)4d tests will be skipped |
973 * %(nocrash)4d tests are expected to be flaky but not crash | 990 * %(nocrash)4d tests are expected to be flaky but not crash |
974 * %(pass)4d tests are expected to pass | 991 * %(pass)4d tests are expected to pass |
975 * %(fail_ok)4d tests are expected to fail that we won't fix | 992 * %(fail_ok)4d tests are expected to fail that we won't fix |
976 * %(fail)4d tests are expected to fail that we should fix\ | 993 * %(fail)4d tests are expected to fail that we should fix\ |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1116 return 0 | 1133 return 0 |
1117 else: | 1134 else: |
1118 return 1 | 1135 return 1 |
1119 except KeyboardInterrupt: | 1136 except KeyboardInterrupt: |
1120 print "Interrupted" | 1137 print "Interrupted" |
1121 return 1 | 1138 return 1 |
1122 | 1139 |
1123 | 1140 |
1124 if __name__ == '__main__': | 1141 if __name__ == '__main__': |
1125 sys.exit(Main()) | 1142 sys.exit(Main()) |
OLD | NEW |