Convert shell-executed scheme tests to run directly from Guile.

I.e., remove the shell invocation and with it the need to set the shebang.

Surprisingly this required some build-system modifications particularly
for cmake in order to correctly set the environment.
This commit is contained in:
John Ralls
2017-11-07 15:04:16 -08:00
parent f412795ef2
commit 6c01e54042
46 changed files with 313 additions and 281 deletions
+28 -5
View File
@@ -27,11 +27,34 @@ GNC_ADD_TEST_WITH_GUILE(test-scm-query-string test-scm-query-string.cpp
)
ADD_APP_UTILS_TEST(test-sx test-sx.cpp)
GNC_ADD_SCHEME_TEST(scm-test-load-module-app-utils test-load-module.in)
SET(GUILE_DEPENDS
scm-app-utils
gnc-core-utils
gnc-module
gncmod-engine
gncmod-backend-xml
gncmod-backend-xml
)
GNC_ADD_SCHEME_TARGETS(scm-test-load-app-utils-module
"test-load-app-utils-module.scm"
"gnucash/reports"
"${GUILE_DEPENDS}"
FALSE
)
GNC_ADD_SCHEME_TESTS("test-load-app-utils-module.scm")
# Doesn't work yet:
GNC_ADD_TEST_WITH_GUILE(test-app-utils "${test_app_utils_SOURCES}" APP_UTILS_TEST_INCLUDE_DIRS APP_UTILS_TEST_LIBS)
CONFIGURE_FILE(test-load-module.in test-load-module @ONLY)
SET_DIST_LIST(test_app_utils_DIST CMakeLists.txt Makefile.am test-exp-parser.c test-link-module.c test-load-module.in
test-print-parse-amount.cpp test-print-queries.cpp test-scm-query-string.cpp test-sx.cpp ${test_app_utils_SOURCES})
SET_DIST_LIST(test_app_utils_DIST
CMakeLists.txt
Makefile.am
test-exp-parser.c
test-link-module.c
test-print-parse-amount.cpp
test-print-queries.cpp
test-scm-query-string.cpp
test-sx.cpp
${test_app_utils_SOURCES}
)
+12 -3
View File
@@ -9,8 +9,8 @@ check_PROGRAMS = \
test-app-utils
TESTS = \
test-load-module \
${check_PROGRAMS}
${check_PROGRAMS} \
${SCM_TESTS}
test_scm_query_string_SOURCES = test-scm-query-string.cpp
test_sx_SOURCES = test-sx.cpp
@@ -47,8 +47,8 @@ LDADD = \
${GUILE_LIBS}
EXTRA_DIST += \
test-load-module \
test-print-queries.cpp \
${SCM_TEST_SRCS} \
CMakeLists.txt
AM_CPPFLAGS = \
@@ -73,3 +73,12 @@ test_app_utils_CXXFLAGS = \
-I${top_srcdir}/${MODULEPATH}/ \
-DTESTPROG=test_app_utils \
${GLIB_CFLAGS}
SCM_TESTS = test-load-app-utils-module
SCM_TEST_SRCS = $(SCM_TESTS:%=%.scm)
$(SCM_TESTS): %: $(srcdir)/%.scm Makefile
echo 'export GNC_BUILDDIR="${abs_top_builddir}";' > $@
echo 'export GNC_UNINSTALLED=yes;' >> $@
echo '${GUILE} --debug -l $(srcdir)/$*.scm -c "(exit (run-test))"' >> $@
chmod a+x $@
@@ -1,7 +1,3 @@
#! @SHELL@
exec ${GUILE} -s "$0"
!#
(define exit-code 0)
(setenv "GNC_UNINSTALLED" "1")
(use-modules (gnucash gnc-module))