Source
94
94
from urllib import request
95
95
import tarfile
96
96
import ssl
97
97
98
98
lib_ext = "dylib" if sys.platform == 'darwin' else 'so'
99
99
build_config_file = "build.json"
100
100
101
101
parser=argparse.ArgumentParser()
102
102
103
103
parser.add_argument('--version', help='version')
104
+
parser.add_argument('--tests', help="Test name prefix(es) to search for. For use with 'test'. Default '--tests=test_'.", default='test_', dest='TESTS')
104
105
parser.add_argument('--debug', help='debug', action='store_true')
105
106
parser.add_argument('--relwithdebinfo', help='Release build with debug and optimization flags', action='store_true')
106
107
parser.add_argument('--stripsyms', help='Strip debug info out of the executable files from --relwithdebinfo. Used with release builds.', action='store_true')
107
108
parser.add_argument('bdist_wheel', help='bdist_wheel')
108
109
109
110
args=parser.parse_args()
111
+
_tests_ = args.TESTS
110
112
_debug_build_ = args.debug
111
113
_rel_with_deb_info_ = args.relwithdebinfo
112
114
_strip_syms_ = args.stripsyms
113
115
print("_debug_build_: " + str(_debug_build_))
114
116
print("_rel_with_deb_info_: " + str(_rel_with_deb_info_))
115
117
print("_strip_syms_: " + str(_strip_syms_))
116
118
117
119
# Remove the "non-standard" arguments from sys.argv so as not to confuse dist_tools
120
+
argv_to_remove = list(filter(lambda x: x.startswith("--tests="), sys.argv))
121
+
for v in argv_to_remove:
122
+
sys.argv.remove(v)
118
123
if "--version" in sys.argv:
119
124
sys.argv.remove("--version")
120
125
if "--debug" in sys.argv:
121
126
sys.argv.remove("--debug")
122
127
if "--relwithdebinfo" in sys.argv:
123
128
sys.argv.remove("--relwithdebinfo")
124
129
if "--stripsyms" in sys.argv:
125
130
sys.argv.remove("--stripsyms")
126
131
127
132
1506
1511
proc = Popen( ["/usr/bin/diff",refpath,samplepath], env=self.__env,
1507
1512
stdout=subprocess.PIPE, stderr=subprocess.PIPE )
1508
1513
(output, error) = pipe_decode(proc.communicate( ))
1509
1514
exit_code = proc.wait( )
1510
1515
print(" ok" if exit_code == 0 else " fail")
1511
1516
(op,ep) = self.__dump_output(os.path.dirname(samplepath),label,output,error)
1512
1517
return (exit_code, label, op, ep)
1513
1518
1514
1519
def __collect_tests(self, testdir):
1515
1520
tests = [ ]
1521
+
prefixes = _tests_.split(",")
1516
1522
for dir, subdirs, files in os.walk(testdir):
1517
1523
for f in files:
1518
-
if f.endswith(".py") and f.startswith("test_"):
1524
+
matching_prefixes = list(filter(lambda x: f.startswith(x), prefixes))
1525
+
if f.endswith(".py") and len(matching_prefixes) > 0:
1519
1526
workingdir = "%s/%s" % (self.__test_dir,f[:-3])
1520
1527
mkpath(workingdir)
1521
1528
tests.append((os.path.abspath("%s/%s" % (dir,f)),workingdir))
1522
1529
return tests
1523
1530
1524
1531
def __collect_regression_files(self, regdir):
1525
1532
regression = { }
1526
1533
for dir, subdirs, files in os.walk(regdir):
1527
1534
for f in files:
1528
1535
if f != "log.txt":