From d35eabd63689b7d014c18206a611cd355af016ba Mon Sep 17 00:00:00 2001 From: Geert Janssens Date: Sat, 18 May 2019 14:06:57 +0200 Subject: [PATCH] Prevent autocompilation of the guile test scripts There were several issues: - we store the compiled test*.go files in a tests subdirectory, but this is not on the GUILE_LOAD_COMPILED_PATH. Added this directory to the path. - guile was looking for 'script.scm.go' while we create 'script.go'. This is due to how we invoke the scripts: guile -l path-to-script.scm -c (something) we can replace this with -l path-to-script (without extension) as -l won't add the extension. So I've rewrittin the test command to invoke (load-from-path). - the test modules foo.scm, bar.scm and baz.scm should go in tests/gnucash as they are defined as modules (gnucash foo), (gnucash bar) and (gnucash baz) respectively. - find html.scm/go on the load path instead of using a relative path. --- common/cmake_modules/GncAddTest.cmake | 4 ++-- gnucash/report/report-system/test/test-html-fonts.scm | 2 +- gnucash/report/reports/standard/test/CMakeLists.txt | 6 ++++++ libgnucash/gnc-module/test/mod-bar/CMakeLists.txt | 7 +++++++ libgnucash/gnc-module/test/mod-baz/CMakeLists.txt | 4 ++-- libgnucash/gnc-module/test/mod-foo/CMakeLists.txt | 4 ++-- 6 files changed, 20 insertions(+), 7 deletions(-) diff --git a/common/cmake_modules/GncAddTest.cmake b/common/cmake_modules/GncAddTest.cmake index 2d5efbbe68..7cebe51682 100644 --- a/common/cmake_modules/GncAddTest.cmake +++ b/common/cmake_modules/GncAddTest.cmake @@ -32,7 +32,7 @@ function(get_guile_env) list(APPEND env "GUILE=${GUILE_EXECUTABLE}") if (NOT WIN32) - list(APPEND env "GUILE_LOAD_COMPILED_PATH=${LIBDIR_BUILD}/gnucash/scm/ccache/${GUILE_EFFECTIVE_VERSION}") + list(APPEND env "GUILE_LOAD_COMPILED_PATH=${LIBDIR_BUILD}/gnucash/scm/ccache/${GUILE_EFFECTIVE_VERSION}:${LIBDIR_BUILD}/gnucash/scm/ccache/${GUILE_EFFECTIVE_VERSION}/tests") endif() set(guile_load_paths "") list(APPEND guile_load_paths ${CMAKE_CURRENT_SOURCE_DIR}/mod-foo) @@ -102,7 +102,7 @@ function(gnc_add_scheme_test _TARGET _SOURCE_FILE) set(CMAKE_COMMAND_TMP ${CMAKE_COMMAND} -E env) endif() add_test(${_TARGET} ${CMAKE_COMMAND_TMP} - ${GUILE_EXECUTABLE} --debug -l ${CMAKE_CURRENT_SOURCE_DIR}/${_SOURCE_FILE} -c "(exit (run-test))" + ${GUILE_EXECUTABLE} --debug -c "(load-from-path \"${_TARGET}\")(exit (run-test))" ) get_guile_env() set_tests_properties(${_TARGET} PROPERTIES ENVIRONMENT "${GUILE_ENV};${ARGN}") diff --git a/gnucash/report/report-system/test/test-html-fonts.scm b/gnucash/report/report-system/test/test-html-fonts.scm index bdb4d9099e..d136a1de2e 100644 --- a/gnucash/report/report-system/test/test-html-fonts.scm +++ b/gnucash/report/report-system/test/test-html-fonts.scm @@ -1,6 +1,6 @@ (use-modules (srfi srfi-64)) (use-modules (tests srfi64-extras)) -(load "../html-fonts.scm") +(load "html-fonts") (setlocale LC_ALL "C") diff --git a/gnucash/report/reports/standard/test/CMakeLists.txt b/gnucash/report/reports/standard/test/CMakeLists.txt index 081d8cacc2..503771f990 100644 --- a/gnucash/report/reports/standard/test/CMakeLists.txt +++ b/gnucash/report/reports/standard/test/CMakeLists.txt @@ -43,6 +43,12 @@ if (HAVE_SRFI64) gnc_add_scheme_tests("${scm_test_with_srfi64_SOURCES}") if (HAVE_TEXT_PORTS) + gnc_add_scheme_test_targets(scm-test-reports-standard-tp + "${scm_test_with_textual_ports_SOURCES}" + "tests" + "${GUILE_DEPENDS};scm-srfi64-extras" + FALSE + ) gnc_add_scheme_tests("${scm_test_with_textual_ports_SOURCES}") endif (HAVE_TEXT_PORTS) endif (HAVE_SRFI64) diff --git a/libgnucash/gnc-module/test/mod-bar/CMakeLists.txt b/libgnucash/gnc-module/test/mod-bar/CMakeLists.txt index e86921c16d..ddeefb7864 100644 --- a/libgnucash/gnc-module/test/mod-bar/CMakeLists.txt +++ b/libgnucash/gnc-module/test/mod-bar/CMakeLists.txt @@ -19,6 +19,13 @@ target_include_directories(gncmod-bar PRIVATE ${GUILE_INCLUDE_DIRS} ) +gnc_add_scheme_test_targets(scm-mod-bar + gnucash/bar.scm + "tests/gnucash" + gncmod-bar + FALSE + ) + set_target_properties(bar gncmod-bar PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${LIBDIR_BUILD}/gnucash/test ARCHIVE_OUTPUT_DIRECTORY ${LIBDIR_BUILD}/gnucash/test diff --git a/libgnucash/gnc-module/test/mod-baz/CMakeLists.txt b/libgnucash/gnc-module/test/mod-baz/CMakeLists.txt index 23b2dfad7b..f83fed30e0 100644 --- a/libgnucash/gnc-module/test/mod-baz/CMakeLists.txt +++ b/libgnucash/gnc-module/test/mod-baz/CMakeLists.txt @@ -27,9 +27,9 @@ target_include_directories(gncmod-baz PRIVATE gnc_add_scheme_test_targets(scm-mod-baz gnucash/baz.scm - "tests" + "tests/gnucash" gncmod-baz - TRUE + FALSE ) set_target_properties(baz gncmod-baz PROPERTIES diff --git a/libgnucash/gnc-module/test/mod-foo/CMakeLists.txt b/libgnucash/gnc-module/test/mod-foo/CMakeLists.txt index 5e05b1092e..c184eef7dd 100644 --- a/libgnucash/gnc-module/test/mod-foo/CMakeLists.txt +++ b/libgnucash/gnc-module/test/mod-foo/CMakeLists.txt @@ -21,9 +21,9 @@ target_include_directories(gncmod-foo PRIVATE gnc_add_scheme_test_targets(scm-mod-foo gnucash/foo.scm - "tests" + "tests/gnucash" gncmod-foo - TRUE + FALSE ) set_target_properties(foo gncmod-foo PROPERTIES