diff options
author | David Robillard <d@drobilla.net> | 2021-08-12 00:54:34 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-01-28 21:57:07 -0500 |
commit | 970dfc33de59a50b24f1e185495282e8b9a63885 (patch) | |
tree | 3f13e342dabe9d4d423be035ec6e75be7f1c7de5 | |
parent | ccf868537987ced29aea0d5c6fb6d45c94ee025a (diff) | |
download | serd-970dfc33de59a50b24f1e185495282e8b9a63885.tar.gz serd-970dfc33de59a50b24f1e185495282e8b9a63885.tar.bz2 serd-970dfc33de59a50b24f1e185495282e8b9a63885.zip |
Split up test suite build definitions
-rw-r--r-- | test/NQuadsTests/meson.build | 14 | ||||
-rw-r--r-- | test/NTriplesTests/meson.build | 14 | ||||
-rw-r--r-- | test/TriGTests/meson.build | 14 | ||||
-rw-r--r-- | test/TurtleTests/meson.build | 14 | ||||
-rw-r--r-- | test/bad/meson.build | 8 | ||||
-rw-r--r-- | test/canon/meson.build | 13 | ||||
-rw-r--r-- | test/good/meson.build | 8 | ||||
-rw-r--r-- | test/lax/meson.build | 27 | ||||
-rw-r--r-- | test/meson.build | 97 | ||||
-rw-r--r-- | test/pattern/meson.build | 14 | ||||
-rwxr-xr-x | test/run_test_suite.py | 14 | ||||
-rw-r--r-- | test/terse/meson.build | 16 |
12 files changed, 166 insertions, 87 deletions
diff --git a/test/NQuadsTests/meson.build b/test/NQuadsTests/meson.build new file mode 100644 index 00000000..4fe84dd5 --- /dev/null +++ b/test/NQuadsTests/meson.build @@ -0,0 +1,14 @@ +base_uri = 'http://www.w3.org/2013/NQuadsTests/' + +args = [ + '--syntax', 'NQuads', + files('manifest.ttl'), + base_uri +] + +test('NQuads', + run_test_suite, + args: script_args + args, + env: test_env, + suite: ['suite', 'w3c'], + timeout: 240) diff --git a/test/NTriplesTests/meson.build b/test/NTriplesTests/meson.build new file mode 100644 index 00000000..cf773c64 --- /dev/null +++ b/test/NTriplesTests/meson.build @@ -0,0 +1,14 @@ +base_uri = 'http://www.w3.org/2013/NTriplesTests/' + +args = [ + '--syntax', 'NTriples', + files('manifest.ttl'), + base_uri +] + +test('NTriples', + run_test_suite, + args: script_args + args, + env: test_env, + suite: ['suite', 'w3c'], + timeout: 240) diff --git a/test/TriGTests/meson.build b/test/TriGTests/meson.build new file mode 100644 index 00000000..e7c305e0 --- /dev/null +++ b/test/TriGTests/meson.build @@ -0,0 +1,14 @@ +base_uri = 'http://www.w3.org/2013/TriGTests/' + +args = [ + '--syntax', 'TriG', + files('manifest.ttl'), + base_uri +] + +test('TriG', + run_test_suite, + args: script_args + args, + env: test_env, + suite: ['suite', 'w3c'], + timeout: 240) diff --git a/test/TurtleTests/meson.build b/test/TurtleTests/meson.build new file mode 100644 index 00000000..492e1fe0 --- /dev/null +++ b/test/TurtleTests/meson.build @@ -0,0 +1,14 @@ +base_uri = 'http://www.w3.org/2013/TurtleTests/' + +args = [ + '--syntax', 'Turtle', + files('manifest.ttl'), + base_uri +] + +test('Turtle', + run_test_suite, + args: script_args + args, + env: test_env, + suite: ['suite', 'w3c'], + timeout: 240) diff --git a/test/bad/meson.build b/test/bad/meson.build new file mode 100644 index 00000000..9c423367 --- /dev/null +++ b/test/bad/meson.build @@ -0,0 +1,8 @@ +base_uri = 'http://drobilla.net/sw/serd/test/bad/' + +test('bad', + run_test_suite, + args: script_args + [files('manifest.ttl'), base_uri], + env: test_env, + suite: ['suite', 'extra'], + timeout: 240) diff --git a/test/canon/meson.build b/test/canon/meson.build new file mode 100644 index 00000000..11d95469 --- /dev/null +++ b/test/canon/meson.build @@ -0,0 +1,13 @@ +base_uri = 'http://drobilla.net/sw/serd/test/canon/' + +test('canon', + run_test_suite, + args: script_args + [ + files('manifest.ttl'), + base_uri, + '--', + '-C', + ], + env: test_env, + suite: ['suite', 'extra'], + timeout: 240) diff --git a/test/good/meson.build b/test/good/meson.build new file mode 100644 index 00000000..38c672ac --- /dev/null +++ b/test/good/meson.build @@ -0,0 +1,8 @@ +base_uri = 'http://drobilla.net/sw/serd/test/good/' + +test('good', + run_test_suite, + args: script_args + [files('manifest.ttl'), base_uri], + env: test_env, + suite: ['suite', 'extra'], + timeout: 240) diff --git a/test/lax/meson.build b/test/lax/meson.build new file mode 100644 index 00000000..6d4d7903 --- /dev/null +++ b/test/lax/meson.build @@ -0,0 +1,27 @@ +base_uri = 'http://drobilla.net/sw/serd/test/lax/' + +# This suite is run twice + +# ... once with strict parsing to test the hard errors +test('lax.strict', + run_test_suite, + args: script_args + [files('manifest.ttl'), base_uri], + env: test_env, + is_parallel: false, + suite: ['suite', 'extra'], + timeout: 240) + +# ... and once with lax parsing to tolerate them +test('lax.lax', + run_test_suite, + args: script_args + [ + files('manifest.ttl'), + base_uri, + '--', + '-i', + 'lax', + ], + env: test_env, + is_parallel: false, + suite: ['suite', 'extra'], + timeout: 240) diff --git a/test/meson.build b/test/meson.build index 95fa9587..c19d99c0 100644 --- a/test/meson.build +++ b/test/meson.build @@ -229,89 +229,18 @@ if is_variable('serdi') should_fail: true, suite: 'io_errors') - # RDF test suites - - ## Serd-specific test suites - - serd_suites = ['good', 'bad'] - serd_base = 'http://drobilla.net/sw/serd/test/' - - ### Run basic 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], - env: test_env, - suite: ['rdf', 'serd'], - timeout: 240) - endforeach - - ### The terse suite needs to be run with -o terse - test('terse', run_test_suite, - args: script_args + ['--osyntax', 'turtle', - files('terse/manifest.ttl'), - serd_base + 'terse/', - '--', '-o', 'terse'], - env: test_env, - suite: ['rdf', 'serd'], - timeout: 240) - - manifest = files('pattern' / 'manifest.ttl') - base_uri = serd_base + 'pattern' + '/' - test('pattern', run_test_suite, - args: script_args + [manifest, base_uri, '--', '-i', 'variables'], - env: test_env, - suite: ['rdf', 'serd'], - timeout: 240) - - manifest = files('canon' / 'manifest.ttl') - base_uri = serd_base + 'canon' + '/' - test('canon', run_test_suite, - args: script_args + [manifest, base_uri, '--', '-C'], - env: test_env, - suite: ['rdf', 'serd'], - timeout: 240) - - ### The lax suite is special because it is run twice... - lax_manifest = files('lax/manifest.ttl') - lax_base_uri = serd_base + name + '/' - - ### ... once with strict parsing to test the hard errors - test('lax.strict', run_test_suite, - args: script_args + [lax_manifest, lax_base_uri], - env: test_env, - is_parallel: false, - suite: ['rdf', 'serd'], - timeout: 240) - - ### ... and once with lax parsing to tolerate them - test('lax.lax', run_test_suite, - args: script_args + [lax_manifest, lax_base_uri, '--', - '-i', 'lax', '-o', 'lax'], - env: test_env, - is_parallel: false, - 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] - - test(syntax, run_test_suite, - args: script_args + args, - env: test_env, - suite: ['rdf', 'w3c'], - timeout: 240) - - endforeach + # RDF-driven test suites from the W3C + subdir('NQuadsTests') + subdir('NTriplesTests') + subdir('TriGTests') + subdir('TurtleTests') + + # Extra RDF-driven test suites for serd + subdir('bad') + subdir('canon') + subdir('good') + subdir('lax') + subdir('pattern') + subdir('terse') endif diff --git a/test/pattern/meson.build b/test/pattern/meson.build new file mode 100644 index 00000000..1d5a2140 --- /dev/null +++ b/test/pattern/meson.build @@ -0,0 +1,14 @@ +base_uri = 'http://drobilla.net/sw/serd/test/pattern/' + +test('pattern', + run_test_suite, + args: script_args + [ + files('manifest.ttl'), + base_uri, + '--', + '-i', + 'variables', + ], + env: test_env, + suite: ['suite', 'extra'], + timeout: 240) diff --git a/test/run_test_suite.py b/test/run_test_suite.py index 1c5a7cf3..81d36bc1 100755 --- a/test/run_test_suite.py +++ b/test/run_test_suite.py @@ -201,6 +201,7 @@ def test_suite( input_syntax, output_syntax, command_prefix, + out_test_dir, ): """Run all tests in a test suite manifest.""" @@ -210,9 +211,6 @@ def test_suite( command_prefix + ["-I", base_uri], manifest_path ) - top_dir = os.path.commonpath([os.getcwd(), os.path.abspath(test_dir)]) - out_test_dir = os.path.relpath(test_dir, top_dir) - os.makedirs(out_test_dir, exist_ok=True) asserter = "" @@ -398,13 +396,22 @@ def main(): parser.add_argument("--syntax", default=None, help="input syntax") parser.add_argument("--osyntax", default=None, help="output syntax") parser.add_argument("--wrapper", default="", help="executable wrapper") + + parser.add_argument( + "-o", "--out-dir", default=None, help="output directory" + ) + parser.add_argument("manifest", help="test suite manifest.ttl file") parser.add_argument("base_uri", help="base URI for tests") + parser.add_argument( "serdi_option", nargs=argparse.REMAINDER, help="option for serdi" ) args = parser.parse_args(sys.argv[1:]) + if args.out_dir is None: + suite_name = os.path.basename(os.path.dirname(args.manifest)) + args.out_dir = os.path.join('test', suite_name) command_prefix = ( shlex.split(args.wrapper) + [args.serdi] + args.serdi_option ) @@ -416,6 +423,7 @@ def main(): args.syntax, args.osyntax, command_prefix, + args.out_dir, ) diff --git a/test/terse/meson.build b/test/terse/meson.build new file mode 100644 index 00000000..538a8d16 --- /dev/null +++ b/test/terse/meson.build @@ -0,0 +1,16 @@ +base_uri = 'http://drobilla.net/sw/serd/test/terse/' + +test('terse', + run_test_suite, + args: script_args + [ + '--osyntax', 'turtle', + files('manifest.ttl'), + base_uri, + '--', + '-o', + 'terse', + ], + env: test_env, + is_parallel: false, + suite: ['suite', 'extra'], + timeout: 240) |