Skip to content

Commit

Permalink
Prevent autocompilation of the guile test scripts
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gjanssens committed May 25, 2019
1 parent 06bc064 commit d35eabd
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 7 deletions.
4 changes: 2 additions & 2 deletions common/cmake_modules/GncAddTest.cmake
Expand Up @@ -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)
Expand Down Expand Up @@ -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}")
Expand Down
2 changes: 1 addition & 1 deletion 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")

Expand Down
6 changes: 6 additions & 0 deletions gnucash/report/reports/standard/test/CMakeLists.txt
Expand Up @@ -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)
Expand Down
7 changes: 7 additions & 0 deletions libgnucash/gnc-module/test/mod-bar/CMakeLists.txt
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions libgnucash/gnc-module/test/mod-baz/CMakeLists.txt
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions libgnucash/gnc-module/test/mod-foo/CMakeLists.txt
Expand Up @@ -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
Expand Down

0 comments on commit d35eabd

Please sign in to comment.