From 66985fb0748b6e4397ea9115d81088071984867c Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 15 Feb 2020 14:56:32 +0100 Subject: Add test that all data files are normalised and valid --- wscript | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/wscript b/wscript index cda754e..b54aacc 100644 --- a/wscript +++ b/wscript @@ -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): -- cgit v1.2.1