The test_demo program compares whether XDR encoded data match the
expected output as read from a file. But the file path is not
absolute and thus relative to CWD which means the program can run
only from one specific directory.
Do what we do in the rest of our test suite: define 'abs_srcdir'
macro and prefix the path with it.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
test_demo = executable(
'test_demo',
[ 'test_demo.c' ],
- c_args: cc_flags_relaxed_frame_limit,
+ c_args: [
+ '-Dabs_srcdir="@0@"'.format(meson.current_source_dir()),
+ ] + cc_flags_relaxed_frame_limit,
dependencies: [
xdr_dep, glib_dep
],
/* 128kb is big enough for any of our test data */
size_t buflen = 128 * 1000;
g_autofree char *buf = g_new0(char, buflen);
- g_autofree char *expfile = g_strdup_printf("test_demo_%s.bin", testname);
+ g_autofree char *expfile = g_strdup_printf(abs_srcdir "/test_demo_%s.bin", testname);
g_autofree char *expected = NULL;
size_t explen;
size_t actlen;