diff options
author | David Robillard <d@drobilla.net> | 2013-03-03 04:05:25 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2013-03-03 04:05:25 +0000 |
commit | 2f993d40296ef007fa313756a721e48890f3df89 (patch) | |
tree | 2c7754ec289661f36f990773ece322a585120b84 | |
parent | a3fa7ea027b30a2f437d3282a3726ed2bc988770 (diff) | |
download | serd-2f993d40296ef007fa313756a721e48890f3df89.tar.gz serd-2f993d40296ef007fa313756a721e48890f3df89.tar.bz2 serd-2f993d40296ef007fa313756a721e48890f3df89.zip |
Simplify manifest-based test running.
git-svn-id: http://svn.drobilla.net/serd/trunk@427 490d8e77-9747-427b-9fa3-0b8f29cee8a0
-rw-r--r-- | wscript | 33 |
1 files changed, 13 insertions, 20 deletions
@@ -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)) |