aboutsummaryrefslogtreecommitdiffstats
path: root/test/meson.build
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-01-09 19:17:31 +0100
committerDavid Robillard <d@drobilla.net>2021-03-07 15:32:23 -0500
commitb9d0b9f058807d7253e88d37822c47b5462b65ea (patch)
tree680357643905465c27857a1f3709ce3518ad7f82 /test/meson.build
parent4c663def32cb6c360ab3d9e2f101c903583d1486 (diff)
downloadserd-b9d0b9f058807d7253e88d37822c47b5462b65ea.tar.gz
serd-b9d0b9f058807d7253e88d37822c47b5462b65ea.tar.bz2
serd-b9d0b9f058807d7253e88d37822c47b5462b65ea.zip
WIP: Switch to Meson
Diffstat (limited to 'test/meson.build')
-rw-r--r--test/meson.build167
1 files changed, 167 insertions, 0 deletions
diff --git a/test/meson.build b/test/meson.build
new file mode 100644
index 00000000..a8c21e78
--- /dev/null
+++ b/test/meson.build
@@ -0,0 +1,167 @@
+autoship = find_program('autoship', required: false)
+run_test_suite = find_program('run_test_suite.py')
+wrapper = meson.get_cross_property('wrapper', '')
+
+unit_tests = [
+ 'env',
+ 'free_null',
+ 'node',
+ 'read_chunk',
+ 'reader_writer',
+ 'string',
+ 'uri',
+]
+
+foreach unit : unit_tests
+ test(unit,
+ executable('test_@0@'.format(unit),
+ 'test_@0@.c'.format(unit),
+ c_args: c_warnings + prog_args,
+ dependencies: serd_dep),
+ suite: 'unit')
+endforeach
+
+if autoship.found()
+ test('autoship', autoship, args: ['test', serd_src_root], suite: 'data')
+endif
+
+if get_option('utils')
+
+ if wrapper != ''
+ script_args = ['--wrapper', wrapper, '--serdi', serdi.full_path()]
+ else
+ script_args = ['--serdi', serdi.full_path()]
+ endif
+
+ serd_ttl = files('../serd.ttl')[0]
+
+ test('serd.ttl', serdi, args: [serd_ttl], suite: 'data')
+
+ # Command line options
+
+ good_args = [
+ ['-v'],
+ ['-h'],
+ ['-s', '<urn:eg:s> a <urn:eg:T> .'],
+ ]
+
+ foreach args : good_args
+ test(args[0], serdi, args: args, suite: ['serdi', 'options'])
+ endforeach
+
+ bad_args = [
+ ['-c'],
+ ['-i', 'unknown'],
+ ['-i'],
+ ['-o', 'unknown'],
+ ['-o'],
+ ['-p'],
+ ['-r'],
+ ['-z'],
+ ]
+
+ foreach args : bad_args
+ name = ' '.join(args)
+ test(name, serdi,
+ args: args,
+ should_fail: true,
+ suite: ['serdi', 'options'])
+ endforeach
+
+ test('none', serdi, should_fail: true, suite: ['serdi', 'options'])
+
+ test('quiet', files('test_quiet.py'),
+ args: script_args + files('bad/bad-base.ttl'),
+ suite: ['serdi', 'options'])
+
+ # Inputs
+
+ test('stdin', files('test_stdin.py'),
+ args: script_args,
+ suite: ['serdi', 'input'])
+
+ test('string', serdi,
+ args: ['-s', '<foo> a <Bar> .'],
+ should_fail: true,
+ suite: ['serdi', 'input'])
+
+ test('missing', serdi,
+ args: ['-i', 'turtle'],
+ should_fail: true,
+ suite: ['serdi', 'input'])
+
+ test('no_such_file', serdi,
+ args: ['no_such_file'],
+ should_fail: true,
+ suite: ['serdi', 'input'])
+
+ test('remote', serdi,
+ args: ['ftp://example.org/unsupported.ttl'],
+ should_fail: true,
+ suite: ['serdi', 'input'])
+
+ # IO errors
+
+ test('read_dir', serdi,
+ args: ['-e', 'file://@0@/'.format(meson.source_root())],
+ should_fail: true,
+ suite: 'io_errors')
+
+ test('bulk_read_dir', serdi,
+ args: ['file://@0@/'.format(meson.source_root())],
+ should_fail: true,
+ suite: 'io_errors')
+
+ test('write_error', files('test_write_error.py'),
+ args: script_args + [serd_ttl],
+ suite: 'io_errors')
+
+ # RDF test suites
+
+ ## Serd-specific test suites
+
+ serd_suites = ['good', 'bad', 'lax']
+ serd_base = 'http://drobilla.net/sw/serd/test/'
+
+ ### Run all suites with no special arguments
+ foreach name : serd_suites
+ manifest = files(name / 'manifest.ttl')
+ base_uri = serd_base + name + '/'
+ test(name, run_test_suite,
+ args: script_args + [manifest, base_uri],
+ suite: ['rdf', 'serd'],
+ timeout: 240)
+ endforeach
+
+
+ ### Run the lax suite with lax parsing enabled as well
+ manifest = files('lax/manifest.ttl')
+ base_uri = serd_base + 'lax/'
+ test('lax', run_test_suite,
+ args: script_args + [manifest, base_uri, '--', '-l'],
+ suite: ['rdf', 'serd'],
+ timeout: 240)
+
+ ## Standard W3C test suites
+
+ w3c_suites = ['Turtle', 'NTriples', 'NQuads', 'TriG']
+ w3c_base = 'http://www.w3.org/2013/'
+
+ foreach syntax : w3c_suites
+
+ manifest = files(syntax + 'Tests' / 'manifest.ttl')
+ base_uri = w3c_base + syntax + 'Tests/'
+
+ args = ['--syntax', syntax, manifest, base_uri]
+ if syntax == 'TriG'
+ args += ['--', '-a']
+ endif
+
+ test(syntax, run_test_suite,
+ args: script_args + args,
+ suite: ['rdf', 'w3c'],
+ timeout: 240)
+
+ endforeach
+
+endif