>From 12972c3292f2a32c57e5308d1ca9e7edc300c8d0 Mon Sep 17 00:00:00 2001 From: Kooda Date: Wed, 2 May 2018 14:27:36 +0200 Subject: [PATCH] Make the test suite aware of the programs prefix and suffix This fixes #1458 --- rules.make | 3 +++ tests/csc-tests.scm | 4 +++- tests/posix-tests.scm | 6 ++++-- tests/programs-path.scm | 9 +++++++++ tests/runtests.bat | 14 +++++++------- tests/runtests.sh | 18 +++++++++--------- 6 files changed, 35 insertions(+), 19 deletions(-) create mode 100644 tests/programs-path.scm diff --git a/rules.make b/rules.make index 808f374b..dbe82be9 100644 --- a/rules.make +++ b/rules.make @@ -962,6 +962,9 @@ testclean: .PHONY: check +export PROGRAM_PREFIX +export PROGRAM_SUFFIX + check: $(TARGETS) ifndef WINDOWS_SHELL cd tests; sh runtests.sh diff --git a/tests/csc-tests.scm b/tests/csc-tests.scm index 1fa281dc..6eba87b7 100644 --- a/tests/csc-tests.scm +++ b/tests/csc-tests.scm @@ -6,6 +6,8 @@ (chicken process-context) (chicken string)) +(include "programs-path.scm") + (define (realpath x) (normalize-pathname (make-pathname (current-directory) x))) @@ -13,7 +15,7 @@ (system* (string-intersperse (cons (realpath x) args)))) (define (csc . args) - (apply run "../csc" "-v" "-I.." "-compiler" (realpath "../chicken") "-libdir" ".." args)) + (apply run csc-path "-v" "-I.." "-compiler" (realpath chicken-path) "-libdir" ".." args)) (csc "null.scm" "-t") (assert (file-exists? "null.c")) diff --git a/tests/posix-tests.scm b/tests/posix-tests.scm index e3ccbb69..807730e6 100644 --- a/tests/posix-tests.scm +++ b/tests/posix-tests.scm @@ -6,6 +6,8 @@ (chicken process-context) (chicken memory representation)) +(include "programs-path.scm") + (define-syntax assert-error (syntax-rules () ((_ expr) @@ -39,13 +41,13 @@ (assert-error (process-execute "false" '("123\x00456") '("foo\x00bar" "blabla") '("lalala" "qux\x00mooh"))) (receive (in out pid) - (process "../csi" '("-n" "-I" ".." "-e" + (process csi-path '("-n" "-I" ".." "-e" "(write 'err (current-error-port)) (write 'ok)")) (assert (equal? 'ok (read in))) (newline (current-error-port))) (receive (in out pid err) - (process* "../csi" '("-n" "-I" ".." "-e" + (process* csi-path '("-n" "-I" ".." "-e" "(write 'err (current-error-port)) (write 'ok)")) (assert (equal? 'ok (read in))) (assert (equal? 'err (read err)))) diff --git a/tests/programs-path.scm b/tests/programs-path.scm new file mode 100644 index 00000000..5a5935df --- /dev/null +++ b/tests/programs-path.scm @@ -0,0 +1,9 @@ +(define (executable-path exe) + (string-append "../" + (or (get-environment-variable "PROGRAM_PREFIX") "") + exe + (or (get-environment-variable "PROGRAM_SUFFIX") ""))) + +(define chicken-path (executable-path "chicken")) +(define csc-path (executable-path "csc")) +(define csi-path (executable-path "csi")) diff --git a/tests/runtests.bat b/tests/runtests.bat index 67fd2e6f..2bd8314c 100644 --- a/tests/runtests.bat +++ b/tests/runtests.bat @@ -5,8 +5,8 @@ setlocal enableextensions set TEST_DIR=%cd% -set CHICKEN=..\chicken -set CHICKEN_PROFILE=..\chicken-profile +set CHICKEN=..\%PROGRAM_PREFIX%chicken%PROGRAM_SUFFIX% +set CHICKEN_PROFILE=..\%PROGRAM_PREFIX%chicken-profile%PROGRAM_SUFFIX% set CHICKEN_INSTALL_REPOSITORY=%TEST_DIR%\test-repository set CHICKEN_REPOSITORY_PATH=%TEST_DIR%\..;%CHICKEN_INSTALL_REPOSITORY% set PATH=%TEST_DIR%\..;%PATH% @@ -17,10 +17,10 @@ set FCBUFSIZE=500 set TYPESDB=..\types.db set COMPILE_OPTIONS=-v -compiler %CHICKEN% -I%TEST_DIR%/.. -L%TEST_DIR%/.. -include-path %TEST_DIR%/.. -libdir %TEST_DIR%/.. -set compile=..\csc %COMPILE_OPTIONS% -o a.out -types %TYPESDB% -ignore-repository -set compile_r=..\csc %COMPILE_OPTIONS% -o a.out -set compile_s=..\csc %COMPILE_OPTIONS% -s -types %TYPESDB% -ignore-repository -set interpret=..\csi -n -include-path %TEST_DIR%/.. +set compile=..\%PROGRAM_PREFIX%csc%PROGRAM_SUFFIX% %COMPILE_OPTIONS% -o a.out -types %TYPESDB% -ignore-repository +set compile_r=..\%PROGRAM_PREFIX%csc%PROGRAM_SUFFIX% %COMPILE_OPTIONS% -o a.out +set compile_s=..\%PROGRAM_PREFIX%csc%PROGRAM_SUFFIX% %COMPILE_OPTIONS% -s -types %TYPESDB% -ignore-repository +set interpret=..\%PROGRAM_PREFIX%csi%PROGRAM_SUFFIX% -n -include-path %TEST_DIR%/.. del /f /q /s *.exe *.so *.o *.import.* ..\foo.import.* %CHICKEN_INSTALL_REPOSITORY% rmdir /q /s %CHICKEN_INSTALL_REPOSITORY% @@ -503,7 +503,7 @@ if errorlevel 1 exit /b 1 echo ======================================== compiler/nursery stress test ... for %%s in (100000 120000 200000 250000 300000 350000 400000 450000 500000) do ( echo %%s - ..\chicken -ignore-repository ..\port.scm -:s%%s -output-file tmp.c -include-path %TEST_DIR%/.. + %CHICKEN% -ignore-repository ..\port.scm -:s%%s -output-file tmp.c -include-path %TEST_DIR%/.. if errorlevel 1 exit /b 1 ) diff --git a/tests/runtests.sh b/tests/runtests.sh index 04a8ade3..e41c6050 100755 --- a/tests/runtests.sh +++ b/tests/runtests.sh @@ -33,10 +33,10 @@ case `uname` in DIFF_OPTS=-bu ;; esac -CHICKEN=${TEST_DIR}/../chicken -CHICKEN_PROFILE=${TEST_DIR}/../chicken-profile -CHICKEN_INSTALL=${TEST_DIR}/../chicken-install -CHICKEN_UNINSTALL=${TEST_DIR}/../chicken-uninstall +CHICKEN=${TEST_DIR}/../${PROGRAM_PREFIX}chicken${PROGRAM_SUFFIX} +CHICKEN_PROFILE=${TEST_DIR}/../${PROGRAM_PREFIX}chicken-profile${PROGRAM_SUFFIX} +CHICKEN_INSTALL=${TEST_DIR}/../${PROGRAM_PREFIX}chicken-install${PROGRAM_SUFFIX} +CHICKEN_UNINSTALL=${TEST_DIR}/../${PROGRAM_PREFIX}chicken-uninstall${PROGRAM_SUFFIX} CHICKEN_INSTALL_REPOSITORY=${TEST_DIR}/test-repository CHICKEN_REPOSITORY_PATH="${TEST_DIR}/..${PATH_SEP}${CHICKEN_INSTALL_REPOSITORY}" @@ -45,10 +45,10 @@ export CHICKEN_INSTALL_REPOSITORY CHICKEN_REPOSITORY_PATH TYPESDB=../types.db COMPILE_OPTIONS="-v -compiler ${CHICKEN} -I${TEST_DIR}/.. -L${TEST_DIR}/.. -include-path ${TEST_DIR}/.. -libdir ${TEST_DIR}/.. -rpath ${TEST_DIR}/.." -compile="../csc ${COMPILE_OPTIONS} -o a.out -types ${TYPESDB} -ignore-repository" -compile_r="../csc ${COMPILE_OPTIONS} -o a.out" -compile_s="../csc ${COMPILE_OPTIONS} -s -types ${TYPESDB} -ignore-repository" -interpret="../csi -n -include-path ${TEST_DIR}/.." +compile="../${PROGRAM_PREFIX}csc${PROGRAM_SUFFIX} ${COMPILE_OPTIONS} -o a.out -types ${TYPESDB} -ignore-repository" +compile_r="../${PROGRAM_PREFIX}csc${PROGRAM_SUFFIX} ${COMPILE_OPTIONS} -o a.out" +compile_s="../${PROGRAM_PREFIX}csc${PROGRAM_SUFFIX} ${COMPILE_OPTIONS} -s -types ${TYPESDB} -ignore-repository" +interpret="../${PROGRAM_PREFIX}csi${PROGRAM_SUFFIX} -n -include-path ${TEST_DIR}/.." time=time # Check for a "time" command, since some systems don't ship with a @@ -396,7 +396,7 @@ $interpret -bnq test-glob.scm echo "======================================== compiler/nursery stress test ..." for s in 100000 120000 200000 250000 300000 350000 400000 450000 500000; do echo " $s" - ../chicken -ignore-repository ../port.scm -:s$s -output-file tmp.c -include-path ${TEST_DIR}/.. + ${CHICKEN} -ignore-repository ../port.scm -:s$s -output-file tmp.c -include-path ${TEST_DIR}/.. done echo "======================================== heap literal stress test ..." -- 2.17.0