Merge pull request #811 from ncos/master
Some minor fixes in alloy.py and exception handling in run_tests.py
This commit is contained in:
18
alloy.py
18
alloy.py
@@ -84,6 +84,10 @@ def build_LLVM(version_LLVM, revision, folder, tarball, debug, selfbuild, extra,
|
|||||||
# Here we understand what and where do we want to build
|
# Here we understand what and where do we want to build
|
||||||
current_path = os.getcwd()
|
current_path = os.getcwd()
|
||||||
llvm_home = os.environ["LLVM_HOME"]
|
llvm_home = os.environ["LLVM_HOME"]
|
||||||
|
|
||||||
|
|
||||||
|
make_sure_dir_exists(llvm_home)
|
||||||
|
|
||||||
os.chdir(llvm_home)
|
os.chdir(llvm_home)
|
||||||
FOLDER_NAME=version_LLVM
|
FOLDER_NAME=version_LLVM
|
||||||
if version_LLVM == "trunk":
|
if version_LLVM == "trunk":
|
||||||
@@ -469,7 +473,10 @@ def validation_run(only, only_targets, reference_branch, number, notify, update,
|
|||||||
for i2 in range(0,len(opts)):
|
for i2 in range(0,len(opts)):
|
||||||
stability.arch = arch[i1]
|
stability.arch = arch[i1]
|
||||||
stability.no_opt = opts[i2]
|
stability.no_opt = opts[i2]
|
||||||
execute_stability(stability, R, print_version)
|
try:
|
||||||
|
execute_stability(stability, R, print_version)
|
||||||
|
except:
|
||||||
|
print_debug("Exception in execute_stability - maybe some test subprocess terminated before it should have\n", False, stability_log)
|
||||||
print_version = 0
|
print_version = 0
|
||||||
for j in range(0,len(sde_targets)):
|
for j in range(0,len(sde_targets)):
|
||||||
stability.target = sde_targets[j][1]
|
stability.target = sde_targets[j][1]
|
||||||
@@ -576,6 +583,8 @@ def validation_run(only, only_targets, reference_branch, number, notify, update,
|
|||||||
f_lines = fp.readlines()
|
f_lines = fp.readlines()
|
||||||
fp.close()
|
fp.close()
|
||||||
line = ""
|
line = ""
|
||||||
|
if not sys.exc_info()[0] == None:
|
||||||
|
line = line + "Last exception: " + str(sys.exc_info()) + '\n'
|
||||||
for i in range(0,len(f_lines)):
|
for i in range(0,len(f_lines)):
|
||||||
line = line + f_lines[i][:-1]
|
line = line + f_lines[i][:-1]
|
||||||
line = line + ' \n'
|
line = line + ' \n'
|
||||||
@@ -583,7 +592,7 @@ def validation_run(only, only_targets, reference_branch, number, notify, update,
|
|||||||
msg.attach(text)
|
msg.attach(text)
|
||||||
attach_mail_file(msg, alloy_build, "alloy_build.log")
|
attach_mail_file(msg, alloy_build, "alloy_build.log")
|
||||||
s = smtplib.SMTP(smtp_server)
|
s = smtplib.SMTP(smtp_server)
|
||||||
s.sendmail('ISPC_test_system', options.notify, msg.as_string())
|
s.sendmail('ISPC_test_system', options.notify.split(" "), msg.as_string())
|
||||||
s.quit()
|
s.quit()
|
||||||
|
|
||||||
def Main():
|
def Main():
|
||||||
@@ -630,7 +639,8 @@ def Main():
|
|||||||
current_path = os.getcwd()
|
current_path = os.getcwd()
|
||||||
make = "make -j" + options.speed
|
make = "make -j" + options.speed
|
||||||
if os.environ["ISPC_HOME"] != os.getcwd():
|
if os.environ["ISPC_HOME"] != os.getcwd():
|
||||||
error("you ISPC_HOME and your current path are different!\n", 2)
|
error("you ISPC_HOME and your current path are different! (" + os.environ["ISPC_HOME"] + " is not equal to " + os.getcwd() +
|
||||||
|
")\n", 2)
|
||||||
if options.perf_llvm == True:
|
if options.perf_llvm == True:
|
||||||
if options.branch == "master":
|
if options.branch == "master":
|
||||||
options.branch = "trunk"
|
options.branch = "trunk"
|
||||||
@@ -659,6 +669,7 @@ from optparse import OptionParser
|
|||||||
from optparse import OptionGroup
|
from optparse import OptionGroup
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
import errno
|
||||||
import operator
|
import operator
|
||||||
import time
|
import time
|
||||||
import glob
|
import glob
|
||||||
@@ -679,6 +690,7 @@ import common
|
|||||||
error = common.error
|
error = common.error
|
||||||
take_lines = common.take_lines
|
take_lines = common.take_lines
|
||||||
print_debug = common.print_debug
|
print_debug = common.print_debug
|
||||||
|
make_sure_dir_exists = common.make_sure_dir_exists
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# parsing options
|
# parsing options
|
||||||
class MyParser(OptionParser):
|
class MyParser(OptionParser):
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
# // Author: Filippov Ilia
|
# // Author: Filippov Ilia
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
import errno
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
def write_to_file(filename, line):
|
def write_to_file(filename, line):
|
||||||
@@ -49,6 +50,14 @@ def remove_if_exists(filename):
|
|||||||
else:
|
else:
|
||||||
os.remove(filename)
|
os.remove(filename)
|
||||||
|
|
||||||
|
def make_sure_dir_exists(path):
|
||||||
|
try:
|
||||||
|
os.makedirs(path)
|
||||||
|
except OSError as exception:
|
||||||
|
if exception.errno != errno.EEXIST:
|
||||||
|
raise
|
||||||
|
|
||||||
|
|
||||||
# detect version which is printed after command
|
# detect version which is printed after command
|
||||||
def take_lines(command, which):
|
def take_lines(command, which):
|
||||||
os.system(command + " > " + "temp_detect_version")
|
os.system(command + " > " + "temp_detect_version")
|
||||||
|
|||||||
24
run_tests.py
24
run_tests.py
@@ -59,10 +59,15 @@ def run_command(cmd):
|
|||||||
lexer.whitespace_split = True
|
lexer.whitespace_split = True
|
||||||
lexer.escape = ''
|
lexer.escape = ''
|
||||||
arg_list = list(lexer)
|
arg_list = list(lexer)
|
||||||
|
|
||||||
sp = subprocess.Popen(arg_list, stdin=None,
|
try:
|
||||||
|
sp = subprocess.Popen(arg_list, stdin=None,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE)
|
stderr=subprocess.PIPE)
|
||||||
|
except:
|
||||||
|
print_debug("ERROR: The child (%s) raised an esception: %s\n" % (cmd, sys.exc_info()[1]), s, run_tests_log)
|
||||||
|
raise
|
||||||
|
|
||||||
out = sp.communicate()
|
out = sp.communicate()
|
||||||
output = ""
|
output = ""
|
||||||
output += out[0].decode("utf-8")
|
output += out[0].decode("utf-8")
|
||||||
@@ -325,7 +330,11 @@ def run_tasks_from_queue(queue, queue_ret, queue_skip, total_tests_arg, max_test
|
|||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
if check_test(filename):
|
if check_test(filename):
|
||||||
(compile_error, run_error) = run_test(filename)
|
try:
|
||||||
|
(compile_error, run_error) = run_test(filename)
|
||||||
|
except:
|
||||||
|
sys.exit(-1) # This is in case the child has unexpectedly died
|
||||||
|
|
||||||
if compile_error != 0:
|
if compile_error != 0:
|
||||||
compile_error_files += [ filename ]
|
compile_error_files += [ filename ]
|
||||||
if run_error != 0:
|
if run_error != 0:
|
||||||
@@ -646,8 +655,9 @@ def run_tests(options1, args, print_version):
|
|||||||
task_threads = [0] * nthreads
|
task_threads = [0] * nthreads
|
||||||
for x in range(nthreads):
|
for x in range(nthreads):
|
||||||
task_threads[x] = multiprocessing.Process(target=run_tasks_from_queue, args=(q, qret, qskip, total_tests,
|
task_threads[x] = multiprocessing.Process(target=run_tasks_from_queue, args=(q, qret, qskip, total_tests,
|
||||||
max_test_length, finished_tests_counter, finished_tests_counter_lock, glob_var))
|
max_test_length, finished_tests_counter, finished_tests_counter_lock, glob_var))
|
||||||
task_threads[x].start()
|
task_threads[x].start()
|
||||||
|
|
||||||
# wait for them to all finish and then return the number that failed
|
# wait for them to all finish and then return the number that failed
|
||||||
# (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:
|
||||||
@@ -655,6 +665,12 @@ def run_tests(options1, args, print_version):
|
|||||||
if options.non_interactive == False:
|
if options.non_interactive == False:
|
||||||
print_debug("\n", s, run_tests_log)
|
print_debug("\n", s, run_tests_log)
|
||||||
|
|
||||||
|
|
||||||
|
for jb in task_threads:
|
||||||
|
if not jb.exitcode == 0:
|
||||||
|
raise OSError(2, 'Some test subprocess has thrown an exception', '')
|
||||||
|
|
||||||
|
|
||||||
temp_time = (time.time() - start_time)
|
temp_time = (time.time() - start_time)
|
||||||
elapsed_time = time.strftime('%Hh%Mm%Ssec.', time.gmtime(temp_time))
|
elapsed_time = time.strftime('%Hh%Mm%Ssec.', time.gmtime(temp_time))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user