mirror of
https://github.com/tc39/test262.git
synced 2025-07-27 07:54:41 +02:00
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):
|
for test in exp.expand('utf-8', caseFile):
|
||||||
if args.out:
|
if args.out:
|
||||||
try:
|
try:
|
||||||
existing = Test(test.file_name)
|
test_file = os.path.join(args.out, test.file_name)
|
||||||
existing.load(args.out)
|
test_mtime = os.path.getmtime(test_file)
|
||||||
|
|
||||||
if args.no_clobber:
|
if args.no_clobber:
|
||||||
print_error(
|
print_error(
|
||||||
@ -58,18 +58,18 @@ def create(args):
|
|||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
if not args.regenerate:
|
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
|
source_files = test.source_file_names
|
||||||
if all(test_mtime > os.path.getmtime(f) for f in source_files):
|
if all(test_mtime > os.path.getmtime(f) for f in source_files):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
existing = Test(test_file)
|
||||||
|
existing.load()
|
||||||
if not existing.is_generated():
|
if not existing.is_generated():
|
||||||
print_error(
|
print_error(
|
||||||
'Refusing to overwrite non-generated file: ' +
|
'Refusing to overwrite non-generated file: ' +
|
||||||
test.file_name)
|
test.file_name)
|
||||||
exit(1)
|
exit(1)
|
||||||
except IOError:
|
except (OSError, IOError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
test.write(args.out, parents=args.parents)
|
test.write(args.out, parents=args.parents)
|
||||||
|
@ -24,9 +24,8 @@ class Test:
|
|||||||
self.source = None
|
self.source = None
|
||||||
self.attribs = dict(meta=None)
|
self.attribs = dict(meta=None)
|
||||||
|
|
||||||
def load(self, prefix = None):
|
def load(self):
|
||||||
location = os.path.join(prefix or '', self.file_name)
|
with open(self.file_name, 'r') as handle:
|
||||||
with open(location, 'r') as handle:
|
|
||||||
self.source = handle.read()
|
self.source = handle.read()
|
||||||
self._parse()
|
self._parse()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user