Remove json-schema install
This code just copies the json-schema from the source dir to the compile
dir. It doesn't actually accomplish anything.
Move the source dir to a compile flag, and let unit tests read in the
schema directly.
Note: Copy was actually done in two places.
Change-Id: I26aee9edbac5b253ca426d32118b71cc5f905e10
Signed-off-by: Ed Tanous <ed@tanous.net>
diff --git a/meson.build b/meson.build
index 2f19d99..04b8094 100644
--- a/meson.build
+++ b/meson.build
@@ -12,6 +12,13 @@
],
)
+add_global_arguments(
+ '-DLIBCPER_JSON_SPEC="'
+ + meson.current_source_dir()
+ + '/specification/json/cper-json.json"',
+ language: ['c', 'cpp'],
+)
+
library_is_share = get_option('default_library') == 'shared'
project_description = 'libcper library'
@@ -140,13 +147,6 @@
)
endif
-run_command('cp', '-r', 'specification/json/', meson.current_build_dir(), check: true)
-run_command(
- 'mv',
- meson.current_build_dir() / 'json',
- meson.current_build_dir() / 'specification',
-)
-
if get_option('tests').allowed()
subdir('tests')
-endif
+endif
\ No newline at end of file
diff --git a/tests/ir-tests.cpp b/tests/ir-tests.cpp
index 6da285b..e8db79f 100644
--- a/tests/ir-tests.cpp
+++ b/tests/ir-tests.cpp
@@ -41,8 +41,8 @@
//Validate against schema.
char error_message[JSON_ERROR_MSG_MAX_LEN] = { 0 };
- int valid = validate_schema_from_file("./specification/cper-json.json",
- ir, error_message);
+ int valid =
+ validate_schema_from_file(LIBCPER_JSON_SPEC, ir, error_message);
json_object_put(ir);
ASSERT_TRUE(valid)
<< "IR validation test failed (single section mode = "
diff --git a/tests/meson.build b/tests/meson.build
index 87dcf51..4cecdbd 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -27,13 +27,6 @@
test_include_dirs = ['.', '..']
-run_command('cp', '-r', '../specification/json/', meson.current_build_dir())
-run_command(
- 'mv',
- meson.current_build_dir() / 'json',
- meson.current_build_dir() / 'specification',
-)
-
cper_tests = executable(
'cper-tests',
sources,