From 7170a28d46d5db1e7a9da24a5555a194a233ef0b Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Mon, 19 Oct 2020 12:14:25 +0200 Subject: Fix test binary installation - Remove "install tests" configure option, we already have an option whether to build tests or not. Don't try to work around autotools semantics that people building the package expect. - Fix the installation path by propperly defining it and using the correct name for the libexec path. Signed-off-by: David Oberhollenzer --- Makefile.am | 6 ++++-- configure.ac | 16 ++------------- m4/ac_define_dir.m4 | 35 +++++++++++++++++++++++++++++++++ nand-utils/Makemodule.am | 6 +----- tests/checkfs/Makemodule.am | 9 +-------- tests/fs-tests/Makemodule.am | 12 ++--------- tests/fs-tests/fs_help_all.sh.in | 6 +----- tests/fs-tests/fs_run_all.sh.in | 6 +----- tests/fs-tests/stress/fs_stress00.sh.in | 6 +----- tests/fs-tests/stress/fs_stress01.sh.in | 6 +----- tests/jittertest/Makemodule.am | 14 ++----------- tests/mtd-tests/Makemodule.am | 8 +------- tests/ubi-tests/Makemodule.am | 12 ++--------- tests/ubi-tests/runubitests.sh.in | 6 +----- tests/ubi-tests/ubi-stress-test.sh.in | 6 +----- 15 files changed, 56 insertions(+), 98 deletions(-) create mode 100644 m4/ac_define_dir.m4 diff --git a/Makefile.am b/Makefile.am index ce8fc89..d4de62c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -32,11 +32,13 @@ check_PROGRAMS = noinst_LIBRARIES = noinst_PROGRAMS = noinst_SCRIPTS = -pkglibexec_PROGRAMS = -pkglibexec_SCRIPTS = dist_man1_MANS = dist_man8_MANS = +testdir = @TESTBINDIR@ +test_PROGRAMS = +test_SCRIPTS = + TESTS = EXTRA_DIST = COPYING diff --git a/configure.ac b/configure.ac index a5f6261..a792bd1 100644 --- a/configure.ac +++ b/configure.ac @@ -91,20 +91,8 @@ AM_COND_IF([BUILD_TESTS], [ need_pthread="yes" ]) - -AC_ARG_ENABLE([install-tests], - [AS_HELP_STRING([--enable-install-tests], [Install test programs])], - [case "${enableval}" in - yes) AM_CONDITIONAL([INSTALL_TESTS], [true]) ;; - no) AM_CONDITIONAL([INSTALL_TESTS], [false]) ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-install-tests]) ;; - esac], - [AM_CONDITIONAL([INSTALL_TESTS], [false])]) - - -AM_COND_IF([INSTALL_TESTS], - [AC_SUBST(testbindir, ["\$libexecpath"])], - [AC_SUBST(testbindir, ["\".\""])]) +AC_DEFINE_DIR(TESTBINDIR, libexecdir/mtd-utils, + [Path where test and debug programs will be installed]) AC_ARG_ENABLE([ubihealthd], [AS_HELP_STRING([--enable-ubihealthd], [Build the ubihealthd program])], diff --git a/m4/ac_define_dir.m4 b/m4/ac_define_dir.m4 new file mode 100644 index 0000000..3b48c8b --- /dev/null +++ b/m4/ac_define_dir.m4 @@ -0,0 +1,35 @@ +dnl @synopsis AC_DEFINE_DIR(VARNAME, DIR [, DESCRIPTION]) +dnl +dnl This macro sets VARNAME to the expansion of the DIR variable, +dnl taking care of fixing up ${prefix} and such. +dnl +dnl VARNAME is then offered as both an output variable and a C +dnl preprocessor symbol. +dnl +dnl Example: +dnl +dnl AC_DEFINE_DIR([DATADIR], [datadir], [Where data are placed to.]) +dnl +dnl @category Misc +dnl @author Stepan Kasal +dnl @author Andreas Schwab +dnl @author Guido U. Draheim +dnl @author Alexandre Oliva +dnl @version 2006-10-13 +dnl @license AllPermissive + +AC_DEFUN([AC_DEFINE_DIR], [ + prefix_NONE= + exec_prefix_NONE= + test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix + test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix +dnl In Autoconf 2.60, ${datadir} refers to ${datarootdir}, which in turn +dnl refers to ${prefix}. Thus we have to use `eval' twice. + eval ac_define_dir="\"[$]$2\"" + eval ac_define_dir="\"$ac_define_dir\"" + AC_SUBST($1, "$ac_define_dir") + AC_DEFINE_UNQUOTED($1, "$ac_define_dir", [$3]) + test "$prefix_NONE" && prefix=NONE + test "$exec_prefix_NONE" && exec_prefix=NONE +]) + diff --git a/nand-utils/Makemodule.am b/nand-utils/Makemodule.am index 1cb69dc..cee6777 100644 --- a/nand-utils/Makemodule.am +++ b/nand-utils/Makemodule.am @@ -26,9 +26,5 @@ EXTRA_DIST += $(NAND_SH) sbin_PROGRAMS += nanddump nandwrite nandtest nftldump nftl_format nandflipbits if BUILD_TESTS -if INSTALL_TESTS -pkglibexec_SCRIPTS += $(NAND_SH) -else -noinst_SCRIPTS += $(NAND_SH) -endif +test_SCRIPTS += $(NAND_SH) endif diff --git a/tests/checkfs/Makemodule.am b/tests/checkfs/Makemodule.am index 9f91373..631ab92 100644 --- a/tests/checkfs/Makemodule.am +++ b/tests/checkfs/Makemodule.am @@ -5,13 +5,6 @@ checkfs_CPPFLAGS = $(AM_CPPFLAGS) makefiles_SOURCES = tests/checkfs/makefiles.c makefiles_CPPFLAGS = $(AM_CPPFLAGS) -CHECKFS_BINS = \ - makefiles checkfs - EXTRA_DIST += tests/checkfs/README -if INSTALL_TESTS -pkglibexec_PROGRAMS += $(CHECKFS_BINS) -else -noinst_PROGRAMS += $(CHECKFS_BINS) -endif +test_PROGRAMS += makefiles checkfs diff --git a/tests/fs-tests/Makemodule.am b/tests/fs-tests/Makemodule.am index 506dadc..0c58c9c 100644 --- a/tests/fs-tests/Makemodule.am +++ b/tests/fs-tests/Makemodule.am @@ -66,21 +66,13 @@ fstest_monitor_SOURCES = tests/fs-tests/utils/fstest_monitor.c free_space_SOURCES = tests/fs-tests/utils/free_space.c -FSTEST_BINS = \ +test_PROGRAMS += \ integck test_1 test_2 ftrunc perf orph \ stress_1 stress_2 stress_3 pdfrun gcd_hupper \ rndwrite00 fwrite00 rmdir00 rndrm00 rndrm99 \ fstest_monitor free_space -FSTEST_SH = \ +test_SCRIPTS += \ tests/fs-tests/fs_help_all.sh tests/fs-tests/fs_run_all.sh \ tests/fs-tests/stress/fs_stress00.sh \ tests/fs-tests/stress/fs_stress01.sh - -if INSTALL_TESTS -pkglibexec_SCRIPTS += $(FSTEST_SH) -pkglibexec_PROGRAMS += $(FSTEST_BINS) -else -noinst_SCRIPTS += $(FSTEST_SH) -noinst_PROGRAMS += $(FSTEST_BINS) -endif diff --git a/tests/fs-tests/fs_help_all.sh.in b/tests/fs-tests/fs_help_all.sh.in index 39219b2..3898fbd 100755 --- a/tests/fs-tests/fs_help_all.sh.in +++ b/tests/fs-tests/fs_help_all.sh.in @@ -1,10 +1,6 @@ #!/bin/sh -prefix=@prefix@ -exec_prefix=@exec_prefix@ -bindir=@bindir@ -libexecpath=@libexecdir@/mtd-utils -TESTBINDIR=@testbindir@ +TESTBINDIR=@TESTBINDIR@ echo ------------------------------------------------------------------------------- $TESTBINDIR/test_1 -h diff --git a/tests/fs-tests/fs_run_all.sh.in b/tests/fs-tests/fs_run_all.sh.in index a3676f9..f15a63b 100755 --- a/tests/fs-tests/fs_run_all.sh.in +++ b/tests/fs-tests/fs_run_all.sh.in @@ -1,10 +1,6 @@ #!/bin/sh -prefix=@prefix@ -exec_prefix=@exec_prefix@ -bindir=@bindir@ -libexecpath=@libexecdir@/mtd-utils -TESTBINDIR=@testbindir@ +TESTBINDIR=@TESTBINDIR@ TEST_DIR=$TEST_FILE_SYSTEM_MOUNT_DIR if test -z "$TEST_DIR"; diff --git a/tests/fs-tests/stress/fs_stress00.sh.in b/tests/fs-tests/stress/fs_stress00.sh.in index 85ec7a2..f7d317c 100755 --- a/tests/fs-tests/stress/fs_stress00.sh.in +++ b/tests/fs-tests/stress/fs_stress00.sh.in @@ -1,10 +1,6 @@ #!/bin/sh -prefix=@prefix@ -exec_prefix=@exec_prefix@ -bindir=@bindir@ -libexecpath=@libexecdir@/mtd-utils -TESTBINDIR=@testbindir@ +TESTBINDIR=@TESTBINDIR@ TEST_DIR=$TEST_FILE_SYSTEM_MOUNT_DIR if test -z "$TEST_DIR"; diff --git a/tests/fs-tests/stress/fs_stress01.sh.in b/tests/fs-tests/stress/fs_stress01.sh.in index d0ea8f9..da6babf 100755 --- a/tests/fs-tests/stress/fs_stress01.sh.in +++ b/tests/fs-tests/stress/fs_stress01.sh.in @@ -1,10 +1,6 @@ #!/bin/sh -prefix=@prefix@ -exec_prefix=@exec_prefix@ -bindir=@bindir@ -libexecpath=@libexecdir@/mtd-utils -TESTBINDIR=@testbindir@ +TESTBINDIR=@TESTBINDIR@ TEST_DIR=$TEST_FILE_SYSTEM_MOUNT_DIR if test -z "$TEST_DIR"; diff --git a/tests/jittertest/Makemodule.am b/tests/jittertest/Makemodule.am index 4698365..620ad00 100644 --- a/tests/jittertest/Makemodule.am +++ b/tests/jittertest/Makemodule.am @@ -4,18 +4,8 @@ JitterTest_CPPFLAGS = $(AM_CPPFLAGS) plotJittervsFill_SOURCES = tests/jittertest/plotJittervsFill.c plotJittervsFill_CPPFLAGS = $(AM_CPPFLAGS) -JITTEREST_BINS = \ - JitterTest plotJittervsFill +test_PROGRAMS += JitterTest plotJittervsFill -JITTERTEST_SH = \ - tests/jittertest/filljffs2.sh +test_SCRIPTS += tests/jittertest/filljffs2.sh EXTRA_DIST += tests/jittertest/README $(JITTERTEST_SH) - -if INSTALL_TESTS -pkglibexec_SCRIPTS += $(JITTERTEST_SH) -pkglibexec_PROGRAMS += $(JITTEREST_BINS) -else -noinst_SCRIPTS += $(JITTERTEST_SH) -noinst_PROGRAMS += $(JITTEREST_BINS) -endif diff --git a/tests/mtd-tests/Makemodule.am b/tests/mtd-tests/Makemodule.am index 5925fd9..d849e3c 100644 --- a/tests/mtd-tests/Makemodule.am +++ b/tests/mtd-tests/Makemodule.am @@ -26,12 +26,6 @@ nandsubpagetest_SOURCES = tests/mtd-tests/nandsubpagetest.c nandsubpagetest_LDADD = libmtd.a nandsubpagetest_CPPFLAGS = $(AM_CPPFLAGS) -MTDTEST_BINS = \ +test_PROGRAMS += \ flash_torture flash_stress flash_speed nandbiterrs flash_readtest \ nandpagetest nandsubpagetest - -if INSTALL_TESTS -pkglibexec_PROGRAMS += $(MTDTEST_BINS) -else -noinst_PROGRAMS += $(MTDTEST_BINS) -endif diff --git a/tests/ubi-tests/Makemodule.am b/tests/ubi-tests/Makemodule.am index fe835ed..13d7b08 100644 --- a/tests/ubi-tests/Makemodule.am +++ b/tests/ubi-tests/Makemodule.am @@ -54,17 +54,9 @@ rsvol_SOURCES += tests/ubi-tests/helpers.h rsvol_LDADD = libubi.a rsvol_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/ubi-utils/include -UBITEST_BINS = \ +test_PROGRAMS += \ io_basic io_update io_paral io_read volrefcnt integ \ mkvol_basic mkvol_bad mkvol_paral rsvol -UBITEST_SH = \ +test_SCRIPTS += \ tests/ubi-tests/runubitests.sh tests/ubi-tests/ubi-stress-test.sh - -if INSTALL_TESTS -pkglibexec_SCRIPTS += $(UBITEST_SH) -pkglibexec_PROGRAMS += $(UBITEST_BINS) -else -noinst_SCRIPTS += $(UBITEST_SH) -noinst_PROGRAMS += $(UBITEST_BINS) -endif diff --git a/tests/ubi-tests/runubitests.sh.in b/tests/ubi-tests/runubitests.sh.in index a1b23c4..1675308 100755 --- a/tests/ubi-tests/runubitests.sh.in +++ b/tests/ubi-tests/runubitests.sh.in @@ -1,10 +1,6 @@ #!/bin/sh -euf -prefix=@prefix@ -exec_prefix=@exec_prefix@ -bindir=@bindir@ -libexecpath=@libexecdir@/mtd-utils -TESTBINDIR=@testbindir@ +TESTBINDIR=@TESTBINDIR@ tests="mkvol_basic mkvol_bad mkvol_paral rsvol io_basic io_read io_update io_paral volrefcnt" diff --git a/tests/ubi-tests/ubi-stress-test.sh.in b/tests/ubi-tests/ubi-stress-test.sh.in index 657ef4b..e178076 100755 --- a/tests/ubi-tests/ubi-stress-test.sh.in +++ b/tests/ubi-tests/ubi-stress-test.sh.in @@ -1,10 +1,6 @@ #!/bin/sh -euf -prefix=@prefix@ -exec_prefix=@exec_prefix@ -bindir=@bindir@ -libexecpath=@libexecdir@/mtd-utils -TESTBINDIR=@testbindir@ +TESTBINDIR=@TESTBINDIR@ fatal() { -- cgit v1.2.3