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.
This commit is contained in:
Geert Janssens 2019-05-18 14:06:57 +02:00
parent 06bc064379
commit d35eabd636
6 changed files with 20 additions and 7 deletions

View File

@ -32,7 +32,7 @@ function(get_guile_env)
list(APPEND env "GUILE=${GUILE_EXECUTABLE}") list(APPEND env "GUILE=${GUILE_EXECUTABLE}")
if (NOT WIN32) 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() endif()
set(guile_load_paths "") set(guile_load_paths "")
list(APPEND guile_load_paths ${CMAKE_CURRENT_SOURCE_DIR}/mod-foo) 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) set(CMAKE_COMMAND_TMP ${CMAKE_COMMAND} -E env)
endif() endif()
add_test(${_TARGET} ${CMAKE_COMMAND_TMP} 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() get_guile_env()
set_tests_properties(${_TARGET} PROPERTIES ENVIRONMENT "${GUILE_ENV};${ARGN}") set_tests_properties(${_TARGET} PROPERTIES ENVIRONMENT "${GUILE_ENV};${ARGN}")

View File

@ -1,6 +1,6 @@
(use-modules (srfi srfi-64)) (use-modules (srfi srfi-64))
(use-modules (tests srfi64-extras)) (use-modules (tests srfi64-extras))
(load "../html-fonts.scm") (load "html-fonts")
(setlocale LC_ALL "C") (setlocale LC_ALL "C")

View File

@ -43,6 +43,12 @@ if (HAVE_SRFI64)
gnc_add_scheme_tests("${scm_test_with_srfi64_SOURCES}") gnc_add_scheme_tests("${scm_test_with_srfi64_SOURCES}")
if (HAVE_TEXT_PORTS) 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}") gnc_add_scheme_tests("${scm_test_with_textual_ports_SOURCES}")
endif (HAVE_TEXT_PORTS) endif (HAVE_TEXT_PORTS)
endif (HAVE_SRFI64) endif (HAVE_SRFI64)

View File

@ -19,6 +19,13 @@ target_include_directories(gncmod-bar PRIVATE
${GUILE_INCLUDE_DIRS} ${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 set_target_properties(bar gncmod-bar PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${LIBDIR_BUILD}/gnucash/test LIBRARY_OUTPUT_DIRECTORY ${LIBDIR_BUILD}/gnucash/test
ARCHIVE_OUTPUT_DIRECTORY ${LIBDIR_BUILD}/gnucash/test ARCHIVE_OUTPUT_DIRECTORY ${LIBDIR_BUILD}/gnucash/test

View File

@ -27,9 +27,9 @@ target_include_directories(gncmod-baz PRIVATE
gnc_add_scheme_test_targets(scm-mod-baz gnc_add_scheme_test_targets(scm-mod-baz
gnucash/baz.scm gnucash/baz.scm
"tests" "tests/gnucash"
gncmod-baz gncmod-baz
TRUE FALSE
) )
set_target_properties(baz gncmod-baz PROPERTIES set_target_properties(baz gncmod-baz PROPERTIES

View File

@ -21,9 +21,9 @@ target_include_directories(gncmod-foo PRIVATE
gnc_add_scheme_test_targets(scm-mod-foo gnc_add_scheme_test_targets(scm-mod-foo
gnucash/foo.scm gnucash/foo.scm
"tests" "tests/gnucash"
gncmod-foo gncmod-foo
TRUE FALSE
) )
set_target_properties(foo gncmod-foo PROPERTIES set_target_properties(foo gncmod-foo PROPERTIES