Serd subproject with meson
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

167 lines
3.8 KiB

autoship = find_program('autoship', required: false)
run_test_suite = find_program('')
wrapper = meson.get_cross_property('wrapper', '')
unit_tests = [
foreach unit : unit_tests
c_args: prog_args,
dependencies: serd_dep),
suite: 'unit')
if autoship.found()
test('autoship', autoship, args: ['test', serd_src_root], suite: 'data')
if get_option('utils')
if wrapper != ''
script_args = ['--wrapper', wrapper, '--serdi', serdi.full_path()]
script_args = ['--serdi', serdi.full_path()]
serd_ttl = files('../serd.ttl')[0]
test('serd.ttl', serdi, args: [serd_ttl], suite: 'data')
# Command line options
good_args = [
['-s', '<urn:eg:s> a <urn:eg:T> .'],
foreach args : good_args
test(args[0], serdi, args: args, suite: ['serdi', 'options'])
bad_args = [
['-i', 'unknown'],
['-o', 'unknown'],
foreach args : bad_args
name = ' '.join(args)
test(name, serdi,
args: args,
should_fail: true,
suite: ['serdi', 'options'])
test('none', serdi, should_fail: true, suite: ['serdi', 'options'])
test('quiet', files(''),
args: script_args + files('bad/bad-base.ttl'),
suite: ['serdi', 'options'])
# Inputs
test('stdin', files(''),
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: [''],
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(''),
args: script_args + [serd_ttl],
suite: 'io_errors')
# RDF test suites
## Serd-specific test suites
serd_suites = ['good', 'bad', 'lax']
serd_base = ''
### 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)
### 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 = ''
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']
test(syntax, run_test_suite,
args: script_args + args,
suite: ['rdf', 'w3c'],
timeout: 240)