Merge branch 'master' of github.com:jduprat/ispc
This commit is contained in:
20
run_tests.py
20
run_tests.py
@@ -38,6 +38,8 @@ parser.add_option("-c", "--compiler", dest="compiler_exe", help="Compiler binary
|
|||||||
default=None)
|
default=None)
|
||||||
parser.add_option('-o', '--no-opt', dest='no_opt', help='Disable optimization',
|
parser.add_option('-o', '--no-opt', dest='no_opt', help='Disable optimization',
|
||||||
default=False, action="store_true")
|
default=False, action="store_true")
|
||||||
|
parser.add_option('-j', '--jobs', dest='num_jobs', help='Maximum number of jobs to run in parallel',
|
||||||
|
default="1024", type="int")
|
||||||
parser.add_option('-v', '--verbose', dest='verbose', help='Enable verbose output',
|
parser.add_option('-v', '--verbose', dest='verbose', help='Enable verbose output',
|
||||||
default=False, action="store_true")
|
default=False, action="store_true")
|
||||||
if not is_windows:
|
if not is_windows:
|
||||||
@@ -54,7 +56,7 @@ else:
|
|||||||
if not is_windows:
|
if not is_windows:
|
||||||
ispc_exe = "./ispc"
|
ispc_exe = "./ispc"
|
||||||
else:
|
else:
|
||||||
ispc_exe = "Release/ispc.exe"
|
ispc_exe = "../Release/ispc.exe"
|
||||||
|
|
||||||
is_generic_target = options.target.find("generic-") != -1
|
is_generic_target = options.target.find("generic-") != -1
|
||||||
if is_generic_target and options.include_file == None:
|
if is_generic_target and options.include_file == None:
|
||||||
@@ -83,7 +85,7 @@ else:
|
|||||||
files = [ ]
|
files = [ ]
|
||||||
for f in args:
|
for f in args:
|
||||||
if os.path.splitext(string.lower(f))[1] != ".ispc":
|
if os.path.splitext(string.lower(f))[1] != ".ispc":
|
||||||
print "Ignoring file %s, which doesn't have an .ispc extension." % f
|
sys.stdout.write("Ignoring file %s, which doesn't have an .ispc extension.\n" % f)
|
||||||
else:
|
else:
|
||||||
files += [ f ]
|
files += [ f ]
|
||||||
|
|
||||||
@@ -218,7 +220,7 @@ def run_test(filename):
|
|||||||
obj_name = "%s%s.obj" % (input_prefix, filename)
|
obj_name = "%s%s.obj" % (input_prefix, filename)
|
||||||
exe_name = "%s%s.exe" % (input_prefix, filename)
|
exe_name = "%s%s.exe" % (input_prefix, filename)
|
||||||
|
|
||||||
cc_cmd = "%s /I. /Iwinstuff /Zi /nologo /DTEST_SIG=%d %stest_static.cpp %s /Fe%s" % \
|
cc_cmd = "%s /I. /I../winstuff /Zi /nologo /DTEST_SIG=%d %stest_static.cpp %s /Fe%s" % \
|
||||||
(options.compiler_exe, match, input_prefix, obj_name, exe_name)
|
(options.compiler_exe, match, input_prefix, obj_name, exe_name)
|
||||||
if should_fail:
|
if should_fail:
|
||||||
cc_cmd += " /DEXPECT_FAILURE"
|
cc_cmd += " /DEXPECT_FAILURE"
|
||||||
@@ -256,8 +258,8 @@ def run_test(filename):
|
|||||||
if not run_error:
|
if not run_error:
|
||||||
os.unlink(exe_name)
|
os.unlink(exe_name)
|
||||||
if is_windows:
|
if is_windows:
|
||||||
os.unlink(filename + ".pdb")
|
os.unlink("%s%s.pdb" % (input_prefix, filename))
|
||||||
os.unlink(filename + ".ilk")
|
os.unlink("%s%s.ilk" % (input_prefix, filename))
|
||||||
os.unlink(obj_name)
|
os.unlink(obj_name)
|
||||||
except:
|
except:
|
||||||
None
|
None
|
||||||
@@ -314,12 +316,14 @@ if __name__ == '__main__':
|
|||||||
compile_error_files = [ ]
|
compile_error_files = [ ]
|
||||||
run_error_files = [ ]
|
run_error_files = [ ]
|
||||||
|
|
||||||
nthreads = multiprocessing.cpu_count()
|
nthreads = min(multiprocessing.cpu_count(), options.num_jobs)
|
||||||
print "Found %d CPUs. Running %d tests." % (nthreads, total_tests)
|
sys.stdout.write("Running %d jobs in parallel. Running %d tests.\n" % (nthreads, total_tests))
|
||||||
|
|
||||||
# put each of the test filenames into a queue
|
# put each of the test filenames into a queue
|
||||||
q = multiprocessing.Queue()
|
q = multiprocessing.Queue()
|
||||||
for fn in files:
|
for fn in files:
|
||||||
|
if is_windows:
|
||||||
|
fn = fn.replace("\\",'/')
|
||||||
q.put(fn)
|
q.put(fn)
|
||||||
for x in range(nthreads):
|
for x in range(nthreads):
|
||||||
q.put('STOP')
|
q.put('STOP')
|
||||||
@@ -339,7 +343,7 @@ if __name__ == '__main__':
|
|||||||
# (i.e. return 0 if all is ok)
|
# (i.e. return 0 if all is ok)
|
||||||
for t in task_threads:
|
for t in task_threads:
|
||||||
t.join()
|
t.join()
|
||||||
print
|
sys.stdout.write("\n")
|
||||||
|
|
||||||
while not qret.empty():
|
while not qret.empty():
|
||||||
(c, r) = qret.get()
|
(c, r) = qret.get()
|
||||||
|
|||||||
@@ -1,7 +1,14 @@
|
|||||||
#ifndef MY_STDINT_H
|
#ifndef MY_STDINT_H
|
||||||
#define MY_STDINT_H 1
|
#define MY_STDINT_H 1
|
||||||
|
|
||||||
typedef __int32 int32_t;
|
typedef signed char int8_t;
|
||||||
typedef __int64 int64_t;
|
typedef signed __int16 int16_t;
|
||||||
|
typedef signed __int32 int32_t;
|
||||||
|
typedef signed __int64 int64_t;
|
||||||
|
typedef unsigned char uint8_t;
|
||||||
|
|
||||||
|
typedef unsigned __int16 uint16_t;
|
||||||
|
typedef unsigned __int32 uint32_t;
|
||||||
|
typedef unsigned __int64 uint64_t;
|
||||||
|
|
||||||
#endif // MY_STDINT_H
|
#endif // MY_STDINT_H
|
||||||
Reference in New Issue
Block a user