From 1de4b4bae3cf1bffdf5a748ff7464ba06d113839 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 | 50 ++++++++++++++++++++++++++++----------------------
2 files changed, 35 insertions(+), 28 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..29e55c8 100755
a
|
b
|
OS_NAME=`uname -s` |
11 | 11 | DYLD_LIBRARY_PATH=${TEST_DIR}/.. |
12 | 12 | LD_LIBRARY_PATH=${TEST_DIR}/.. |
13 | 13 | LIBRARY_PATH=${TEST_DIR}/..:${LIBRARY_PATH} |
14 | | export DYLD_LIBRARY_PATH LD_LIBRARY_PATH LIBRARY_PATH |
| 14 | # Cygwin uses LD_LIBRARY_PATH for dlopen(), but the dlls linked into |
| 15 | # the binary are read by the OS itself, which uses $PATH (mingw too) |
| 16 | PATH=${TEST_DIR}/..:${PATH} |
| 17 | export DYLD_LIBRARY_PATH LD_LIBRARY_PATH LIBRARY_PATH PATH |
15 | 18 | |
16 | 19 | case `uname` in |
17 | 20 | AIX) |
… |
… |
CHICKEN_INSTALL=${TEST_DIR}/../chicken-install |
42 | 45 | CHICKEN_UNINSTALL=${TEST_DIR}/../chicken-uninstall |
43 | 46 | ASMFLAGS= |
44 | 47 | FAST_OPTIONS="-O5 -d0 -b -disable-interrupts" |
| 48 | COMPILE_OPTIONS="-compiler ${TEST_DIR}/../chicken -v -I${TEST_DIR}/.. -L${TEST_DIR}/.. -include-path ${TEST_DIR}/.." |
| 49 | SETUP_PREFIX="-e (use setup-api)" |
| 50 | SETUP_PREFIX="${SETUP_PREFIX} -e (register-program \"csc\" \"${TEST_DIR}/../csc\")" |
| 51 | SETUP_PREFIX="${SETUP_PREFIX} -e (register-program \"chicken\" \"${TEST_DIR}/../chicken\")" |
| 52 | SETUP_PREFIX="${SETUP_PREFIX} -e (register-program \"csi\" \"${TEST_DIR}/../csi\")" |
45 | 53 | |
46 | 54 | TYPESDB=../types.db |
47 | 55 | cp $TYPESDB test-repository/types.db |
… |
… |
if test -n "$MSYSTEM"; then |
54 | 62 | fi |
55 | 63 | |
56 | 64 | |
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 | compile="../csc -types ${TYPESDB} -ignore-repository ${COMPILE_OPTIONS} -o a.out" |
65 | 66 | compile2="../csc -compiler $CHICKEN -v -I.. -L.. -include-path .." |
66 | | compile_s="../csc -s -compiler $CHICKEN -v -I.. -L.. -include-path .." |
| 67 | compile_s="../csc -s -types ${TYPESDB} -ignore-repository ${COMPILE_OPTIONS} -v -I.. -L.. -include-path .." |
67 | 68 | interpret="../csi -n -include-path .." |
68 | 69 | |
69 | 70 | rm -f *.exe *.so *.o *.import.* a.out ../foo.import.* |
… |
… |
$compile inlining-tests.scm -optimize-level 3 |
80 | 81 | echo "======================================== scrutiny tests ..." |
81 | 82 | $compile typematch-tests.scm -specialize -w |
82 | 83 | ./a.out |
83 | | $compile scrutiny-tests.scm -A -scrutinize -ignore-repository -types $TYPESDB 2>scrutiny.out -verbose |
| 84 | $compile scrutiny-tests.scm -A -scrutinize 2>scrutiny.out -verbose |
84 | 85 | |
85 | 86 | # this is sensitive to gensym-names, so make it optional |
86 | 87 | if test \! -f scrutiny.expected; then |
… |
… |
fi |
89 | 90 | |
90 | 91 | diff $DIFF_OPTS scrutiny.expected scrutiny.out |
91 | 92 | |
92 | | $compile scrutiny-tests-2.scm -A -scrutinize -analyze-only -ignore-repository -types $TYPESDB 2>scrutiny-2.out -verbose |
| 93 | $compile scrutiny-tests-2.scm -A -scrutinize -analyze-only 2>scrutiny-2.out -verbose |
93 | 94 | |
94 | 95 | # this is sensitive to gensym-names, so make it optional |
95 | 96 | if test \! -f scrutiny-2.expected; then |
… |
… |
fi |
98 | 99 | |
99 | 100 | diff $DIFF_OPTS scrutiny-2.expected scrutiny-2.out |
100 | 101 | |
101 | | $compile scrutiny-tests-3.scm -specialize -block -ignore-repository -types $TYPESDB |
| 102 | $compile scrutiny-tests-3.scm -specialize -block |
102 | 103 | ./a.out |
103 | 104 | |
104 | | $compile scrutiny-tests-strict.scm -strict-types -specialize -ignore-repository -types $TYPESDB |
| 105 | $compile scrutiny-tests-strict.scm -strict-types -specialize |
105 | 106 | ./a.out |
106 | 107 | |
107 | 108 | echo "======================================== specialization tests ..." |
… |
… |
$interpret -bnq test-glob.scm |
354 | 355 | echo "======================================== compiler/nursery stress test ..." |
355 | 356 | for s in 100000 120000 200000 250000 300000 350000 400000 450000 500000; do |
356 | 357 | echo " $s" |
357 | | ../chicken ../utils.scm -:s$s -output-file tmp.c -include-path .. |
| 358 | ../chicken -ignore-repository ../utils.scm -:s$s -output-file tmp.c -include-path .. |
358 | 359 | done |
359 | 360 | |
360 | 361 | echo "======================================== symbol-GC tests ..." |
… |
… |
rm -fr rev-app rev-app-2 reverser/*.import.* reverser/*.so |
400 | 401 | |
401 | 402 | echo "======================================== reinstall tests" |
402 | 403 | 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 |
| 404 | CHICKEN_REPOSITORY=$CHICKEN_REPOSITORY CSC_OPTIONS=$COMPILE_OPTIONS \ |
| 405 | CSI_OPTIONS=$SETUP_PREFIX $CHICKEN_INSTALL -t local -l $TEST_DIR \ |
| 406 | -csi ${TEST_DIR}/../csi reverser:1.0 |
405 | 407 | 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 |
| 408 | CHICKEN_REPOSITORY=$CHICKEN_REPOSITORY CSC_OPTIONS=$COMPILE_OPTIONS \ |
| 409 | CSI_OPTIONS=$SETUP_PREFIX $CHICKEN_INSTALL -t local -l $TEST_DIR \ |
| 410 | -reinstall -force -csi ${TEST_DIR}/../csi |
408 | 411 | CHICKEN_REPOSITORY=$CHICKEN_REPOSITORY $interpret -bnq rev-app.scm 1.0 |
409 | 412 | |
410 | 413 | if test $OS_NAME != AIX -a $OS_NAME != SunOS -a $OS_NAME != GNU; then |
411 | 414 | echo "======================================== deployment tests" |
412 | 415 | 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 |
| 416 | TARGET_LIB_PATH=${TEST_DIR}/.. CHICKEN_REPOSITORY=$CHICKEN_REPOSITORY CSC_OPTIONS=$COMPILE_OPTIONS \ |
| 417 | CSI_OPTIONS=$SETUP_PREFIX $CHICKEN_INSTALL -csi ${TEST_DIR}/../csi -t local -l $TEST_DIR reverser |
| 418 | TARGET_LIB_PATH=${TEST_DIR}/.. CHICKEN_REPOSITORY=$CHICKEN_REPOSITORY CSC_OPTIONS=$COMPILE_OPTIONS \ |
| 419 | CSI_OPTIONS=$SETUP_PREFIX $compile2 -deploy rev-app.scm |
| 420 | TARGET_LIB_PATH=${TEST_DIR}/.. CHICKEN_REPOSITORY=$CHICKEN_REPOSITORY CSC_OPTIONS=$COMPILE_OPTIONS \ |
| 421 | CSI_OPTIONS=$SETUP_PREFIX $CHICKEN_INSTALL -csi ${TEST_DIR}/../csi -deploy -prefix rev-app -t local -l $TEST_DIR reverser |
416 | 422 | unset LD_LIBRARY_PATH DYLD_LIBRARY_PATH CHICKEN_REPOSITORY |
417 | 423 | # An absolute path is required on NetBSD with $ORIGIN, hence `pwd` |
418 | 424 | `pwd`/rev-app/rev-app 1.1 |