aboutsummaryrefslogtreecommitdiffstats
path: root/wscript
diff options
context:
space:
mode:
Diffstat (limited to 'wscript')
-rw-r--r--wscript57
1 files changed, 49 insertions, 8 deletions
diff --git a/wscript b/wscript
index 4c1bb4e6..9e91dfdb 100644
--- a/wscript
+++ b/wscript
@@ -183,17 +183,22 @@ def build(bld):
# Test programs
for prog in [('serdi_static', 'src/serdi.c'),
+ ('serd_validate_static', 'src/serd_validate.c'),
('serd_test', 'tests/serd_test.c'),
('read_chunk_test', 'tests/read_chunk_test.c'),
('nodes_test', 'tests/nodes_test.c'),
('overflow_test', 'tests/overflow_test.c'),
('model_test', 'tests/model_test.c')]:
- bld(features = 'c cprogram',
- source = prog[1],
- use = 'libserd_profiled',
- target = prog[0],
- defines = defines,
- **test_args)
+ obj = bld(features = 'c cprogram',
+ source = prog[1],
+ use = 'libserd_profiled',
+ target = prog[0],
+ defines = defines,
+ **test_args)
+ if prog[0] == 'serd_validate_static':
+ autowaf.use_lib(bld, obj, 'PCRE')
+ obj.cflags += bld.env.PTHREAD_CFLAGS
+ obj.linkflags += bld.env.PTHREAD_LINKFLAGS
bld(features = 'cxx cxxprogram',
source = 'tests/serd_cxx_test.cpp',
@@ -499,6 +504,27 @@ def test_suite(ctx, base_uri, testdir, report, isyntax, osyntax, options=''):
for i in test_types():
run_tests(i[0], i[1])
+def validation_test_suite(ctx, base_uri, testdir, isyntax, osyntax, options=''):
+ srcdir = ctx.path.abspath()
+ schemas = glob.glob(os.path.join(srcdir, 'schemas', '*.ttl'))
+
+ test_class = 'http://drobilla.net/ns/serd#TestTurtleNegativeValidate'
+ mf = 'http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#'
+ model = load_rdf(os.path.join(srcdir, 'tests', testdir, 'manifest.ttl'))
+ tests = get_resources_with_type(model, test_class)
+
+ with autowaf.begin_tests(ctx, APPNAME, 'validation'):
+ for (num, test) in enumerate(sorted(tests)):
+ action_node = model[test][mf + 'action'][0]
+ name = os.path.basename(action_node)
+ action = os.path.join('../tests', testdir, name)
+ abs_action = os.path.join(srcdir, action)
+ uri = base_uri + os.path.basename(action)
+ command = 'serd_validate_static %s %s' % (
+ ' '.join(schemas), action)
+
+ autowaf.run_test(ctx, APPNAME, command, 2, name=name)
+
def run_test_suites(ctx, opts):
"runs all manifest-driven test suites with the given serdi options"
@@ -578,7 +604,9 @@ def test(ctx):
'serdi_static -v > %s' % nul,
'serdi_static -h > %s' % nul,
'serdi_static -s "<foo> a <#Thingie> ." > %s' % nul,
- 'serdi_static %s > %s' % (nul, nul)
+ 'serdi_static %s > %s' % (nul, nul),
+ 'serd_validate_static -v > %s' % nul,
+ 'serd_validate_static -h > %s' % nul
], 0, name='GoodCommands')
autowaf.run_tests(ctx, APPNAME, [
@@ -596,7 +624,11 @@ def test(ctx):
'serdi_static -i illegal > %s' % nul,
'serdi_static -o illegal > %s' % nul,
'serdi_static -i turtle > %s' % nul,
- 'serdi_static /no/such/file > %s' % nul],
+ 'serdi_static /no/such/file > %s' % nul,
+ 'serd_validate_static > %s' % nul,
+ 'serd_validate_static -k > %s' % nul,
+ 'serd_validate_static -k -1 > %s' % nul,
+ 'serd_validate_static -q > %s' % nul],
1, name='BadCommands')
with autowaf.begin_tests(ctx, APPNAME, 'IoErrors'):
@@ -614,6 +646,15 @@ def test(ctx):
'serdi_static "file://%s/tests/good/manifest.ttl" > /dev/full' % srcdir,
1, name='write_error')
+ # Run serd validation test suite
+ with open('validation_earl.ttl', 'w') as report:
+ serd_base = 'http://drobilla.net/sw/serd/tests/'
+ report.write('@prefix earl: <http://www.w3.org/ns/earl#> .\n'
+ '@prefix dc: <http://purl.org/dc/elements/1.1/> .\n')
+ validation_test_suite(ctx, serd_base + 'validate/', 'validate',
+ None, 'Turtle', 'NTriples')
+
+ # Run data-driven test suites
for opts in ['', '-m']:
run_test_suites(ctx, opts)