Changeset f866d15
- Timestamp:
- Sep 28, 2020, 5:00:45 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 21c3ea1
- Parents:
- 40c81e5
- Location:
- tests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/pybin/tools.py
r40c81e5 rf866d15 88 88 raise 89 89 90 def is_empty(fname): 91 if not os.path.isfile(fname): 92 return True 93 94 if os.stat(fname).st_size == 0: 95 return True 96 97 return False 98 90 99 def is_ascii(fname): 91 100 if settings.dry_run: 92 101 print("is_ascii: %s" % fname) 93 return True102 return (True, "") 94 103 95 104 if not os.path.isfile(fname): 96 return False97 98 code, out = sh("file %s" %fname, output_file=subprocess.PIPE)105 return (False, "No file") 106 107 code, out = sh("file", fname, output_file=subprocess.PIPE) 99 108 if code != 0: 100 return False109 return (False, "'file EXPECT' failed with code {}".format(code)) 101 110 102 111 match = re.search(".*: (.*)", out) 103 112 104 113 if not match: 105 return False 106 107 return match.group(1).startswith("ASCII text") 114 return (False, "Unreadable file type: '{}'".format(out)) 115 116 if "ASCII text" in match.group(1): 117 return (True, "") 118 119 return (False, "File type should be 'ASCII text', was '{}'".format(match.group(1))) 108 120 109 121 def is_exe(fname): -
tests/test.py
r40c81e5 rf866d15 366 366 failed = 0 367 367 368 # check if the expected files aren't empty 369 if not options.regenerate_expected: 370 for t in tests: 371 if is_empty(t.expect()): 372 print('WARNING: test "{}" has empty .expect file'.format(t.target()), file=sys.stderr) 373 368 374 # for each build configurations, run the test 369 375 with Timed() as total_dur:
Note: See TracChangeset
for help on using the changeset viewer.