mirror of
https://github.com/ariya/phantomjs.git
synced 2024-10-26 06:17:33 +03:00
Support globs in run-tests.py#TESTS.
This means that there is no longer a need to add every individual test to the list; only new *directories* have to be mentioned. New tests can be added just by dropping .js files into appropriate directories. Tests which are not meant to be run by default now live in tests/manual/. Currently there is one such test, tests/manual/standards/ecma-test262.js, which downloads and runs the ECMAScript conformance suite. Ongoing work on issue #12439.
This commit is contained in:
parent
83f4baf8c6
commit
1adbbe4830
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import inspect
|
||||
import glob
|
||||
import json
|
||||
import optparse
|
||||
import os
|
||||
@ -21,34 +22,11 @@ HTTP_PORT = 9180
|
||||
http_running = False
|
||||
|
||||
TESTS = [
|
||||
'basics/exit.js',
|
||||
'basics/global.js',
|
||||
'basics/onerror.js',
|
||||
'basics/stacktrace.js',
|
||||
'basics/version.js',
|
||||
'module/webpage/open.js',
|
||||
'module/webpage/loading.js',
|
||||
'module/webpage/custom-headers.js',
|
||||
'module/webpage/add-header.js',
|
||||
'module/webpage/remove-header.js',
|
||||
'module/webpage/modify-header.js',
|
||||
'module/webpage/repaint-requested.js',
|
||||
'module/webpage/change-request-url.js',
|
||||
'module/webpage/change-request-encoded-url.js',
|
||||
'module/webpage/abort-network-request.js',
|
||||
'module/webpage/resource-request-error.js',
|
||||
'module/webpage/resource-received-error.js',
|
||||
'module/webpage/no-plugin.js',
|
||||
'module/system/system.js',
|
||||
'module/system/args.js',
|
||||
'module/system/os.js',
|
||||
'module/system/pid.js',
|
||||
'module/system/stdout.js',
|
||||
'module/system/stdin.js',
|
||||
'module/system/stderr.js',
|
||||
'standards/javascript/date.js',
|
||||
'standards/javascript/function.js',
|
||||
'regression/issue12482.js',
|
||||
'basics/*.js',
|
||||
'module/system/*.js',
|
||||
'module/webpage/*.js',
|
||||
'standards/javascript/*.js',
|
||||
'regression/*.js',
|
||||
'run-tests.js'
|
||||
]
|
||||
|
||||
@ -205,19 +183,17 @@ def run_phantomjs(script, args=[]):
|
||||
return process.returncode, '\n'.join(output)
|
||||
|
||||
|
||||
def run_test(filename):
|
||||
script = os.path.normpath(base_path + '/' + filename)
|
||||
|
||||
def run_test(script, name):
|
||||
args = []
|
||||
if options.verbose:
|
||||
args.append('--verbose')
|
||||
|
||||
result = 0
|
||||
if not os.path.isfile(script):
|
||||
print 'Could not locate %s' % filename
|
||||
print 'Could not locate %s' % name
|
||||
result = 1
|
||||
else:
|
||||
print '%s:' % filename
|
||||
print '%s:' % name
|
||||
returncode, output = run_phantomjs(script, args)
|
||||
if returncode != 0:
|
||||
if not options.verbose:
|
||||
@ -238,10 +214,19 @@ def run_tests():
|
||||
print
|
||||
|
||||
result = 0
|
||||
for test in TESTS:
|
||||
ret = run_test(test)
|
||||
for test_group in TESTS:
|
||||
test_group_name = os.path.dirname(test_group)
|
||||
test_glob = os.path.normpath(base_path + '/' + test_group)
|
||||
|
||||
if options.verbose:
|
||||
print 'Test group: %s...' % test_group_name
|
||||
print
|
||||
|
||||
for test_script in glob.glob(test_glob):
|
||||
tname = test_group_name + '/' + os.path.basename(test_script)
|
||||
ret = run_test(test_script, tname)
|
||||
if ret != 0:
|
||||
print 'The test %s FAILED' % test
|
||||
print 'The test %s FAILED' % tname
|
||||
print
|
||||
result = 1
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user