From 2f993d40296ef007fa313756a721e48890f3df89 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 3 Mar 2013 04:05:25 +0000 Subject: Simplify manifest-based test running. git-svn-id: http://svn.drobilla.net/serd/trunk@427 490d8e77-9747-427b-9fa3-0b8f29cee8a0 --- wscript | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/wscript b/wscript index a53c62a6..16588640 100644 --- a/wscript +++ b/wscript @@ -325,18 +325,20 @@ def test_manifest(ctx, srcdir, testdir, report, test_base, parse_base): is_drobilla = (os.getenv('USER') == 'drobilla') asserter = 'http://drobilla.net/drobilla#me' if is_drobilla else '' + def run_test(action_node, expected_return): + output = os.path.join('tests', testdir, action_node + '.out') + action = os.path.join(srcdir, 'tests', testdir, action_node) + rel = os.path.relpath(action, os.path.join(srcdir, 'tests', testdir)) + command = 'serdi_static -f "%s" "%s" > %s' % (action, parse_base + rel, output) + + return autowaf.run_test(ctx, APPNAME, command, expected_return, name=name) + for i in sorted(model.triples([None, rdf.type, rdft.TestTurtlePositiveSyntax])): test = i[0] name = model.value(test, mf.name, None) action_node = model.value(test, mf.action, None)[len(test_base):] - output = os.path.join('tests', testdir, action_node + '.out') - action = os.path.join(srcdir, 'tests', testdir, action_node) - - rel = os.path.relpath(action, os.path.join(srcdir, 'tests', testdir)) - command = 'serdi_static -f "%s" "%s" > %s' % (action, parse_base + rel, output) - passed = autowaf.run_test(ctx, APPNAME, command, 0, name=name) - + passed = run_test(action_node, 0) report.write(earl_assertion(test, passed, asserter)) for i in sorted(model.triples([None, rdf.type, rdft.TestTurtleNegativeSyntax])): @@ -344,13 +346,7 @@ def test_manifest(ctx, srcdir, testdir, report, test_base, parse_base): name = model.value(test, mf.name, None) action_node = model.value(test, mf.action, None)[len(test_base):] - output = os.path.join('tests', testdir, action_node + '.out') - action = os.path.join(srcdir, 'tests', testdir, action_node) - - rel = os.path.relpath(action, os.path.join(srcdir, 'tests', testdir)) - command = 'serdi_static -f "%s" "%s" > %s' % (action, parse_base + rel, output) - passed = autowaf.run_test(ctx, APPNAME, command, 1, name=name) - + passed = run_test(action_node, 1) report.write(earl_assertion(test, passed, asserter)) for i in sorted(model.triples([None, rdf.type, rdft.TestTurtleEval])): @@ -359,14 +355,11 @@ def test_manifest(ctx, srcdir, testdir, report, test_base, parse_base): action_node = model.value(test, mf.action, None)[len(test_base):] result_node = model.value(test, mf.result, None)[len(test_base):] - output = os.path.join('tests', testdir, action_node + '.out') - action = os.path.join(srcdir, 'tests', testdir, action_node) - result = os.path.join(srcdir, 'tests', testdir, result_node) + passed = run_test(action_node, 0) - rel = os.path.relpath(action, os.path.join(srcdir, 'tests', testdir)) - command = 'serdi_static -f "%s" "%s" > %s' % (action, parse_base + rel, output) - passed = autowaf.run_test(ctx, APPNAME, command, 0, name=name) if passed: + output = os.path.join('tests', testdir, action_node + '.out') + result = os.path.join(srcdir, 'tests', testdir, result_node) if not os.access(output, os.F_OK): passed = False Logs.pprint('RED', 'FAIL: %s output %s is missing' % (name, output)) -- cgit v1.2.1