~ chicken-core (chicken-5) d3906284f4c10435e840860d2231774cdc9ddc34


commit d3906284f4c10435e840860d2231774cdc9ddc34
Author:     Kooda <kooda@upyum.com>
AuthorDate: Wed May 2 14:27:36 2018 +0200
Commit:     Evan Hanson <evhan@foldling.org>
CommitDate: Tue May 29 20:49:00 2018 +1200

    Make the test suite aware of the programs prefix and suffix
    
    This fixes #1458.
    
    Signed-off-by: Evan Hanson <evhan@foldling.org>

diff --git a/distribution/manifest b/distribution/manifest
index 55e2f286..2e8f0b77 100644
--- a/distribution/manifest
+++ b/distribution/manifest
@@ -225,6 +225,7 @@ tests/test-queue.scm
 tests/functor-tests.scm
 tests/square-functor.scm
 tests/use-square-functor.scm
+tests/programs-path.scm
 tests/pp-test.scm
 tests/finalizer-error-test.scm
 tests/reverser/tags/1.0/reverser.meta
diff --git a/rules.make b/rules.make
index 808f374b..1c07e73e 100644
--- a/rules.make
+++ b/rules.make
@@ -960,7 +960,10 @@ testclean:
 
 # run tests
 
-.PHONY: check 
+.PHONY: check
+
+export PROGRAM_PREFIX
+export PROGRAM_SUFFIX
 
 check: $(TARGETS)
 ifndef WINDOWS_SHELL
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..1acfc756
--- /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 100e2f48..f6856ccc 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%
@@ -507,7 +507,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 35cd9920..a9e8a5b1 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
@@ -399,7 +399,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 ..."
Trap