2008-05-19 09:37:29 -04:00
|
|
|
#
|
|
|
|
# Python script for running GMP tests
|
|
|
|
#
|
|
|
|
# Run this from the build.vc9\mpir-tests directory
|
2009-02-22 16:03:08 -05:00
|
|
|
|
|
|
|
from __future__ import print_function
|
2008-05-19 09:37:29 -04:00
|
|
|
import os
|
|
|
|
import shutil
|
|
|
|
import string
|
|
|
|
import copy
|
|
|
|
import subprocess
|
2009-02-22 16:03:08 -05:00
|
|
|
import code
|
2008-05-19 09:37:29 -04:00
|
|
|
|
|
|
|
f = open("..\\last_build.txt")
|
|
|
|
l = f.readline()
|
|
|
|
f.close()
|
|
|
|
d = l[ : -2].split('+')
|
2009-02-22 16:03:08 -05:00
|
|
|
print("Testing project", d[0][d[0].find('gmp') : - 1], "in", d[1])
|
2008-05-19 09:37:29 -04:00
|
|
|
|
|
|
|
prj_list = []
|
|
|
|
l = os.listdir(os.getcwd())
|
|
|
|
for f in l :
|
|
|
|
x = os.path.splitext(f)
|
|
|
|
if x[1] == '.vcproj' and x[0] != 'add-test-lib' :
|
|
|
|
prj_list += [x[0]]
|
|
|
|
prj_list.sort()
|
|
|
|
|
|
|
|
exe_list = []
|
|
|
|
try :
|
|
|
|
l = os.listdir(os.getcwd() + '\\' + d[1])
|
|
|
|
except :
|
2009-02-22 16:03:08 -05:00
|
|
|
print("Tests have not been built for this configuration")
|
2008-05-19 09:37:29 -04:00
|
|
|
os._exit(-1)
|
|
|
|
|
|
|
|
for f in l :
|
|
|
|
x = os.path.splitext(f)
|
|
|
|
if x[1] == '.exe' :
|
|
|
|
exe_list += [x[0]]
|
|
|
|
exe_list.sort()
|
|
|
|
if len(exe_list) == 0 :
|
2009-02-22 16:03:08 -05:00
|
|
|
print("No executable test files for this configuration")
|
2008-05-19 09:37:29 -04:00
|
|
|
os._exit(-1)
|
|
|
|
|
|
|
|
build_fail = 0
|
|
|
|
run_ok = 0
|
|
|
|
run_fail = 0
|
|
|
|
for i in prj_list :
|
2008-12-24 03:56:26 -05:00
|
|
|
if i in exe_list :
|
2008-05-19 09:37:29 -04:00
|
|
|
ef = '.\\' + d[1] + '\\' + i + '.exe'
|
2008-12-24 03:56:26 -05:00
|
|
|
prc = subprocess.Popen( ef, stdout = subprocess.PIPE,
|
|
|
|
stderr = subprocess.STDOUT, creationflags = 0x08000000 )
|
2008-05-19 09:37:29 -04:00
|
|
|
output = prc.communicate()[0]
|
2008-12-24 03:56:26 -05:00
|
|
|
if prc.returncode :
|
2009-02-22 16:03:08 -05:00
|
|
|
print(i, ': ERROR (', prc.returncode, ' )')
|
2008-05-19 09:37:29 -04:00
|
|
|
run_fail += 1
|
2008-12-24 03:56:26 -05:00
|
|
|
else :
|
2009-02-22 16:03:08 -05:00
|
|
|
print(i, ': success')
|
2008-12-24 03:56:26 -05:00
|
|
|
run_ok += 1
|
|
|
|
if output :
|
2009-02-22 16:03:08 -05:00
|
|
|
print(output, end='')
|
2008-05-19 09:37:29 -04:00
|
|
|
else :
|
2009-02-22 16:03:08 -05:00
|
|
|
print("Build failure for %s" % i)
|
2008-05-19 09:37:29 -04:00
|
|
|
build_fail += 1
|
2009-02-22 16:03:08 -05:00
|
|
|
print(build_fail + run_ok + run_fail, "tests:")
|
2008-05-19 09:37:29 -04:00
|
|
|
if build_fail > 0 :
|
2009-02-22 16:03:08 -05:00
|
|
|
print("\t%i failed to build" % build_fail)
|
2008-05-19 09:37:29 -04:00
|
|
|
if run_ok > 0 :
|
2009-02-22 16:03:08 -05:00
|
|
|
print("\t%i ran correctly" % run_ok)
|
2008-05-19 09:37:29 -04:00
|
|
|
if run_fail > 0 :
|
2009-02-22 16:03:08 -05:00
|
|
|
print("\t%i failed" % run_fail)
|
2009-02-27 09:24:25 -05:00
|
|
|
raw_input(".. completed - press ENTER")
|