From 2bc0525e939ea38c74a814bd51683955599824a3 Mon Sep 17 00:00:00 2001 From: Marian Csontos Date: Tue, 14 Jul 2015 20:27:31 +0200 Subject: [PATCH] test: Fix hardcoded /usr/share in testsuite --- configure | 14 ++++++++++++++ configure.in | 11 +++++++++++ lib/misc/configure.h.in | 3 +++ test/lib/brick-shelltest.h | 2 +- 4 files changed, 29 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 48f5381c6..139f332de 100755 --- a/configure +++ b/configure @@ -649,6 +649,7 @@ UDEV_SYNC UDEV_RULES UDEV_PC THIN +TESTSUITE_DATA TESTING STATIC_LINK STATICDIR @@ -7351,6 +7352,9 @@ $as_echo "$ac_cv_flag_HAVE_FULL_RELRO" >&6; } ################################################################################ +if test "$prefix" = NONE; then + datarootdir=${ac_default_prefix}/share +fi ################################################################################ { $as_echo "$as_me:${as_lineno-$LINENO}: checking file owner" >&5 @@ -10812,6 +10816,16 @@ $as_echo "yes" >&6; } fi fi +################################################################################ +TESTSUITE_DATA='${datarootdir}/lvm2-testsuite' +# double eval needed ${datarootdir} -> ${prefix}/share -> real path + +cat >>confdefs.h <<_ACEOF +#define TESTSUITE_DATA "$(eval echo $(eval echo $TESTSUITE_DATA))" +_ACEOF + + + ################################################################################ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable valgrind awareness of pools" >&5 $as_echo_n "checking whether to enable valgrind awareness of pools... " >&6; } diff --git a/configure.in b/configure.in index ca461af3e..7bb18a480 100644 --- a/configure.in +++ b/configure.in @@ -174,6 +174,9 @@ AC_SUBST(HAVE_FULL_RELRO) ################################################################################ dnl -- Prefix is /usr by default, the exec_prefix default is setup later AC_PREFIX_DEFAULT(/usr) +if test "$prefix" = NONE; then + datarootdir=${ac_default_prefix}/share +fi ################################################################################ dnl -- Setup the ownership of the files @@ -1061,6 +1064,13 @@ if test "$TESTING" = yes; then PKG_CHECK_MODULES(CUNIT, cunit >= 2.0) fi +################################################################################ +dnl -- Set LVM2 testsuite data +TESTSUITE_DATA='${datarootdir}/lvm2-testsuite' +# double eval needed ${datarootdir} -> ${prefix}/share -> real path +AC_DEFINE_UNQUOTED(TESTSUITE_DATA, ["$(eval echo $(eval echo $TESTSUITE_DATA))"], [Path to testsuite data]) + + ################################################################################ dnl -- Enable valgrind awareness of memory pools AC_MSG_CHECKING(whether to enable valgrind awareness of pools) @@ -1971,6 +1981,7 @@ AC_SUBST(SNAPSHOTS) AC_SUBST(STATICDIR) AC_SUBST(STATIC_LINK) AC_SUBST(TESTING) +AC_SUBST(TESTSUITE_DATA) AC_SUBST(THIN) AC_SUBST(THIN_CHECK_CMD) AC_SUBST(THIN_DUMP_CMD) diff --git a/lib/misc/configure.h.in b/lib/misc/configure.h.in index d9f5a7dd9..13e8a2dba 100644 --- a/lib/misc/configure.h.in +++ b/lib/misc/configure.h.in @@ -632,6 +632,9 @@ /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS +/* Path to testsuite data */ +#undef TESTSUITE_DATA + /* The path to 'thin_check', if available. */ #undef THIN_CHECK_CMD diff --git a/test/lib/brick-shelltest.h b/test/lib/brick-shelltest.h index e64a166e1..21e1eeca6 100644 --- a/test/lib/brick-shelltest.h +++ b/test/lib/brick-shelltest.h @@ -1173,7 +1173,7 @@ static int run( int argc, const char **argv, std::string fl_envvar = "TEST_FLAVO opt.workdir = args.opt( "--workdir" ); if ( opt.testdir.empty() ) - opt.testdir = "/usr/share/lvm2-testsuite"; + opt.testdir = TESTSUITE_DATA; if ( opt.workdir.empty() ) opt.workdir = opt.testdir;