diff options
author | David Robillard <d@drobilla.net> | 2020-02-15 14:56:32 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-02-16 12:03:18 +0100 |
commit | 66985fb0748b6e4397ea9115d81088071984867c (patch) | |
tree | 4fadc80c45ce1c98ef9c1fc3307f8c841d527100 | |
parent | b042d19364170e03db35b4c736d7d17c897d5203 (diff) | |
download | lv2-66985fb0748b6e4397ea9115d81088071984867c.tar.xz |
Add test that all data files are normalised and valid
-rw-r--r-- | wscript | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -94,6 +94,10 @@ def configure(conf): and not conf.is_defined('HAVE_GCOV')): conf.check_cc(lib='gcov', define_name='HAVE_GCOV', mandatory=False) + if conf.env.BUILD_TESTS: + conf.find_program('serdi', mandatory=False) + conf.find_program('sord_validate', mandatory=False) + autowaf.set_lib_env(conf, 'lv2', VERSION, has_objects=False) autowaf.set_local_lib(conf, 'lv2', has_objects=False) @@ -434,6 +438,26 @@ def lint(ctx): subprocess.call(cmd, cwd='build', shell=True) def test(tst): + import tempfile + + with tst.group("Data") as check: + schemas = list(map(str, tst.path.ant_glob("schemas.lv2/*.ttl"))) + spec_files = list(map(str, tst.path.ant_glob("lv2/**/*.ttl"))) + plugin_files = list(map(str, tst.path.ant_glob("plugins/**/*.ttl"))) + bld_files = list(map(str, tst.path.get_bld().ant_glob("**/*.ttl"))) + + if "SERDI" in tst.env: + for f in spec_files: + with tempfile.NamedTemporaryFile(mode="w") as tmp: + base_dir = os.path.dirname(f) + cmd = tst.env.SERDI + ["-o", "turtle", f, base_dir] + check(cmd, stdout=tmp.name) + check.file_equals(f, tmp.name) + + if "SORD_VALIDATE" in tst.env: + all_files = schemas + spec_files + plugin_files + bld_files + check(tst.env.SORD_VALIDATE + all_files) + with tst.group('Unit') as check: pattern = tst.env.cprogram_PATTERN % '**/*-test' for test in tst.path.get_bld().ant_glob(pattern): |