Ticket #1057: 0001-Add-a-few-hooks-and-hacks-to-make-tests-work-without.patch

File 0001-Add-a-few-hooks-and-hacks-to-make-tests-work-without.patch, 6.9 KB (added by sjamaan, 9 years ago)

Update to work under cygwin; remove the nasty special-casing we do to force the DLL into the current dir, in favor of relying on the OS-native way of loading DLLs from another dir: put the thing in $PATH (yuck!)

  • csc.scm

    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 
    966966              TARGET_RUN_LIB_HOME)))
    967967
    968968(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)))))
    975976
    976977(define (copy-libraries targetdir)
    977978  (let ((lib (make-pathname
  • tests/runtests.sh

    diff --git a/tests/runtests.sh b/tests/runtests.sh
    index 7065564..29e55c8 100755
    a b OS_NAME=`uname -s` 
    1111DYLD_LIBRARY_PATH=${TEST_DIR}/..
    1212LD_LIBRARY_PATH=${TEST_DIR}/..
    1313LIBRARY_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)
     16PATH=${TEST_DIR}/..:${PATH}
     17export DYLD_LIBRARY_PATH LD_LIBRARY_PATH LIBRARY_PATH PATH
    1518
    1619case `uname` in
    1720        AIX)
    CHICKEN_INSTALL=${TEST_DIR}/../chicken-install 
    4245CHICKEN_UNINSTALL=${TEST_DIR}/../chicken-uninstall
    4346ASMFLAGS=
    4447FAST_OPTIONS="-O5 -d0 -b -disable-interrupts"
     48COMPILE_OPTIONS="-compiler ${TEST_DIR}/../chicken -v -I${TEST_DIR}/.. -L${TEST_DIR}/.. -include-path ${TEST_DIR}/.."
     49SETUP_PREFIX="-e (use setup-api)"
     50SETUP_PREFIX="${SETUP_PREFIX} -e (register-program \"csc\" \"${TEST_DIR}/../csc\")"
     51SETUP_PREFIX="${SETUP_PREFIX} -e (register-program \"chicken\" \"${TEST_DIR}/../chicken\")"
     52SETUP_PREFIX="${SETUP_PREFIX} -e (register-program \"csi\" \"${TEST_DIR}/../csi\")"
    4553
    4654TYPESDB=../types.db
    4755cp $TYPESDB test-repository/types.db
    if test -n "$MSYSTEM"; then 
    5462fi
    5563
    5664
    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"
     65compile="../csc -types ${TYPESDB} -ignore-repository ${COMPILE_OPTIONS} -o a.out"
    6566compile2="../csc -compiler $CHICKEN -v -I.. -L.. -include-path .."
    66 compile_s="../csc -s -compiler $CHICKEN -v -I.. -L.. -include-path .."
     67compile_s="../csc -s -types ${TYPESDB} -ignore-repository ${COMPILE_OPTIONS} -v -I.. -L.. -include-path .."
    6768interpret="../csi -n -include-path .."
    6869
    6970rm -f *.exe *.so *.o *.import.* a.out ../foo.import.*
    $compile inlining-tests.scm -optimize-level 3 
    8081echo "======================================== scrutiny tests ..."
    8182$compile typematch-tests.scm -specialize -w
    8283./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
    8485
    8586# this is sensitive to gensym-names, so make it optional
    8687if test \! -f scrutiny.expected; then
    fi 
    8990
    9091diff $DIFF_OPTS scrutiny.expected scrutiny.out
    9192
    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
    9394
    9495# this is sensitive to gensym-names, so make it optional
    9596if test \! -f scrutiny-2.expected; then
    fi 
    9899
    99100diff $DIFF_OPTS scrutiny-2.expected scrutiny-2.out
    100101
    101 $compile scrutiny-tests-3.scm -specialize -block -ignore-repository -types $TYPESDB
     102$compile scrutiny-tests-3.scm -specialize -block
    102103./a.out
    103104
    104 $compile scrutiny-tests-strict.scm -strict-types -specialize -ignore-repository -types $TYPESDB
     105$compile scrutiny-tests-strict.scm -strict-types -specialize
    105106./a.out
    106107
    107108echo "======================================== specialization tests ..."
    $interpret -bnq test-glob.scm 
    354355echo "======================================== compiler/nursery stress test ..."
    355356for s in 100000 120000 200000 250000 300000 350000 400000 450000 500000; do
    356357    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 ..
    358359done
    359360
    360361echo "======================================== symbol-GC tests ..."
    rm -fr rev-app rev-app-2 reverser/*.import.* reverser/*.so 
    400401
    401402echo "======================================== reinstall tests"
    402403CHICKEN_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
     404CHICKEN_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
    405407CHICKEN_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
     408CHICKEN_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
    408411CHICKEN_REPOSITORY=$CHICKEN_REPOSITORY $interpret -bnq rev-app.scm 1.0
    409412
    410413if test $OS_NAME != AIX -a $OS_NAME != SunOS -a $OS_NAME != GNU; then
    411414        echo "======================================== deployment tests"
    412415        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
    416422        unset LD_LIBRARY_PATH DYLD_LIBRARY_PATH CHICKEN_REPOSITORY
    417423        # An absolute path is required on NetBSD with $ORIGIN, hence `pwd`
    418424        `pwd`/rev-app/rev-app 1.1