- Timestamp:
- Aug 15, 2018, 11:22:23 PM (6 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
- Children:
- 3de9135
- Parents:
- 636e1b9 (diff), bdff89d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- tests
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/Makefile.am
r636e1b9 r14b253d 24 24 concurrent= 25 25 26 TEST_PY = python ${ srcdir}/test.py26 TEST_PY = python ${builddir}/test.py 27 27 28 28 # applies to both programs -
tests/Makefile.in
r636e1b9 r14b253d 301 301 quick_test = avl_test operators numericConstants expression enum array typeof cast raii/dtor-early-exit raii/init_once attributes 302 302 concurrent = 303 TEST_PY = python ${ srcdir}/test.py303 TEST_PY = python ${builddir}/test.py 304 304 305 305 # applies to both programs -
tests/config.py.in
r636e1b9 r14b253d 5 5 """ 6 6 7 SRCDIR = "@ srcdir@"8 BUILDDIR = "@ builddir@"7 SRCDIR = "@abs_srcdir@" 8 BUILDDIR = "@abs_builddir@" 9 9 HOSTARCH = "@host_cpu@" -
tests/pybin/settings.py
r636e1b9 r14b253d 6 6 7 7 try : 8 sys.path.append(os.getcwd()) 8 testpath = os.path.dirname(os.path.abspath(os.path.join(os.getcwd(), sys.argv[0]))) 9 sys.path.append(testpath) 9 10 import config 10 11 11 12 SRCDIR = os.path.abspath(config.SRCDIR) 12 13 BUILDDIR = os.path.abspath(config.BUILDDIR) 14 os.chdir(testpath) 15 13 16 except: 14 17 print('ERROR: missing config.py, re-run configure script.', file=sys.stderr) … … 88 91 self.flags = """INSTALL_FLAGS="%s" """ % ("" if value else "-in-tree") 89 92 93 class Timeouts: 94 def __init__(self, ts, tg): 95 self.single = Timeouts.check(ts) 96 self.total = Timeouts.check(tg) 97 98 @classmethod 99 def check(_, value): 100 if value < 1: 101 print("Timeouts must be at least 1 second", file=sys.stderr) 102 sys.exit(1) 103 104 return value 105 90 106 def init( options ): 91 107 global arch … … 95 111 global debug 96 112 global install 113 global timeout 97 114 98 115 dry_run = options.dry_run … … 102 119 install = Install(options.install) 103 120 arch = Architecture(options.arch) 121 timeout = Timeouts(options.timeout, options.global_timeout) 104 122 105 123 … … 110 128 111 129 def validate(): 112 make_ret, _ = tools.make( ".validate", error_file = ".validate.err", redirects = "2> /dev/null 1> /dev/null", ) 130 errf = os.path.join(BUILDDIR, ".validate.err") 131 make_ret, _ = tools.make( ".validate", error_file = errf, redirects = "2> /dev/null 1> /dev/null", ) 113 132 if make_ret != 0: 114 with open ( ".validate.err", "r") as myfile:133 with open (errf, "r") as myfile: 115 134 error=myfile.read() 116 135 print("ERROR: Invalid configuration %s:%s" % (arch.string, debug.string), file=sys.stderr) 117 136 print(" verify returned : \n%s" % error, file=sys.stderr) 118 tools.rm( "%s/.validate.err" % BUILDDIR)137 tools.rm(errf) 119 138 sys.exit(1) 120 139 121 tools.rm( "%s/.validate.err" % BUILDDIR)140 tools.rm(errf) -
tests/pybin/tools.py
r636e1b9 r14b253d 36 36 37 37 def is_ascii(fname): 38 if settings.dry_run: 39 print("is_ascii: %s" % fname) 40 return True 41 38 42 if not os.path.isfile(fname): 39 43 return False … … 132 136 # helper function to replace patterns in a file 133 137 def file_replace(fname, pat, s_after): 138 if settings.dry_run: 139 print("replacing '%s' with '%s' in %s" % (pat, s_after, fname)) 140 return 141 134 142 file = fileinput.FileInput(fname, inplace=True, backup='.bak') 135 143 for line in file: -
tests/test.py
r636e1b9 r14b253d 88 88 parser.add_argument('--install', help='Run all tests based on installed binaries or tree binaries', type=yes_no, default='no') 89 89 parser.add_argument('--arch', help='Test for specific architecture', type=str, default='') 90 parser.add_argument('--timeout', help='Maximum duration in seconds after a single test is considered to have timed out', type=int, default=60) 91 parser.add_argument('--global-timeout', help='Maximum cumulative duration in seconds after the ALL tests are considered to have timed out', type=int, default=7200) 90 92 parser.add_argument('--dry-run', help='Don\'t run the tests, only output the commands', action='store_true') 91 93 parser.add_argument('--list', help='List all test available', action='store_true') … … 160 162 if settings.dry_run or fileIsExecutable(exe_file) : 161 163 # run test 162 retcode, _ = sh("timeout 60 %s > %s 2>&1" % (exe_file, out_file), input = in_file)164 retcode, _ = sh("timeout %d %s > %s 2>&1" % (settings.timeout.single, exe_file, out_file), input = in_file) 163 165 else : 164 166 # simply cat the result into the output … … 172 174 173 175 if retcode == 0: 176 fixoutput(out_file) 174 177 if settings.generating : 175 178 # if we are ounly generating the output we still need to check that the test actually exists … … 182 185 else : 183 186 # fetch return code and error from the diff command 184 fixoutput(out_file)185 187 retcode, error = diff(cmp_file, out_file) 186 188 … … 234 236 tests, 235 237 chunksize = 1 236 ).get( 7200)238 ).get(settings.timeout.total) 237 239 except KeyboardInterrupt: 238 240 pool.terminate() … … 283 285 # users may want to simply list the tests 284 286 if options.list_comp : 285 print("-h --help --debug --dry-run --list --arch --all --regenerate-expected - j --jobs ", end='')287 print("-h --help --debug --dry-run --list --arch --all --regenerate-expected --install --timeout --global-timeout -j --jobs ", end='') 286 288 print(" ".join(map(lambda t: "%s" % (t.target()), tests))) 287 289
Note: See TracChangeset
for help on using the changeset viewer.