|
|
|
@ -15,13 +15,24 @@ |
|
|
|
|
# limitations under the License. |
|
|
|
|
|
|
|
|
|
import sys, subprocess |
|
|
|
|
from optparse import OptionParser |
|
|
|
|
|
|
|
|
|
def run_tests(datafilename): |
|
|
|
|
parser = OptionParser() |
|
|
|
|
parser.add_option('--wrapper', default=None, dest='wrapper', |
|
|
|
|
help='wrapper to run tests (e.g. valgrind') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def run_tests(options, datafilename): |
|
|
|
|
if options.wrapper is None: |
|
|
|
|
wrap = [] |
|
|
|
|
else: |
|
|
|
|
wrap = [options.wrapper] |
|
|
|
|
for line in open(datafilename, 'r'): |
|
|
|
|
line = line.strip() |
|
|
|
|
if line == '': |
|
|
|
|
continue |
|
|
|
|
p = subprocess.Popen(line, stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
|
|
|
|
cmd = wrap + [line] |
|
|
|
|
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
|
|
|
|
(stdo, stde) = p.communicate() |
|
|
|
|
if p.returncode != 0: |
|
|
|
|
print('Error running test.') |
|
|
|
@ -31,8 +42,9 @@ def run_tests(datafilename): |
|
|
|
|
print('Test "%s": OK' % line) |
|
|
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
|
|
if len(sys.argv) != 2: |
|
|
|
|
print('Test runner for Builder. Do not run on your own, mmm\'kay?') |
|
|
|
|
(options, args) = parser.parse_args(sys.argv) |
|
|
|
|
if len(args) != 2: |
|
|
|
|
print('Test runner for Meson. Do not run on your own, mmm\'kay?') |
|
|
|
|
print('%s [data file]' % sys.argv[0]) |
|
|
|
|
datafile = sys.argv[1] |
|
|
|
|
run_tests(datafile) |
|
|
|
|
datafile = args[1] |
|
|
|
|
run_tests(options, datafile) |
|
|
|
|