aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-03-03 03:51:25 +0000
committerDavid Robillard <d@drobilla.net>2013-03-03 03:51:25 +0000
commita3fa7ea027b30a2f437d3282a3726ed2bc988770 (patch)
tree8b7281425649950579ac53c1cb75b19efc90cc1f
parent2f9844a98712944866d94fff5d26f7f3b8c5f698 (diff)
downloadserd-a3fa7ea027b30a2f437d3282a3726ed2bc988770.tar.gz
serd-a3fa7ea027b30a2f437d3282a3726ed2bc988770.tar.bz2
serd-a3fa7ea027b30a2f437d3282a3726ed2bc988770.zip
Abstract out thru test running.
git-svn-id: http://svn.drobilla.net/serd/trunk@426 490d8e77-9747-427b-9fa3-0b8f29cee8a0
-rw-r--r--wscript49
1 files changed, 28 insertions, 21 deletions
diff --git a/wscript b/wscript
index b4d908ed..a53c62a6 100644
--- a/wscript
+++ b/wscript
@@ -282,6 +282,31 @@ def earl_assertion(test, passed, asserter):
"earl:passed" if passed else "earl:failed",
datetime.datetime.now().replace(microsecond=0).isoformat())
+def test_thru(ctx, base, path, flags):
+ in_filename = os.path.join(ctx.path.abspath(), path)
+ out_filename = path + '.thru'
+ check_filename = in_filename.replace('.ttl', '.nt')
+
+ command = ('%s %s -i ntriples -o turtle -p foo "%s" "%s"'
+ '| %s -i turtle -o ntriples -c foo - "%s" > %s') % (
+ 'serdi_static', flags.ljust(5),
+ in_filename, base,
+ 'serdi_static', base, out_filename)
+
+ passed = autowaf.run_test(ctx, APPNAME, command, 0, name=out_filename)
+ if not passed:
+ return False
+
+ if not os.access(out_filename, os.F_OK):
+ Logs.pprint('RED', 'FAIL: %s is missing' % out_filename)
+ elif not file_equals(check_filename, out_filename, '_:docid', '_:genid'):
+ Logs.pprint('RED', 'FAIL: %s != %s' % (out_filename, check_filename))
+ else:
+ Logs.pprint('GREEN', '** Pass %s == %s' % (out_filename, check_filename))
+ return True
+
+ return False
+
def test_manifest(ctx, srcdir, testdir, report, test_base, parse_base):
import rdflib
import urlparse
@@ -473,27 +498,9 @@ def test(ctx):
flags += ' -r http://www.w3.org/'
if (num % 7 == 0):
flags += ' -e'
- out_filename = os.path.join('tests', tdir, test + '.thru')
- commands += [
- ('%s %s -i ntriples -o turtle -p foo "%s" "%s"'
- '| %s -i turtle -o ntriples -c foo - "%s" > %s') % (
- 'serdi_static', flags.ljust(5),
- os.path.join(srcdir, 'tests', tdir, test), test_base(test),
- 'serdi_static', test_base(test), out_filename) ]
-
- autowaf.run_tests(ctx, APPNAME, commands, 0, name='turtle-round-trip')
- Logs.pprint('BOLD', '\nVerifying ntriples => turtle => ntriples')
- for test in thru_tests:
- path = os.path.join('tests', tdir, test)
- out_filename = path + '.thru'
- if not os.access(out_filename, os.F_OK):
- Logs.pprint('RED', 'FAIL: %s output is missing' % test)
- elif not file_equals(os.path.join(srcdir, path).replace('.ttl', '.nt'),
- path + '.thru',
- '_:docid', '_:genid'):
- Logs.pprint('RED', 'FAIL: %s is incorrect' % out_filename)
- else:
- Logs.pprint('GREEN', 'Pass: %s' % test)
+
+ path = os.path.join('tests', tdir, test)
+ test_thru(ctx, test_base(test), path, flags)
try:
report = open('earl.ttl', 'w')