[PATCH v2 2/2] treewide: run internal library tests in "make check"
David Timber <[email protected]>
| Newsgroups | dev.linux.lists.exfat |
|---|---|
| Message-ID | <[email protected]> |
The library tests were intended to be used internally for dev purposes, but users have suggested that they should be run when "make check" is run. Hook up the test programs to the TESTS target. "./configure --enable-tests" now only hooks up the test programs to the noinst_PROGRAMS target. "./configure --enable-tests" is not required to run the test programs using "make check". Fix stray "enable_tests=yes" output in ./configure script due to a missing comma. Run make check in the "Test building exfatprogs on arbitrary directory" step in the Github Actions CI pipelines. Please do not close #391 as the fsck test cases should be run as well. This is not an easy fix and further work is being done to achieve this. Link: https://github.com/exfatprogs/exfatprogs/issues/391 Suggested-by: Sam James <[email protected]> Signed-off-by: David Timber <[email protected]> --- .github/workflows/c-cpp.yml | 2 +- configure.ac | 2 +- lib/Makefile.am | 7 ++++--- lib/tests/run-all.sh | 3 +++ 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index d332f04..a95f420 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -220,7 +220,7 @@ jobs: BUILD_DIR="$(pwd)" "${CONFIG_SCRIPT}" make -j$((`nproc`+1)) - sudo make install + sudo make check install popd rm -rf "$BUILD_DIR" diff --git a/configure.ac b/configure.ac index ab6fb5d..99bad24 100644 --- a/configure.ac +++ b/configure.ac @@ -52,7 +52,7 @@ PKG_CHECK_MODULES([BLKID], [blkid >= 2.20], [AC_DEFINE([HAVE_BLKID], [1], [Defin [PKG_CHECK_MODULES([EXT2_BLKID], [blkid], [AC_DEFINE([HAVE_EXT2_BLKID], [1], [Define if libblkid is from libext2])])]) AC_ARG_ENABLE([tests], - AS_HELP_STRING([--enable-tests], [build internal test programs]) + AS_HELP_STRING([--enable-tests], [always build internal test programs (not just for "make check")]), [enable_tests=yes] ) AM_CONDITIONAL([ENABLE_TESTS], [test "x$enable_tests" = xyes]) diff --git a/lib/Makefile.am b/lib/Makefile.am index 90c09c1..4e9a183 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -3,9 +3,8 @@ noinst_LIBRARIES = libexfat.a libexfat_a_SOURCES = libexfat.c exfat_fs.c exfat_dir.c utils.c -if ENABLE_TESTS - -noinst_PROGRAMS = tests/suite0000-bitmap tests/suite0001-parse +check_PROGRAMS = tests/suite0000-bitmap tests/suite0001-parse +TESTS = tests/suite0000-bitmap tests/suite0001-parse tests_suite0000_bitmap_SOURCES = tests/suite0000-bitmap.c tests_suite0000_bitmap_LDADD = libexfat.a @@ -13,4 +12,6 @@ tests_suite0000_bitmap_LDADD = libexfat.a tests_suite0001_parse_SOURCES = tests/suite0001-parse.c tests_suite0001_parse_LDADD = libexfat.a +if ENABLE_TESTS +noinst_PROGRAMS = $(check_PROGRAMS) endif diff --git a/lib/tests/run-all.sh b/lib/tests/run-all.sh index 86e08da..332199a 100755 --- a/lib/tests/run-all.sh +++ b/lib/tests/run-all.sh @@ -1,4 +1,7 @@ #!/bin/sh +# Note: this is only a convenience script for running test suites with Valgrind. +# This is used in the CI pipelines(Github Actions). For normal cases, the tests +# may be run with `make check` as well. main() { -- 2.55.0