Merge pull request #481 from dbabokin/win_cleanup
Set of changes for better build and testing experience on Windows
This commit is contained in:
@@ -382,13 +382,13 @@
|
|||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<PreprocessorDefinitions>NOMINMAX;%LLVM_VERSION%</PreprocessorDefinitions>
|
<PreprocessorDefinitions>NOMINMAX;%LLVM_VERSION%</PreprocessorDefinitions>
|
||||||
<AdditionalIncludeDirectories>$(LLVM_INSTALL_DIR)\include;.;.\winstuff;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(LLVM_INSTALL_DIR)\include;.;.\winstuff;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<DisableSpecificWarnings>4146;4800;4996;4355;4624</DisableSpecificWarnings>
|
<DisableSpecificWarnings>4146;4800;4996;4355;4624;4244</DisableSpecificWarnings>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<AdditionalLibraryDirectories>$(LLVM_INSTALL_DIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>$(LLVM_INSTALL_DIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
<AdditionalDependencies>clangFrontend.lib;clangDriver.lib;clangSerialization.lib;clangParse.lib;clangSema.lib;clangAnalysis.lib;clangEdit.lib;clangAST.lib;clangLex.lib;clangBasic.lib;LLVMAnalysis.lib;LLVMArchive.lib;LLVMAsmParser.lib;LLVMAsmPrinter.lib;LLVMBitReader.lib;LLVMBitWriter.lib;LLVMCodeGen.lib;LLVMCore.lib;LLVMDebugInfo.lib;LLVMExecutionEngine.lib;LLVMInstCombine.lib;LLVMInstrumentation.lib;LLVMLinker.lib;LLVMMC.lib;LLVMMCDisassembler.lib;LLVMMCParser.lib;LLVMObject.lib;LLVMScalarOpts.lib;LLVMSelectionDAG.lib;LLVMSupport.lib;LLVMTarget.lib;LLVMTransformUtils.lib;LLVMX86ASMPrinter.lib;LLVMX86ASMParser.lib;LLVMX86Utils.lib;LLVMX86CodeGen.lib;LLVMX86Desc.lib;LLVMX86Disassembler.lib;LLVMX86Info.lib;LLVMipa.lib;LLVMipo.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>clangFrontend.lib;clangDriver.lib;clangSerialization.lib;clangParse.lib;clangSema.lib;clangAnalysis.lib;clangEdit.lib;clangAST.lib;clangLex.lib;clangBasic.lib;LLVMAnalysis.lib;LLVMAsmParser.lib;LLVMAsmPrinter.lib;LLVMBitReader.lib;LLVMBitWriter.lib;LLVMCodeGen.lib;LLVMCore.lib;LLVMExecutionEngine.lib;LLVMInstCombine.lib;LLVMInstrumentation.lib;LLVMLinker.lib;LLVMMC.lib;LLVMMCParser.lib;LLVMObject.lib;LLVMScalarOpts.lib;LLVMSelectionDAG.lib;LLVMSupport.lib;LLVMTarget.lib;LLVMTransformUtils.lib;LLVMX86ASMPrinter.lib;LLVMX86ASMParser.lib;LLVMX86Utils.lib;LLVMX86CodeGen.lib;LLVMX86Desc.lib;LLVMX86Disassembler.lib;LLVMX86Info.lib;LLVMipa.lib;LLVMipo.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
@@ -400,7 +400,7 @@
|
|||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>NOMINMAX;%LLVM_VERSION%</PreprocessorDefinitions>
|
<PreprocessorDefinitions>NOMINMAX;%LLVM_VERSION%</PreprocessorDefinitions>
|
||||||
<AdditionalIncludeDirectories>$(LLVM_INSTALL_DIR)\include;.;.\winstuff;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(LLVM_INSTALL_DIR)\include;.;.\winstuff;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<DisableSpecificWarnings>4146;4800;4996;4355;4624</DisableSpecificWarnings>
|
<DisableSpecificWarnings>4146;4800;4996;4355;4624;4244</DisableSpecificWarnings>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
@@ -408,7 +408,7 @@
|
|||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<AdditionalLibraryDirectories>$(LLVM_INSTALL_DIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>$(LLVM_INSTALL_DIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
<AdditionalDependencies>clangFrontend.lib;clangDriver.lib;clangSerialization.lib;clangParse.lib;clangSema.lib;clangAnalysis.lib;clangEdit.lib;clangAST.lib;clangLex.lib;clangBasic.lib;LLVMAnalysis.lib;LLVMArchive.lib;LLVMAsmParser.lib;LLVMAsmPrinter.lib;LLVMBitReader.lib;LLVMBitWriter.lib;LLVMCodeGen.lib;LLVMCore.lib;LLVMDebugInfo.lib;LLVMExecutionEngine.lib;LLVMInstCombine.lib;LLVMInstrumentation.lib;LLVMLinker.lib;LLVMMC.lib;LLVMMCDisassembler.lib;LLVMMCParser.lib;LLVMObject.lib;LLVMScalarOpts.lib;LLVMSelectionDAG.lib;LLVMSupport.lib;LLVMTarget.lib;LLVMTransformUtils.lib;LLVMX86ASMPrinter.lib;LLVMX86ASMParser.lib;LLVMX86Utils.lib;LLVMX86CodeGen.lib;LLVMX86Desc.lib;LLVMX86Disassembler.lib;LLVMX86Info.lib;LLVMipa.lib;LLVMipo.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>clangFrontend.lib;clangDriver.lib;clangSerialization.lib;clangParse.lib;clangSema.lib;clangAnalysis.lib;clangEdit.lib;clangAST.lib;clangLex.lib;clangBasic.lib;LLVMAnalysis.lib;LLVMAsmParser.lib;LLVMAsmPrinter.lib;LLVMBitReader.lib;LLVMBitWriter.lib;LLVMCodeGen.lib;LLVMCore.lib;LLVMExecutionEngine.lib;LLVMInstCombine.lib;LLVMInstrumentation.lib;LLVMLinker.lib;LLVMMC.lib;LLVMMCParser.lib;LLVMObject.lib;LLVMScalarOpts.lib;LLVMSelectionDAG.lib;LLVMSupport.lib;LLVMTarget.lib;LLVMTransformUtils.lib;LLVMX86ASMPrinter.lib;LLVMX86ASMParser.lib;LLVMX86Utils.lib;LLVMX86CodeGen.lib;LLVMX86Desc.lib;LLVMX86Disassembler.lib;LLVMX86Info.lib;LLVMipa.lib;LLVMipo.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
|||||||
139
run_tests.py
139
run_tests.py
@@ -55,10 +55,12 @@ parser.add_option('--wrap-exe', dest='wrapexe',
|
|||||||
|
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
|
# use relative path to not depend on host directory, which may possibly
|
||||||
|
# have white spaces and unicode characters.
|
||||||
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"
|
||||||
|
|
||||||
# checks the required ispc compiler otherwise prints an error message
|
# checks the required ispc compiler otherwise prints an error message
|
||||||
if not os.path.exists(ispc_exe):
|
if not os.path.exists(ispc_exe):
|
||||||
@@ -67,7 +69,8 @@ if not os.path.exists(ispc_exe):
|
|||||||
|
|
||||||
ispc_exe += " " + options.ispc_flags
|
ispc_exe += " " + options.ispc_flags
|
||||||
|
|
||||||
print ispc_exe
|
if __name__ == '__main__':
|
||||||
|
sys.stdout.write("ispc compiler: %s\n" % ispc_exe)
|
||||||
|
|
||||||
is_generic_target = (options.target.find("generic-") != -1 and
|
is_generic_target = (options.target.find("generic-") != -1 and
|
||||||
options.target != "generic-1")
|
options.target != "generic-1")
|
||||||
@@ -90,7 +93,7 @@ if is_generic_target and options.include_file == None:
|
|||||||
|
|
||||||
if options.compiler_exe == None:
|
if options.compiler_exe == None:
|
||||||
if is_windows:
|
if is_windows:
|
||||||
options.compiler_exe = "cl"
|
options.compiler_exe = "cl.exe"
|
||||||
else:
|
else:
|
||||||
options.compiler_exe = "g++"
|
options.compiler_exe = "g++"
|
||||||
|
|
||||||
@@ -99,34 +102,29 @@ PATH_dir = string.split(os.getenv("PATH"), os.pathsep)
|
|||||||
compiler_exists = False
|
compiler_exists = False
|
||||||
|
|
||||||
for counter in PATH_dir:
|
for counter in PATH_dir:
|
||||||
if os.path.exists(counter + os.sep + options.compiler_exe):
|
if os.path.exists(counter + os.sep + options.compiler_exe):
|
||||||
compiler_exists = True
|
compiler_exists = True
|
||||||
break
|
break
|
||||||
|
|
||||||
if not compiler_exists:
|
if not compiler_exists:
|
||||||
sys.stderr.write("Fatal error: missing the required compiler: %s \n" %
|
sys.stderr.write("Fatal error: missing the required compiler: %s \n" %
|
||||||
options.compiler_exe)
|
options.compiler_exe)
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
def fix_windows_paths(files):
|
|
||||||
ret = [ ]
|
|
||||||
for fn in files:
|
|
||||||
ret += [ string.replace(fn, '\\', '/') ]
|
|
||||||
return ret
|
|
||||||
|
|
||||||
|
ispc_root = "."
|
||||||
|
|
||||||
# if no specific test files are specified, run all of the tests in tests/,
|
# if no specific test files are specified, run all of the tests in tests/,
|
||||||
# failing_tests/, and tests_errors/
|
# failing_tests/, and tests_errors/
|
||||||
if len(args) == 0:
|
if len(args) == 0:
|
||||||
files = glob.glob("tests/*ispc") + glob.glob("failing_tests/*ispc") + \
|
files = glob.glob(ispc_root + os.sep + "tests" + os.sep + "*ispc") + \
|
||||||
glob.glob("tests_errors/*ispc")
|
glob.glob(ispc_root + os.sep + "failing_tests" + os.sep + "*ispc") + \
|
||||||
files = fix_windows_paths(files)
|
glob.glob(ispc_root + os.sep + "tests_errors" + os.sep + "*ispc")
|
||||||
else:
|
else:
|
||||||
if is_windows:
|
if is_windows:
|
||||||
argfiles = [ ]
|
argfiles = [ ]
|
||||||
for f in args:
|
for f in args:
|
||||||
# we have to glob ourselves if this is being run under a DOS
|
# we have to glob ourselves if this is being run under a DOS
|
||||||
# shell..
|
# shell, as it passes wildcard as is.
|
||||||
argfiles += glob.glob(f)
|
argfiles += glob.glob(f)
|
||||||
else:
|
else:
|
||||||
argfiles = args
|
argfiles = args
|
||||||
@@ -138,6 +136,13 @@ else:
|
|||||||
else:
|
else:
|
||||||
files += [ f ]
|
files += [ f ]
|
||||||
|
|
||||||
|
# max_test_length is used to issue exact number of whitespace characters when
|
||||||
|
# updating status. Otherwise update causes new lines standard 80 char terminal
|
||||||
|
# on both Linux and Windows.
|
||||||
|
max_test_length = 0
|
||||||
|
for f in files:
|
||||||
|
max_test_length = max(max_test_length, len(f))
|
||||||
|
|
||||||
# randomly shuffle the tests if asked to do so
|
# randomly shuffle the tests if asked to do so
|
||||||
if (options.random):
|
if (options.random):
|
||||||
random.seed()
|
random.seed()
|
||||||
@@ -146,17 +151,15 @@ if (options.random):
|
|||||||
# counter
|
# counter
|
||||||
total_tests = 0
|
total_tests = 0
|
||||||
|
|
||||||
finished_tests_counter = multiprocessing.Value(c_int)
|
|
||||||
finished_tests_counter_lock = multiprocessing.Lock()
|
|
||||||
|
|
||||||
# utility routine to print an update on the number of tests that have been
|
# utility routine to print an update on the number of tests that have been
|
||||||
# finished. Should be called with the lock held..
|
# finished. Should be called with the lock held..
|
||||||
def update_progress(fn):
|
def update_progress(fn, total_tests_arg, counter, max_test_length_arg):
|
||||||
global total_tests
|
counter.value += 1
|
||||||
finished_tests_counter.value = finished_tests_counter.value + 1
|
progress_str = " Done %d / %d [%s]" % (counter.value, total_tests_arg, fn)
|
||||||
progress_str = " Done %d / %d [%s]" % (finished_tests_counter.value, total_tests, fn)
|
|
||||||
# spaces to clear out detrius from previous printing...
|
# spaces to clear out detrius from previous printing...
|
||||||
for x in range(30):
|
spaces_needed = max_test_length_arg - len(fn)
|
||||||
|
for x in range(spaces_needed):
|
||||||
progress_str += ' '
|
progress_str += ' '
|
||||||
progress_str += '\r'
|
progress_str += '\r'
|
||||||
sys.stdout.write(progress_str)
|
sys.stdout.write(progress_str)
|
||||||
@@ -165,7 +168,18 @@ def update_progress(fn):
|
|||||||
def run_command(cmd):
|
def run_command(cmd):
|
||||||
if options.verbose:
|
if options.verbose:
|
||||||
sys.stdout.write("Running: %s\n" % cmd)
|
sys.stdout.write("Running: %s\n" % cmd)
|
||||||
sp = subprocess.Popen(shlex.split(cmd), stdin=None,
|
|
||||||
|
# Here's a bit tricky part. To pass a command for execution we should
|
||||||
|
# break down the line in to arguments. shlex class is designed exactly
|
||||||
|
# for this purpose, but by default it interprets escape sequences.
|
||||||
|
# On Windows backslaches are all over the place and they are treates as
|
||||||
|
# ESC-sequences, so we have to set manually to not interpret them.
|
||||||
|
lexer = shlex.shlex(cmd, posix=True)
|
||||||
|
lexer.whitespace_split = True
|
||||||
|
lexer.escape = ''
|
||||||
|
arg_list = list(lexer)
|
||||||
|
|
||||||
|
sp = subprocess.Popen(arg_list, stdin=None,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE)
|
stderr=subprocess.PIPE)
|
||||||
out = sp.communicate()
|
out = sp.communicate()
|
||||||
@@ -203,23 +217,30 @@ def run_cmds(compile_cmds, run_cmd, filename, expect_failure):
|
|||||||
return (0, 0)
|
return (0, 0)
|
||||||
|
|
||||||
|
|
||||||
def run_test(filename):
|
def run_test(testname):
|
||||||
global is_windows
|
global is_windows
|
||||||
if is_windows:
|
if is_windows:
|
||||||
input_prefix = "../"
|
# On Windows we run tests in tmp dir, so the root is one level up.
|
||||||
|
input_prefix = "..\\"
|
||||||
else:
|
else:
|
||||||
input_prefix = ""
|
input_prefix = ""
|
||||||
|
|
||||||
|
# testname is a path to the test from the root of ispc dir
|
||||||
|
# filename is a path to the test from the current dir
|
||||||
|
# ispc_exe_rel is a relative path to ispc
|
||||||
|
filename = os.path.normpath(input_prefix + testname)
|
||||||
|
ispc_exe_rel = os.path.normpath(input_prefix + ispc_exe)
|
||||||
|
|
||||||
# is this a test to make sure an error is issued?
|
# is this a test to make sure an error is issued?
|
||||||
want_error = (filename.find("tests_errors") != -1)
|
want_error = (filename.find("tests_errors") != -1)
|
||||||
if want_error == True:
|
if want_error == True:
|
||||||
ispc_cmd = ispc_exe + " --werror --nowrap %s --arch=%s --target=%s" % \
|
ispc_cmd = ispc_exe_rel + " --werror --nowrap %s --arch=%s --target=%s" % \
|
||||||
(input_prefix + filename, options.arch, options.target)
|
(filename, options.arch, options.target)
|
||||||
(return_code, output) = run_command(ispc_cmd)
|
(return_code, output) = run_command(ispc_cmd)
|
||||||
got_error = (return_code != 0)
|
got_error = (return_code != 0)
|
||||||
|
|
||||||
# figure out the error message we're expecting
|
# figure out the error message we're expecting
|
||||||
file = open(input_prefix + filename, 'r')
|
file = open(filename, 'r')
|
||||||
firstline = file.readline()
|
firstline = file.readline()
|
||||||
firstline = firstline.replace("//", "")
|
firstline = firstline.replace("//", "")
|
||||||
firstline = firstline.lstrip()
|
firstline = firstline.lstrip()
|
||||||
@@ -228,22 +249,22 @@ def run_test(filename):
|
|||||||
|
|
||||||
if (output.find(firstline) == -1):
|
if (output.find(firstline) == -1):
|
||||||
sys.stderr.write("Didn't see expected error message %s from test %s.\nActual output:\n%s\n" % \
|
sys.stderr.write("Didn't see expected error message %s from test %s.\nActual output:\n%s\n" % \
|
||||||
(firstline, filename, output))
|
(firstline, testname, output))
|
||||||
return (1, 0)
|
return (1, 0)
|
||||||
elif got_error == False:
|
elif got_error == False:
|
||||||
sys.stderr.write("Unexpectedly no errors issued from test %s\n" % filename)
|
sys.stderr.write("Unexpectedly no errors issued from test %s\n" % testname)
|
||||||
return (1, 0)
|
return (1, 0)
|
||||||
else:
|
else:
|
||||||
return (0, 0)
|
return (0, 0)
|
||||||
else:
|
else:
|
||||||
# do we expect this test to fail?
|
# do we expect this test to fail?
|
||||||
should_fail = (filename.find("failing_") != -1)
|
should_fail = (testname.find("failing_") != -1)
|
||||||
|
|
||||||
# We need to figure out the signature of the test
|
# We need to figure out the signature of the test
|
||||||
# function that this test has.
|
# function that this test has.
|
||||||
sig2def = { "f_v(" : 0, "f_f(" : 1, "f_fu(" : 2, "f_fi(" : 3,
|
sig2def = { "f_v(" : 0, "f_f(" : 1, "f_fu(" : 2, "f_fi(" : 3,
|
||||||
"f_du(" : 4, "f_duf(" : 5, "f_di(" : 6 }
|
"f_du(" : 4, "f_duf(" : 5, "f_di(" : 6 }
|
||||||
file = open(input_prefix + filename, 'r')
|
file = open(filename, 'r')
|
||||||
match = -1
|
match = -1
|
||||||
for line in file:
|
for line in file:
|
||||||
# look for lines with 'export'...
|
# look for lines with 'export'...
|
||||||
@@ -258,26 +279,27 @@ def run_test(filename):
|
|||||||
file.close()
|
file.close()
|
||||||
if match == -1:
|
if match == -1:
|
||||||
sys.stderr.write("Fatal error: unable to find function signature " + \
|
sys.stderr.write("Fatal error: unable to find function signature " + \
|
||||||
"in test %s\n" % filename)
|
"in test %s\n" % testname)
|
||||||
return (1, 0)
|
return (1, 0)
|
||||||
else:
|
else:
|
||||||
global is_generic_target
|
global is_generic_target
|
||||||
if is_generic_target:
|
|
||||||
obj_name = "%s.cpp" % filename
|
|
||||||
|
|
||||||
if is_windows:
|
if is_windows:
|
||||||
if not is_generic_target:
|
if is_generic_target:
|
||||||
obj_name = "%s%s.obj" % (input_prefix, filename)
|
obj_name = "%s.cpp" % os.path.basename(filename)
|
||||||
exe_name = "%s%s.exe" % (input_prefix, filename)
|
else:
|
||||||
|
obj_name = "%s.obj" % os.path.basename(filename)
|
||||||
|
exe_name = "%s.exe" % os.path.basename(filename)
|
||||||
|
|
||||||
cc_cmd = "%s /I. /I../winstuff /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"
|
||||||
else:
|
else:
|
||||||
if not is_generic_target:
|
if is_generic_target:
|
||||||
obj_name = "%s.o" % filename
|
obj_name = "%s.cpp" % testname
|
||||||
exe_name = "%s.run" % filename
|
else:
|
||||||
|
obj_name = "%s.o" % testname
|
||||||
|
exe_name = "%s.run" % testname
|
||||||
|
|
||||||
if options.arch == 'x86':
|
if options.arch == 'x86':
|
||||||
gcc_arch = '-m32'
|
gcc_arch = '-m32'
|
||||||
@@ -300,25 +322,25 @@ def run_test(filename):
|
|||||||
if should_fail:
|
if should_fail:
|
||||||
cc_cmd += " -DEXPECT_FAILURE"
|
cc_cmd += " -DEXPECT_FAILURE"
|
||||||
|
|
||||||
ispc_cmd = ispc_exe + " --woff %s -o %s --arch=%s --target=%s" % \
|
ispc_cmd = ispc_exe_rel + " --woff %s -o %s --arch=%s --target=%s" % \
|
||||||
(input_prefix+filename, obj_name, options.arch, options.target)
|
(filename, obj_name, options.arch, options.target)
|
||||||
if options.no_opt:
|
if options.no_opt:
|
||||||
ispc_cmd += " -O0"
|
ispc_cmd += " -O0"
|
||||||
if is_generic_target:
|
if is_generic_target:
|
||||||
ispc_cmd += " --emit-c++ --c++-include-file=%s" % options.include_file
|
ispc_cmd += " --emit-c++ --c++-include-file=%s" % os.path.normpath(input_prefix + options.include_file)
|
||||||
|
|
||||||
# compile the ispc code, make the executable, and run it...
|
# compile the ispc code, make the executable, and run it...
|
||||||
(compile_error, run_error) = run_cmds([ispc_cmd, cc_cmd],
|
(compile_error, run_error) = run_cmds([ispc_cmd, cc_cmd],
|
||||||
options.wrapexe + " " + exe_name, \
|
options.wrapexe + " " + exe_name, \
|
||||||
filename, should_fail)
|
testname, should_fail)
|
||||||
|
|
||||||
# clean up after running the test
|
# clean up after running the test
|
||||||
try:
|
try:
|
||||||
if not run_error:
|
if not run_error:
|
||||||
os.unlink(exe_name)
|
os.unlink(exe_name)
|
||||||
if is_windows:
|
if is_windows:
|
||||||
os.unlink("%s%s.pdb" % (input_prefix, filename))
|
os.unlink("%s.pdb" % filename)
|
||||||
os.unlink("%s%s.ilk" % (input_prefix, filename))
|
os.unlink("%s.ilk" % filename)
|
||||||
os.unlink(obj_name)
|
os.unlink(obj_name)
|
||||||
except:
|
except:
|
||||||
None
|
None
|
||||||
@@ -328,7 +350,7 @@ def run_test(filename):
|
|||||||
# pull tests to run from the given queue and run them. Multiple copies of
|
# pull tests to run from the given queue and run them. Multiple copies of
|
||||||
# this function will be running in parallel across all of the CPU cores of
|
# this function will be running in parallel across all of the CPU cores of
|
||||||
# the system.
|
# the system.
|
||||||
def run_tasks_from_queue(queue, queue_ret):
|
def run_tasks_from_queue(queue, queue_ret, total_tests_arg, max_test_length_arg, counter, mutex):
|
||||||
if is_windows:
|
if is_windows:
|
||||||
tmpdir = "tmp%d" % os.getpid()
|
tmpdir = "tmp%d" % os.getpid()
|
||||||
os.mkdir(tmpdir)
|
os.mkdir(tmpdir)
|
||||||
@@ -359,8 +381,8 @@ def run_tasks_from_queue(queue, queue_ret):
|
|||||||
if run_error != 0:
|
if run_error != 0:
|
||||||
run_error_files += [ filename ]
|
run_error_files += [ filename ]
|
||||||
|
|
||||||
with finished_tests_counter_lock:
|
with mutex:
|
||||||
update_progress(filename)
|
update_progress(filename, total_tests_arg, counter, max_test_length_arg)
|
||||||
|
|
||||||
task_threads = []
|
task_threads = []
|
||||||
|
|
||||||
@@ -381,8 +403,6 @@ if __name__ == '__main__':
|
|||||||
# 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')
|
||||||
@@ -392,9 +412,12 @@ if __name__ == '__main__':
|
|||||||
# we're interrupted
|
# we're interrupted
|
||||||
signal.signal(signal.SIGINT, sigint)
|
signal.signal(signal.SIGINT, sigint)
|
||||||
|
|
||||||
|
finished_tests_counter = multiprocessing.Value(c_int)
|
||||||
|
finished_tests_counter_lock = multiprocessing.Lock()
|
||||||
|
|
||||||
# launch jobs to run tests
|
# launch jobs to run tests
|
||||||
for x in range(nthreads):
|
for x in range(nthreads):
|
||||||
t = multiprocessing.Process(target=run_tasks_from_queue, args=(q,qret))
|
t = multiprocessing.Process(target=run_tasks_from_queue, args=(q, qret, total_tests, max_test_length, finished_tests_counter, finished_tests_counter_lock))
|
||||||
task_threads.append(t)
|
task_threads.append(t)
|
||||||
t.start()
|
t.start()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user