Commit a0b9e7cb authored by Kevin Modzelewski's avatar Kevin Modzelewski

Merge pull request #363 from rntz/better-tester

make tester produce useful help messages
parents 4480e933 86355597
...@@ -187,8 +187,8 @@ add_test(NAME check-format COMMAND ${CMAKE_SOURCE_DIR}/tools/check_format.sh ${L ...@@ -187,8 +187,8 @@ add_test(NAME check-format COMMAND ${CMAKE_SOURCE_DIR}/tools/check_format.sh ${L
add_test(NAME gc_unittest COMMAND gc_unittest) add_test(NAME gc_unittest COMMAND gc_unittest)
add_test(NAME analysis_unittest COMMAND analysis_unittest) add_test(NAME analysis_unittest COMMAND analysis_unittest)
add_test(NAME pyston_defaults COMMAND ${PYTHON_EXE} ${CMAKE_SOURCE_DIR}/tools/tester.py -R ./pyston -j${TEST_THREADS} -k ${CMAKE_SOURCE_DIR}/test/tests) add_test(NAME pyston_defaults COMMAND ${PYTHON_EXE} ${CMAKE_SOURCE_DIR}/tools/tester.py -R ./pyston -j${TEST_THREADS} -k ${CMAKE_SOURCE_DIR}/test/tests)
add_test(NAME pyston_max_compilation_tier COMMAND ${PYTHON_EXE} ${CMAKE_SOURCE_DIR}/tools/tester.py -R ./pyston -j${TEST_THREADS} -a -O -k ${CMAKE_SOURCE_DIR}/test/tests) add_test(NAME pyston_max_compilation_tier COMMAND ${PYTHON_EXE} ${CMAKE_SOURCE_DIR}/tools/tester.py -R ./pyston -j${TEST_THREADS} -a=-O -k ${CMAKE_SOURCE_DIR}/test/tests)
add_test(NAME pyston_experimental_pypa_parser COMMAND ${PYTHON_EXE} ${CMAKE_SOURCE_DIR}/tools/tester.py -a -x -R ./pyston -j${TEST_THREADS} -a -n -k ${CMAKE_SOURCE_DIR}/test/tests) add_test(NAME pyston_experimental_pypa_parser COMMAND ${PYTHON_EXE} ${CMAKE_SOURCE_DIR}/tools/tester.py -a=-x -R ./pyston -j${TEST_THREADS} -a=-n -k ${CMAKE_SOURCE_DIR}/test/tests)
# format # format
file(GLOB_RECURSE FORMAT_FILES ${CMAKE_SOURCE_DIR}/src/*.h ${CMAKE_SOURCE_DIR}/src/*.cpp) file(GLOB_RECURSE FORMAT_FILES ${CMAKE_SOURCE_DIR}/src/*.h ${CMAKE_SOURCE_DIR}/src/*.cpp)
......
...@@ -835,8 +835,8 @@ $(eval \ ...@@ -835,8 +835,8 @@ $(eval \
.PHONY: test$1 check$1 .PHONY: test$1 check$1
check$1 test$1: $(PYTHON_EXE_DEPS) pyston$1 ext_pyston check$1 test$1: $(PYTHON_EXE_DEPS) pyston$1 ext_pyston
$(PYTHON) $(TOOLS_DIR)/tester.py -R pyston$1 -j$(TEST_THREADS) -k $(TESTS_DIR) $(ARGS) $(PYTHON) $(TOOLS_DIR)/tester.py -R pyston$1 -j$(TEST_THREADS) -k $(TESTS_DIR) $(ARGS)
$(PYTHON) $(TOOLS_DIR)/tester.py -a -x -R pyston$1 -j$(TEST_THREADS) -a -n -k $(TESTS_DIR) $(ARGS) $(PYTHON) $(TOOLS_DIR)/tester.py -a=-x -R pyston$1 -j$(TEST_THREADS) -a=-n -k $(TESTS_DIR) $(ARGS)
$(PYTHON) $(TOOLS_DIR)/tester.py -R pyston$1 -j$(TEST_THREADS) -a -O -k $(TESTS_DIR) $(ARGS) $(PYTHON) $(TOOLS_DIR)/tester.py -R pyston$1 -j$(TEST_THREADS) -a=-O -k $(TESTS_DIR) $(ARGS)
.PHONY: run$1 dbg$1 .PHONY: run$1 dbg$1
run$1: pyston$1 $$(RUN_DEPS) run$1: pyston$1 $$(RUN_DEPS)
......
...@@ -14,13 +14,13 @@ ...@@ -14,13 +14,13 @@
#!/usr/bin/env python #!/usr/bin/env python
import Queue
import argparse
import cPickle import cPickle
import datetime import datetime
import functools import functools
import getopt
import glob import glob
import os import os
import Queue
import re import re
import resource import resource
import signal import signal
...@@ -366,34 +366,42 @@ def fileSize(fn): ...@@ -366,34 +366,42 @@ def fileSize(fn):
return os.stat(fn).st_size return os.stat(fn).st_size
# return len(list(open(fn))) # return len(list(open(fn)))
# our arguments
parser = argparse.ArgumentParser(description='Runs Pyston tests.')
parser.add_argument('-m', '--run-memcheck', action='store_true', help='run memcheck')
parser.add_argument('-j', '--num-threads', metavar='N', type=int, default=NUM_THREADS,
help='number of threads')
parser.add_argument('-k', '--keep-going', default=KEEP_GOING, action='store_true',
help='keep going after test failure')
parser.add_argument('-R', '--image', default=IMAGE,
help='the executable to test (default: %s)' % IMAGE)
parser.add_argument('-K', '--no-keep-going', dest='keep_going', action='store_false',
help='quit after test failure')
parser.add_argument('-a', '--extra-args', default=[], action='append',
help="additional arguments to pyston (must be invoked with equal sign: -a=-ARG)")
parser.add_argument('-t', '--time-limit', type=int, default=TIME_LIMIT,
help='set time limit in seconds for each test')
parser.add_argument('test_dir')
parser.add_argument('patterns', nargs='*')
if __name__ == "__main__": if __name__ == "__main__":
run_memcheck = False run_memcheck = False
start = 1 start = 1
opts, patterns = getopt.gnu_getopt(sys.argv[1:], "j:a:t:mR:kK") opts = parser.parse_args()
for (t, v) in opts: print opts
if t == '-m': run_memcheck = opts.run_memcheck
run_memcheck = True NUM_THREADS = opts.num_threads
elif t == '-j': IMAGE = opts.image
NUM_THREADS = int(v) KEEP_GOING = opts.keep_going
assert NUM_THREADS > 0 EXTRA_JIT_ARGS += opts.extra_args
elif t == '-R': TIME_LIMIT = opts.time_limit
IMAGE = v
elif t == '-k':
KEEP_GOING = True
elif t == '-K':
KEEP_GOING = False
elif t == '-a':
EXTRA_JIT_ARGS.append(v)
elif t == '-t':
TIME_LIMIT = int(v)
else:
raise Exception((t, v))
TEST_DIR = patterns[0] TEST_DIR = opts.test_dir
assert os.path.isdir(TEST_DIR), "%s doesn't look like a directory with tests in it" % TEST_DIR patterns = opts.patterns
patterns = patterns[1:] assert os.path.isdir(TEST_DIR), "%s doesn't look like a directory with tests in it" % TEST_DIR
TOSKIP = ["%s/%s.py" % (TEST_DIR, i) for i in ( TOSKIP = ["%s/%s.py" % (TEST_DIR, i) for i in (
"tuple_depth", "tuple_depth",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment