mirror of https://github.com/tc39/test262.git
Skip parsing test files that don't need regeneration
This commit is contained in:
parent
e07f577a9c
commit
1483cdee1a
|
@ -49,8 +49,8 @@ def create(args):
|
|||
for test in exp.expand('utf-8', caseFile):
|
||||
if args.out:
|
||||
try:
|
||||
existing = Test(test.file_name)
|
||||
existing.load(args.out)
|
||||
test_file = os.path.join(args.out, test.file_name)
|
||||
test_mtime = os.path.getmtime(test_file)
|
||||
|
||||
if args.no_clobber:
|
||||
print_error(
|
||||
|
@ -58,18 +58,18 @@ def create(args):
|
|||
exit(1)
|
||||
|
||||
if not args.regenerate:
|
||||
test_file = os.path.join(args.out, test.file_name)
|
||||
test_mtime = os.path.getmtime(test_file)
|
||||
source_files = test.source_file_names
|
||||
if all(test_mtime > os.path.getmtime(f) for f in source_files):
|
||||
continue
|
||||
|
||||
existing = Test(test_file)
|
||||
existing.load()
|
||||
if not existing.is_generated():
|
||||
print_error(
|
||||
'Refusing to overwrite non-generated file: ' +
|
||||
test.file_name)
|
||||
exit(1)
|
||||
except IOError:
|
||||
except (OSError, IOError):
|
||||
pass
|
||||
|
||||
test.write(args.out, parents=args.parents)
|
||||
|
|
|
@ -24,9 +24,8 @@ class Test:
|
|||
self.source = None
|
||||
self.attribs = dict(meta=None)
|
||||
|
||||
def load(self, prefix = None):
|
||||
location = os.path.join(prefix or '', self.file_name)
|
||||
with open(location, 'r') as handle:
|
||||
def load(self):
|
||||
with open(self.file_name, 'r') as handle:
|
||||
self.source = handle.read()
|
||||
self._parse()
|
||||
|
||||
|
|
Loading…
Reference in New Issue