From cdcd7e999daca1d48033dcaa9ac3dbc9831278f5 Mon Sep 17 00:00:00 2001
From: Peter Bex <peter.bex@xs4all.nl>
Date: Wed, 12 Mar 2014 19:26:40 +0100
Subject: [PATCH] Add a few hooks and hacks to make tests work without having
to install CHICKEN (fixes #1057)
---
csc.scm | 13 +++++----
tests/runtests.sh | 79 +++++++++++++++++++++++++++++------------------------
2 files changed, 50 insertions(+), 42 deletions(-)
diff --git a/csc.scm b/csc.scm
index a39c3f5..f31b3bf 100644
|
a
|
b
|
EOF
|
| 966 | 966 | TARGET_RUN_LIB_HOME))) |
| 967 | 967 | |
| 968 | 968 | (define (target-lib-path) |
| 969 | | (let ((tdir TARGET_LIB_HOME)) |
| 970 | | (if (and (not (string=? tdir "")) |
| 971 | | cross-chicken |
| 972 | | (not host-mode)) |
| 973 | | tdir |
| 974 | | (lib-path)))) |
| | 969 | (or (get-environment-variable "TARGET_LIB_PATH") |
| | 970 | (let ((tdir TARGET_LIB_HOME)) |
| | 971 | (if (and (not (string=? tdir "")) |
| | 972 | cross-chicken |
| | 973 | (not host-mode)) |
| | 974 | tdir |
| | 975 | (lib-path))))) |
| 975 | 976 | |
| 976 | 977 | (define (copy-libraries targetdir) |
| 977 | 978 | (let ((lib (make-pathname |
diff --git a/tests/runtests.sh b/tests/runtests.sh
index 7065564..6ea1730 100755
|
a
|
b
|
|
| 6 | 6 | |
| 7 | 7 | |
| 8 | 8 | set -e |
| 9 | | TEST_DIR=`pwd` |
| | 9 | if test -z "$MSYSTEM"; then |
| | 10 | TEST_DIR=`pwd` |
| | 11 | else |
| | 12 | # Use Windows-native format with drive letters instead of awkward |
| | 13 | # MSYS /c/blabla "pseudo-paths" which break when used in syscalls. |
| | 14 | TEST_DIR=`pwd -W` |
| | 15 | fi |
| 10 | 16 | OS_NAME=`uname -s` |
| 11 | 17 | DYLD_LIBRARY_PATH=${TEST_DIR}/.. |
| 12 | 18 | LD_LIBRARY_PATH=${TEST_DIR}/.. |
| 13 | 19 | LIBRARY_PATH=${TEST_DIR}/..:${LIBRARY_PATH} |
| 14 | | export DYLD_LIBRARY_PATH LD_LIBRARY_PATH LIBRARY_PATH |
| | 20 | # Cygwin uses LD_LIBRARY_PATH for dlopen(), but the dlls linked into |
| | 21 | # the binary are read by the OS itself, which uses $PATH (mingw too) |
| | 22 | # Oddly, prefixing .. with ${TEST_DIR}/ does _not_ work on mingw! |
| | 23 | PATH=..:${PATH} |
| | 24 | export DYLD_LIBRARY_PATH LD_LIBRARY_PATH LIBRARY_PATH PATH |
| 15 | 25 | |
| 16 | 26 | case `uname` in |
| 17 | 27 | AIX) |
| … |
… |
for x in setup-api.so setup-api.import.so setup-download.so \
|
| 37 | 47 | done |
| 38 | 48 | |
| 39 | 49 | CHICKEN_REPOSITORY=${TEST_DIR}/test-repository |
| 40 | | CHICKEN=../chicken |
| | 50 | CHICKEN=${TEST_DIR}/../chicken |
| 41 | 51 | CHICKEN_INSTALL=${TEST_DIR}/../chicken-install |
| 42 | 52 | CHICKEN_UNINSTALL=${TEST_DIR}/../chicken-uninstall |
| 43 | 53 | ASMFLAGS= |
| 44 | 54 | FAST_OPTIONS="-O5 -d0 -b -disable-interrupts" |
| | 55 | COMPILE_OPTIONS="-compiler ${TEST_DIR}/../chicken -v -I${TEST_DIR}/.. -L${TEST_DIR}/.. -include-path ${TEST_DIR}/.." |
| | 56 | |
| | 57 | TEST_DIR_SEXPR=`../csi -n -include-path .. -e "(use posix) (write (current-directory))"` |
| | 58 | SETUP_PREFIX="-e (use files setup-api)" |
| | 59 | SETUP_PREFIX="${SETUP_PREFIX} -e (register-program \"csc\" (make-pathname ${TEST_DIR_SEXPR} \"../csc\"))" |
| | 60 | SETUP_PREFIX="${SETUP_PREFIX} -e (register-program \"chicken\" (make-pathname ${TEST_DIR_SEXPR} \"../chicken\"))" |
| | 61 | SETUP_PREFIX="${SETUP_PREFIX} -e (register-program \"csi\" (make-pathname ${TEST_DIR_SEXPR} \"../csi\"))" |
| 45 | 62 | |
| 46 | 63 | TYPESDB=../types.db |
| 47 | 64 | cp $TYPESDB test-repository/types.db |
| 48 | 65 | |
| 49 | | if test -n "$MSYSTEM"; then |
| 50 | | CHICKEN="..\\chicken.exe" |
| 51 | | ASMFLAGS=-Wa,-w |
| 52 | | # make compiled tests use proper library on Windows |
| 53 | | cp ../lib*chicken*.dll . |
| 54 | | fi |
| 55 | | |
| 56 | | |
| 57 | | # for cygwin |
| 58 | | if test -f ../cygchicken-0.dll; then |
| 59 | | cp ../cygchicken-0.dll . |
| 60 | | cp ../cygchicken-0.dll reverser/tags/1.0 |
| 61 | | mv ../cygchicken-0.dll ../cygchicken-0.dll_ |
| 62 | | fi |
| 63 | | |
| 64 | | compile="../csc -compiler $CHICKEN -v -I.. -L.. -include-path .. -o a.out" |
| 65 | | compile2="../csc -compiler $CHICKEN -v -I.. -L.. -include-path .." |
| 66 | | compile_s="../csc -s -compiler $CHICKEN -v -I.. -L.. -include-path .." |
| 67 | | interpret="../csi -n -include-path .." |
| | 66 | compile="../csc -types ${TYPESDB} -ignore-repository ${COMPILE_OPTIONS} -o a.out" |
| | 67 | compile2="../csc -compiler $CHICKEN -v -I${TEST_DIR}/.. -L${TEST_DIR}.. -include-path ${TEST_DIR}/.." |
| | 68 | compile_s="../csc -s -types ${TYPESDB} -ignore-repository ${COMPILE_OPTIONS} -v -I${TEST_DIR}/.. -L${TEST_DIR}/.. -include-path ${TEST_DIR}/.." |
| | 69 | interpret="../csi -n -include-path ${TEST_DIR}/.." |
| 68 | 70 | |
| 69 | 71 | rm -f *.exe *.so *.o *.import.* a.out ../foo.import.* |
| 70 | 72 | |
| … |
… |
$compile inlining-tests.scm -optimize-level 3
|
| 80 | 82 | echo "======================================== scrutiny tests ..." |
| 81 | 83 | $compile typematch-tests.scm -specialize -w |
| 82 | 84 | ./a.out |
| 83 | | $compile scrutiny-tests.scm -A -scrutinize -ignore-repository -types $TYPESDB 2>scrutiny.out -verbose |
| | 85 | $compile scrutiny-tests.scm -A -scrutinize 2>scrutiny.out -verbose |
| 84 | 86 | |
| 85 | 87 | # this is sensitive to gensym-names, so make it optional |
| 86 | 88 | if test \! -f scrutiny.expected; then |
| … |
… |
fi
|
| 89 | 91 | |
| 90 | 92 | diff $DIFF_OPTS scrutiny.expected scrutiny.out |
| 91 | 93 | |
| 92 | | $compile scrutiny-tests-2.scm -A -scrutinize -analyze-only -ignore-repository -types $TYPESDB 2>scrutiny-2.out -verbose |
| | 94 | $compile scrutiny-tests-2.scm -A -scrutinize -analyze-only 2>scrutiny-2.out -verbose |
| 93 | 95 | |
| 94 | 96 | # this is sensitive to gensym-names, so make it optional |
| 95 | 97 | if test \! -f scrutiny-2.expected; then |
| … |
… |
fi
|
| 98 | 100 | |
| 99 | 101 | diff $DIFF_OPTS scrutiny-2.expected scrutiny-2.out |
| 100 | 102 | |
| 101 | | $compile scrutiny-tests-3.scm -specialize -block -ignore-repository -types $TYPESDB |
| | 103 | $compile scrutiny-tests-3.scm -specialize -block |
| 102 | 104 | ./a.out |
| 103 | 105 | |
| 104 | | $compile scrutiny-tests-strict.scm -strict-types -specialize -ignore-repository -types $TYPESDB |
| | 106 | $compile scrutiny-tests-strict.scm -strict-types -specialize |
| 105 | 107 | ./a.out |
| 106 | 108 | |
| 107 | 109 | echo "======================================== specialization tests ..." |
| … |
… |
$interpret -i -s r7rs-tests.scm
|
| 264 | 266 | |
| 265 | 267 | |
| 266 | 268 | echo "======================================== module tests ..." |
| 267 | | $interpret -include-path .. -s module-tests.scm |
| 268 | | $interpret -include-path .. -s module-tests-2.scm |
| | 269 | $interpret -include-path ${TEST_DIR}/.. -s module-tests.scm |
| | 270 | $interpret -include-path ${TEST_DIR}/.. -s module-tests-2.scm |
| 269 | 271 | |
| 270 | 272 | echo "======================================== module tests (compiled) ..." |
| 271 | 273 | $compile module-tests-compiled.scm |
| … |
… |
$interpret -bnq test-glob.scm
|
| 354 | 356 | echo "======================================== compiler/nursery stress test ..." |
| 355 | 357 | for s in 100000 120000 200000 250000 300000 350000 400000 450000 500000; do |
| 356 | 358 | echo " $s" |
| 357 | | ../chicken ../utils.scm -:s$s -output-file tmp.c -include-path .. |
| | 359 | ../chicken -ignore-repository ../utils.scm -:s$s -output-file tmp.c -include-path ${TEST_DIR}/.. |
| 358 | 360 | done |
| 359 | 361 | |
| 360 | 362 | echo "======================================== symbol-GC tests ..." |
| … |
… |
rm -fr rev-app rev-app-2 reverser/*.import.* reverser/*.so
|
| 400 | 402 | |
| 401 | 403 | echo "======================================== reinstall tests" |
| 402 | 404 | CHICKEN_REPOSITORY=$CHICKEN_REPOSITORY $CHICKEN_UNINSTALL -force reverser |
| 403 | | CHICKEN_REPOSITORY=$CHICKEN_REPOSITORY $CHICKEN_INSTALL -t local -l $TEST_DIR reverser:1.0 \ |
| 404 | | -csi ${TEST_DIR}/../csi |
| | 405 | CHICKEN_REPOSITORY=$CHICKEN_REPOSITORY CSC_OPTIONS=$COMPILE_OPTIONS \ |
| | 406 | CSI_OPTIONS=$SETUP_PREFIX $CHICKEN_INSTALL -t local -l $TEST_DIR \ |
| | 407 | -csi ${TEST_DIR}/../csi reverser:1.0 |
| 405 | 408 | CHICKEN_REPOSITORY=$CHICKEN_REPOSITORY $interpret -bnq rev-app.scm 1.0 |
| 406 | | CHICKEN_REPOSITORY=$CHICKEN_REPOSITORY $CHICKEN_INSTALL -t local -l $TEST_DIR -reinstall -force \ |
| 407 | | -csi ${TEST_DIR}/../csi |
| | 409 | CHICKEN_REPOSITORY=$CHICKEN_REPOSITORY CSC_OPTIONS=$COMPILE_OPTIONS \ |
| | 410 | CSI_OPTIONS=$SETUP_PREFIX $CHICKEN_INSTALL -t local -l $TEST_DIR \ |
| | 411 | -reinstall -force -csi ${TEST_DIR}/../csi |
| 408 | 412 | CHICKEN_REPOSITORY=$CHICKEN_REPOSITORY $interpret -bnq rev-app.scm 1.0 |
| 409 | 413 | |
| 410 | 414 | if test $OS_NAME != AIX -a $OS_NAME != SunOS -a $OS_NAME != GNU; then |
| 411 | 415 | echo "======================================== deployment tests" |
| 412 | 416 | mkdir rev-app |
| 413 | | CHICKEN_REPOSITORY=$CHICKEN_REPOSITORY $CHICKEN_INSTALL -t local -l $TEST_DIR reverser |
| 414 | | CHICKEN_REPOSITORY=$CHICKEN_REPOSITORY $compile2 -deploy rev-app.scm |
| 415 | | CHICKEN_REPOSITORY=$CHICKEN_REPOSITORY $CHICKEN_INSTALL -deploy -prefix rev-app -t local -l $TEST_DIR reverser |
| | 417 | TARGET_LIB_PATH=${TEST_DIR}/.. CHICKEN_REPOSITORY=$CHICKEN_REPOSITORY CSC_OPTIONS=$COMPILE_OPTIONS \ |
| | 418 | CSI_OPTIONS=$SETUP_PREFIX $CHICKEN_INSTALL -csi ${TEST_DIR}/../csi -t local -l $TEST_DIR reverser |
| | 419 | TARGET_LIB_PATH=${TEST_DIR}/.. CHICKEN_REPOSITORY=$CHICKEN_REPOSITORY CSC_OPTIONS=$COMPILE_OPTIONS \ |
| | 420 | CSI_OPTIONS=$SETUP_PREFIX $compile2 -deploy rev-app.scm |
| | 421 | TARGET_LIB_PATH=${TEST_DIR}/.. CHICKEN_REPOSITORY=$CHICKEN_REPOSITORY CSC_OPTIONS=$COMPILE_OPTIONS \ |
| | 422 | CSI_OPTIONS=$SETUP_PREFIX $CHICKEN_INSTALL -csi ${TEST_DIR}/../csi -deploy -prefix rev-app -t local -l $TEST_DIR reverser |
| 416 | 423 | unset LD_LIBRARY_PATH DYLD_LIBRARY_PATH CHICKEN_REPOSITORY |
| 417 | 424 | # An absolute path is required on NetBSD with $ORIGIN, hence `pwd` |
| 418 | 425 | `pwd`/rev-app/rev-app 1.1 |