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

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

Fixed for mingw-msys (ugh)

  • csc.scm

    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 
    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..6ea1730 100755
    a b  
    66
    77
    88set -e
    9 TEST_DIR=`pwd`
     9if test -z "$MSYSTEM"; then
     10    TEST_DIR=`pwd`
     11else
     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`
     15fi
    1016OS_NAME=`uname -s`
    1117DYLD_LIBRARY_PATH=${TEST_DIR}/..
    1218LD_LIBRARY_PATH=${TEST_DIR}/..
    1319LIBRARY_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!
     23PATH=..:${PATH}
     24export DYLD_LIBRARY_PATH LD_LIBRARY_PATH LIBRARY_PATH PATH
    1525
    1626case `uname` in
    1727        AIX)
    for x in setup-api.so setup-api.import.so setup-download.so \ 
    3747done
    3848
    3949CHICKEN_REPOSITORY=${TEST_DIR}/test-repository
    40 CHICKEN=../chicken
     50CHICKEN=${TEST_DIR}/../chicken
    4151CHICKEN_INSTALL=${TEST_DIR}/../chicken-install
    4252CHICKEN_UNINSTALL=${TEST_DIR}/../chicken-uninstall
    4353ASMFLAGS=
    4454FAST_OPTIONS="-O5 -d0 -b -disable-interrupts"
     55COMPILE_OPTIONS="-compiler ${TEST_DIR}/../chicken -v -I${TEST_DIR}/.. -L${TEST_DIR}/.. -include-path ${TEST_DIR}/.."
     56
     57TEST_DIR_SEXPR=`../csi -n -include-path .. -e "(use posix) (write (current-directory))"`
     58SETUP_PREFIX="-e (use files setup-api)"
     59SETUP_PREFIX="${SETUP_PREFIX} -e (register-program \"csc\" (make-pathname ${TEST_DIR_SEXPR} \"../csc\"))"
     60SETUP_PREFIX="${SETUP_PREFIX} -e (register-program \"chicken\" (make-pathname ${TEST_DIR_SEXPR} \"../chicken\"))"
     61SETUP_PREFIX="${SETUP_PREFIX} -e (register-program \"csi\" (make-pathname ${TEST_DIR_SEXPR} \"../csi\"))"
    4562
    4663TYPESDB=../types.db
    4764cp $TYPESDB test-repository/types.db
    4865
    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 .."
     66compile="../csc -types ${TYPESDB} -ignore-repository ${COMPILE_OPTIONS} -o a.out"
     67compile2="../csc -compiler $CHICKEN -v -I${TEST_DIR}/.. -L${TEST_DIR}.. -include-path ${TEST_DIR}/.."
     68compile_s="../csc -s -types ${TYPESDB} -ignore-repository ${COMPILE_OPTIONS} -v -I${TEST_DIR}/.. -L${TEST_DIR}/.. -include-path ${TEST_DIR}/.."
     69interpret="../csi -n -include-path ${TEST_DIR}/.."
    6870
    6971rm -f *.exe *.so *.o *.import.* a.out ../foo.import.*
    7072
    $compile inlining-tests.scm -optimize-level 3 
    8082echo "======================================== scrutiny tests ..."
    8183$compile typematch-tests.scm -specialize -w
    8284./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
    8486
    8587# this is sensitive to gensym-names, so make it optional
    8688if test \! -f scrutiny.expected; then
    fi 
    8991
    9092diff $DIFF_OPTS scrutiny.expected scrutiny.out
    9193
    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
    9395
    9496# this is sensitive to gensym-names, so make it optional
    9597if test \! -f scrutiny-2.expected; then
    fi 
    98100
    99101diff $DIFF_OPTS scrutiny-2.expected scrutiny-2.out
    100102
    101 $compile scrutiny-tests-3.scm -specialize -block -ignore-repository -types $TYPESDB
     103$compile scrutiny-tests-3.scm -specialize -block
    102104./a.out
    103105
    104 $compile scrutiny-tests-strict.scm -strict-types -specialize -ignore-repository -types $TYPESDB
     106$compile scrutiny-tests-strict.scm -strict-types -specialize
    105107./a.out
    106108
    107109echo "======================================== specialization tests ..."
    $interpret -i -s r7rs-tests.scm 
    264266
    265267
    266268echo "======================================== 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
    269271
    270272echo "======================================== module tests (compiled) ..."
    271273$compile module-tests-compiled.scm
    $interpret -bnq test-glob.scm 
    354356echo "======================================== compiler/nursery stress test ..."
    355357for s in 100000 120000 200000 250000 300000 350000 400000 450000 500000; do
    356358    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}/..
    358360done
    359361
    360362echo "======================================== symbol-GC tests ..."
    rm -fr rev-app rev-app-2 reverser/*.import.* reverser/*.so 
    400402
    401403echo "======================================== reinstall tests"
    402404CHICKEN_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
     405CHICKEN_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
    405408CHICKEN_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
     409CHICKEN_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
    408412CHICKEN_REPOSITORY=$CHICKEN_REPOSITORY $interpret -bnq rev-app.scm 1.0
    409413
    410414if test $OS_NAME != AIX -a $OS_NAME != SunOS -a $OS_NAME != GNU; then
    411415        echo "======================================== deployment tests"
    412416        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
    416423        unset LD_LIBRARY_PATH DYLD_LIBRARY_PATH CHICKEN_REPOSITORY
    417424        # An absolute path is required on NetBSD with $ORIGIN, hence `pwd`
    418425        `pwd`/rev-app/rev-app 1.1