run-tests.sh 19.4 KB
Newer Older
1
#!/bin/sh -x
Daniel Barlow's avatar
Daniel Barlow committed
2

3
# run-tests {lisp invocation} {scripts-regex}
4 5 6 7
# - read lisp forms one at a time from standard input
# - quit with exit status 0 on getting eof
# - quit with exit status >0 if an unhandled error occurs

8 9 10 11 12 13
usage () {
    echo "$0 [lisp invocation] [scripts-regex]"
    echo " - read lisp forms one at a time from matching scripts"
    echo " - quit with exit status 0 on getting eof"
    echo " - quit with exit status >0 if an unhandled error occurs"
    echo " you need to supply the .script in the second argument"
14
    echo " lisps include abcl, ccl (clozure),"
15 16 17
    echo "    allegro, allegro8, allegromodern, allegromodern8,"
    echo "    allegro_s, allegro8_s, allegromodern_s, allegromodern8_s (SMP variants)"
    echo "    allegro_64, allegro8_64, allegromodern_64, allegromodern8_64 (64-bit variants),"
18
    echo "    allegro_64_s, allegro8_64_s, allegromodern_64_s, allegromodern8_64_s, (SMP, 64-bit variants)"
19 20 21 22 23 24
    echo "    clisp, cmucl, ecl, gcl, sbcl, scl and xcl."
    echo " To configure the script, you may set environment variables to point to the various lisp runtimes."
    echo " Allegro CL is a special case: instead of setting environment variables for the specific runtime"
    echo "   locations, you may simply specify the Allegro install directories using these variables:"
    echo "     ALLEGRO64DIR, ALLEGRO64SDIR (64-bit Allegro and SMP Allegro, respectively), ALLEGRODIR, and"
    echo "     ALLEGROSDIR."
25
    echo "OPTIONS:"
26 27 28
    echo "    -c -- clean load test."
    echo "    -d -- debug mode."
    echo "    -t -- test interactively."
29 30
    echo "    -h -- show this message."
    echo "    -u -- upgrade tests."
31 32 33
    echo "    -l -- load systems tests."
    echo "    -H -- extract all asdf versions to upgrade from."
    echo "    -u -- upgrade tests, we already told you."
34 35
}

36
unset DEBUG_ASDF_TEST upgrade clean_load load_systems test_interactively extract_all
37

38
SHELL=/bin/sh
39
export SHELL DEBUG_ASDF_TEST GCL_ANSI ASDF_OUTPUT_TRANSLATIONS
40

41
if [ -n "$ALLEGRO64DIR" ] ; then
42 43 44 45 46
    ALLEGRO_64=${ALLEGRO64DIR}/alisp
    ALLEGRO8_64=${ALLEGRO64DIR}/alisp8
    ALLEGROMODERN_64=${ALLEGRO64DIR}/mlisp
    ALLEGROMODERN8_64=${ALLEGRO64DIR}/mlisp8
fi
47
if [ -n "$ALLEGRO64SDIR" ] ; then
48 49 50 51 52
    ALLEGRO_64_S=${ALLEGRO64SDIR}/alisp
    ALLEGRO8_64_S=${ALLEGRO64SDIR}/alisp8
    ALLEGROMODERN_64_S=${ALLEGRO64SDIR}/mlisp
    ALLEGROMODERN8_64_S=${ALLEGRO64SDIR}/mlisp8
fi
53
if [ -n "$ALLEGRODIR" ] ; then
54 55 56 57 58
    ALLEGRO=${ALLEGRODIR}/alisp
    ALLEGRO8=${ALLEGRODIR}/alisp8
    ALLEGROMODERN=${ALLEGRODIR}/mlisp
    ALLEGROMODERN8=${ALLEGRODIR}/mlisp8
fi
59
if [ -n "$ALLEGROSDIR" ] ; then
60 61 62 63 64 65 66
    ALLEGRO_S=${ALLEGROSDIR}/alisp
    ALLEGRO8_S=${ALLEGROSDIR}/alisp8
    ALLEGROMODERN_S=${ALLEGROSDIR}/mlisp
    ALLEGROMODERN8_S=${ALLEGROSDIR}/mlisp8
fi


67
while getopts "cdtHulhu" OPTION
68
do
69
    case $OPTION in
70 71 72
        c)
            clean_load=t
            ;;
73
        d)
74
            DEBUG_ASDF_TEST=t
75
            ;;
76 77 78 79 80 81 82
        t)
            test_interactively=t
            ;;
        h)
            usage
            exit 1
            ;;
83
        u)
84
            upgrade=t
85
            ;;
86 87 88
        l)
            load_systems=t
            ;;
89 90 91
        H)
            extract_all=t
            ;;
92 93 94
    esac
done
shift $(($OPTIND - 1))
95

96
if [ x"$1" = "xhelp" ]; then
97 98
    usage
    exit 1
99
fi
100
lisp=${1:-sbcl} ; shift
101

102

103 104 105 106 107 108 109 110 111 112 113 114 115
ECHO () { printf '%s\n' "$*" ;}
ECHOn () { printf '%s' "$*" ;}
DBG () { ECHO "$*" >& 2 ;}
simple_term_p () {
  case "$1" in *[!a-zA-Z0-9-+_,.:=%/]*) return 1 ;; *) return 0 ;; esac
}
kwote0 () { ECHOn "$1" | sed -e "s/\([\\\\\"\$\`]\)/\\\\\\1/g" ;}
kwote1 () { if simple_term_p "$1" ; then ECHOn "$1"
  else ECHOn "\"$(kwote0 "$1")\"" ; fi ;}
kwote () { ( set +x
  k="" ; for i ; do ECHOn "$k" ; kwote1 "$i" ; k=" " ; done ; echo
) }
DO () { kwote "$@" ; "$@" ; }
Francois-Rene Rideau's avatar
Francois-Rene Rideau committed
116

117
do_tests () {
118 119 120 121 122
  if [ -z "$*" ]; then
       scripts="*.script"
  else
       scripts="$*"
  fi
123
  env | grep -i asdf
124
  ## We go through great lengths to avoid " in the command line,
125
  ## the quoting of which many Windows implementations get wrong.
126
  ## While we're at it, we also avoid spaces and backslashes.
127
  ( DO $bcmd $eval '(or`,#.(load(string`|script-support.lisp|))#.(asdf-test::compile-asdf-script))' )
128 129
  if [ $? -ne 0 ] ; then
    echo "Compilation FAILED" >&2
130 131 132
    echo "you can retry compilation with:" >&2
    echo ./test/run-tests.sh $lisp >&2
    echo "or more interactively (and maybe with rlwrap or in emacs), start with:" >&2
133
    echo "$icmd" >&2
134 135
    echo "then copy/paste:" >&2
    echo '(load "test/script-support.lisp") (asdf-test::compile-asdf-script)' >&2
136 137
  else
    echo "Compiled OK" >&2
138 139 140 141
    test_count=0
    test_pass=0
    test_fail=0
    failed_list=""
142 143
    for i in $scripts ;
    do
144 145
      echo "Testing: $i" >&2
      test_count=`expr "$test_count" + 1`
146
      rm -f ~/.cache/common-lisp/"`pwd`"/* || true
147
      if DO $bcmd $eval "'(#.(load(string'|script-support.lisp|))#.(asdf-test::load-asdf)#.(asdf-test::frob-packages)#.(asdf-test:run-test-script'|$i|))" ; then
148
        echo "Using $command, $i passed" >&2
149 150
	test_pass=`expr "$test_pass" + 1`
      else
151
        echo "Using $command, $i failed" >&2
152 153
	test_fail=`expr "$test_fail" + 1`
	failed_list="$failed_list $i"
154 155 156
        echo "you can retry compilation with:" >&2
        echo ./test/run-tests.sh $lisp $i >&2
        echo "or more interactively (and maybe with rlwrap or in emacs), start with:" >&2
157
        echo "(cd test ; $icmd )" >&2
158
        echo "then copy/paste:" >&2
Francois-Rene Rideau's avatar
Francois-Rene Rideau committed
159
        echo "'(#.(load \"script-support.lisp\") #.(asdf-test::da) #.(load-asdf) #.(frob-packages) #.(asdf::with-asdf-cache () (load \"$i\")))" >&2
160
      fi
161 162
      echo >&2
      echo >&2
163 164
    done
    echo >&2
Gary King's avatar
Gary King committed
165
    echo "-#---------------------------------------" >&2
166
    echo "Using $command" >&2
167 168 169 170
    echo "Ran $test_count tests: " >&2
    echo "  $test_pass passing and $test_fail failing" >&2
    if [ $test_fail -eq 0 ] ; then
	echo "all tests apparently successful" >&2
171
        echo success > ../build/results/status
172 173 174
    else
	echo "failing test(s): $failed_list" >&2
    fi
Gary King's avatar
Gary King committed
175
    echo "-#---------------------------------------" >&2
176
    echo >&2
177
  fi
178 179
}

180 181 182
#
# not used currently but leave here for future reference.
#
183 184
case $(uname) in
    CYGWIN*) os=windows ;;
185 186 187
    Darwin) os=macos ;;
    Linux) os=linux ;;
    *) os=unknown ;;
188 189
esac

190 191


192
# terminate on error
193 194
set -e

195
command= flags= nodebug= eval= bcmd= icmd=
196
case "$lisp" in
197 198
  abcl)
    command="${ABCL:-abcl}"
199
    flags="--noinit --nosystem --noinform"
200 201
    eval="--eval"
    ;;
Dave Cooper's avatar
Dave Cooper committed
202
  allegro*)
203 204 205 206 207
    case "$lisp" in
      allegro) command="${ALLEGRO:-alisp}" ;;
      allegro8) command="${ALLEGRO8:-alisp8}" ;;
      allegromodern) command="${ALLEGROMODERN:-mlisp}" ;;
      allegromodern8) command="${ALLEGROMODERN8:-mlisp8}" ;;
208 209 210 211 212 213 214 215 216 217 218 219
      allegro_s) command="${ALLEGRO_S:-alisp_s}" ;;
      allegro8_s) command="${ALLEGRO8_S:-alisp8_s}" ;;
      allegromodern_s) command="${ALLEGROMODERN_S:-mlisp_s}" ;;
      allegromodern8_s) command="${ALLEGROMODERN8_S:-mlisp8_s}" ;;
      allegro_64) command="${ALLEGRO_64:-alisp_64}" ;;
      allegro8_64) command="${ALLEGRO8_64:-alisp8_64}" ;;
      allegromodern_64) command="${ALLEGROMODERN_64:-mlisp_64}" ;;
      allegromodern8_64) command="${ALLEGROMODERN8_64:-mlisp8_64}" ;;
      allegro_64_s) command="${ALLEGRO_64_S:-alisp_64_s}" ;;
      allegro8_64_s) command="${ALLEGRO8_64_S:-alisp8_64_s}" ;;
      allegromodern_64_s) command="${ALLEGROMODERN_64_S:-mlisp_64_s}" ;;
      allegromodern8_64_s) command="${ALLEGROMODERN8_64_S:-mlisp8_64_s}" ;;
220
    esac
221 222
    # For the sake of the lisp-invocation library, re-export these
    ALLEGRO=$command ; export ALLEGRO
223 224
    flags="-q"
    nodebug="-batch"
225 226 227 228 229 230 231 232 233 234 235
    if [ "$os" = windows ] && [ -z "$ALLEGRO_NOISY" ] ; then
        adir=$(dirname "${command}") ;
        allegroName=$(basename "${command}") ;
        if [[ ${allegroName: -1} == "8" ]] ; then build=build ; else build=buildi ; fi ;
        # this takes somewhat unjustifiable advantage of the fact that
        # the Allegro images have the same name (with .dxl extension)
        # as the corresponding executables.  the "build" executable
        # runs an ACL image in the current terminal instead of a
        # separate window, as is normal on Windows.
        bcmd="${adir}/${build}.exe -I ${command}.dxl $flags" ;
    fi
236
    eval="-e" ;;
237
  ccl)
Francois-Rene Rideau's avatar
Francois-Rene Rideau committed
238
    command="${CCL:-ccl}"
239 240 241
    flags="--no-init --quiet"
    nodebug="--batch"
    eval="--eval" ;;
Francois-Rene Rideau's avatar
Francois-Rene Rideau committed
242 243 244 245
  clasp)
    command="${CLASP:-clasp}"
    flags=""
    eval="" ;;
246 247
  clisp)
    command="${CLISP:-clisp}"
248
    flags="-norc --silent -ansi -I "
249 250
    nodebug="-on-error exit"
    eval="-x" ;;
251
  cmucl)
252 253 254
    # cmucl likes to have its executable called lisp, but so does scl
    # Please use a symlink or an exec ... "$@" trampoline script.
    command="${CMUCL:-cmucl}"
255 256 257
    flags="-noinit"
    nodebug="-batch"
    eval="-eval" ;;
258
  ecl)
Francois-Rene Rideau's avatar
Francois-Rene Rideau committed
259
    command="${ECL:-ecl}"
260 261
    flags="-norc -load sys:cmp"
    eval="-eval" ;;
262
  ecl_bytecodes)
263 264
    command="${ECL:-ecl}"
    flags="-norc -eval (ext::install-bytecodes-compiler)"
265
    eval="-eval" ;;
266
  gcl)
267
    GCL_ANSI=t
268
    command="${GCL:-gcl}"
269 270
    flags=""
    nodebug="-batch"
271
    eval="-eval" ;;
272
  lispworks)
273
    command="${LISPWORKS:-lispworks-console}"
274 275 276 277
    # If you have a licensed copy of lispworks,
    # you can obtain the "lispworks" binary with, e.g.
    # echo '(hcl:save-image "/lispworks" :environment nil)' > /tmp/build.lisp ;
    # ./lispworks-6-0-0-x86-linux -siteinit - -init - -build /tmp/build.lisp
278 279
    flags="-siteinit - -init -"
    eval="-eval" ;;
280 281 282 283
  mkcl)
    command="${MKCL:-mkcl}"
    flags="-norc"
    eval="-eval" ;;
284 285
  sbcl)
    command="${SBCL:-sbcl}"
286
    flags="--noinform --no-userinit --no-sysinit"
287
    nodebug="--disable-debugger"
288
    eval="--eval" ;;
289 290 291 292 293
  scl)
    command="${SCL:-scl}"
    flags="-noinit"
    nodebug="-batch"
    eval="-eval" ;;
294 295
  xcl)
    command="${XCL:-xcl}"
296
    flags="--no-userinit --no-siteinit --noinform"
297
    eval="--eval" ;;
298 299 300 301
  *)
    echo "Unsupported lisp: $1" >&2
    echo "Please add support to run-tests.sh" >&2
    exit 42 ;;
302
esac
303

304
if ! type "$command" > /dev/null ; then
305
    echo "lisp implementation not found: $command" >&2
306 307 308
    exit 43
fi

309
ASDFDIR="$(cd $(dirname $0)/.. ; /bin/pwd)"
310
: ${bcmd:=$command $flags} ${icmd:=$command $flags} # batch and interactive
311
if [ -z "${DEBUG_ASDF_TEST}" ] ; then
312
  bcmd="$bcmd $nodebug"
313 314
fi

Francois-Rene Rideau's avatar
Francois-Rene Rideau committed
315

316
create_config () {
317 318
    cd ${ASDFDIR}
    mkdir -p build/results/ build/test-source-registry-conf.d build/test-asdf-output-translations-conf.d
319
}
320
upgrade_tags () {
321 322
    if [ -n "$ASDF_UPGRADE_TEST_TAGS" ] ; then
        echo $ASDF_UPGRADE_TEST_TAGS ; return
323
    fi
324 325 326 327 328 329
    # REQUIRE is a magic tag meaning whatever your implementation provides, if anything
    #
    # 1.85 (2004-05-16) is the last release by Daniel Barlow (not 1.37, which is the README revision!)
    # 1.97 (2006-05-14) is the last release before Gary King takes over
    # 1.369 (2009-10-27) is the last release by Gary King
    #
330 331 332 333 334 335 336 337 338 339 340
    # 2.000 to 2.019 and 2.20 to 2.26 are Faré's "stable" ASDF 2 releases
    #   2.000 (2010-05-31) was the first ASDF 2 release
    #   2.008 (2010-09-10) was a somewhat stable ASDF 2 release
    #   2.011 (2010-11-28) was used by CLISP 2.49, Debian squeeze, Ubuntu 10.04 LTS
    #   2.014.6 (2011-04-06) was used by Quicklisp in 2011
    #   2.019 (2011-11-27) was stable and used by LispWorks since 2012.
    #   2.20 (2012-01-18) was in CCL 1.8, Ubuntu 12.04 LTS
    #   2.22 (2012-06-12) was used by debian wheezy
    #   2.26 (2012-10-30) was used by Quicklisp in 2013
    #
    # 2.26.x is where the refactoring that begat ASDF 3 took place.
341
    # 2.26.61 is the last single-file, single-package ASDF.
342 343 344 345 346 347
    # 2.27 to 2.33 are Faré's "stable" ASDF 3 pre-releases
    #   2.27 (2013-02-01) is the first ASDF 3 pre-release
    #   2.32 (2013-03-05) is the first really stable ASDF 3 pre-release
    #
    # The 3.0 series is a stable release of ASDF 3
    # with Robert Goldman taking over maintainership at 3.0.2.
348
    # 3.0.0 was just 2.33.10 promoted, but version-satisfies meant it was suddenly
349 350
    # not compatible with ASDF2 anymore, so we immediately released 3.0.1
    #   3.0.1 (2013-05-16) is the first stable ASDF 3 release
351 352
    #   3.0.2 (2013-07-02) is the first ASDF 3 in SBCL
    #   3.0.3 (2013-10-22) is the last in the ASDF 3.0 series
353 354 355
    #
    # The 3.1 series provides the 3.1 feature, meaning users can rely on
    # all the stabilization work done in 3.0 so far, plus extra developments
356
    # in UIOP, package-inferred-system, and more robustification.
357
    #   3.1.2 (2014-05-06) is the first ASDF 3.1 release
358
    #
359 360 361
    # We return the above designated versions in order of decreasing relevance,
    # which pretty much means REQUIRE and most recent first.
    echo REQUIRE
362
    echo 3.1.4 3.1.3 3.1.2
363
    echo 3.0.3 3.0.2 3.0.1
364 365 366
#    echo 2.32 2.27
#    echo 2.26 2.22 2.20 2.019 2.014.6 2.011 2.008 2.000
#    echo 1.369 1.97 1.85
367
}
368
upgrade_methods () {
369 370
    if [ -n "$ASDF_UPGRADE_TEST_METHODS" ] ; then
        echo $ASDF_UPGRADE_TEST_METHODS ; return
371 372
    fi
    cat <<EOF
373
'load-asdf-lisp'load-asdf-lisp-clean
374
'load-asdf-lisp'load-asdf-system
375
'load-asdf-lisp'compile-load-asdf-upgrade
376 377
'load-asdf-lisp'load-asdf-fasl
()'load-asdf-fasl
378
'load-asdf-lisp-and-test-uiop'load-asdf-fasl
379 380
EOF
}
381
extract_tagged_asdf () {
382 383
    cd ${ASDFDIR}
    mkdir -p build/
384 385
    tag=$1
    if [ REQUIRE = "$tag" ] ; then return 0 ; fi
386 387
    file=build/asdf-${tag}.lisp ;
    if [ ! -f $file ] ; then
388
        case $tag in
389
            1.*|2.0*|2.2[0-6]|2.26.61)
390
                git show ${tag}:asdf.lisp > $file ;;
391
            2.2[7-9]*|2.[3-9]*|3.*)
392
                mkdir -p build/old/build
393
                git archive ${tag} | (cd build/old/ ; tar xf -)
394
                make -C build/old
395
                mv build/old/build/asdf.lisp build/asdf-${tag}.lisp
396 397
                rm -rf build/old ;;
             *)
398 399 400 401 402 403
                echo "Don't know how to extract asdf.lisp for version $tag"
                exit 55
                ;;
        esac
    fi
}
404 405 406 407 408
extract_all_tagged_asdf () {
    for i in `upgrade_tags` ; do
      extract_tagged_asdf $i
    done
}
409 410
valid_upgrade_test_p () {
    case "${1}:${2}:${3}" in
411 412 413 414 415
        # It's damn slow. Also, for some reason, we punt on anything earlier than 2.25,
        # and only need to test it once, below for 2.24.
        abcl:1.*|abcl:2.00[0-9]:*|abcl:201[0-9]:*|abcl:2.2[0-3]:*) : ;;
        # ccl fasl numbering broke loading of old asdf 2.0
        ccl:2.0[01]*) : ;;
416
        # My old ubuntu 10.04LTS clisp 2.44.1 came wired in
417
        # with an antique ASDF 1.374 from CLC that can't be downgraded.
418 419
        # More recent CLISPs work.
        # 2.00[0-7] use UID, which fails on some old CLISPs.
420
        # Note that for the longest time, CLISP has included 2.011 in its distribution.
421
        # Now its hg repository includes 3.0.2.29, but clisp hasn't released in many years(!)
422
        # We don't punt on upgrade anymore, so we can go at it!
423
        #clisp:2.00[0-7]:*|clisp:1.*|clisp:2.0[01]*|clisp:2.2[0-5]:*) : ;;
424 425 426
        # CMUCL has problems with 2.32 and earlier because of
        # the redefinition of system's superclass component.
        cmucl:1.*|cmucl:2.[012]*|cmucl:2.3[012]*) : ;;
427 428
        # Skip many ECL tests, for various ASDF issues
        ecl*:1.*|ecl*:2.0[01]*|ecl*:2.20:*) : ;;
429
        # GCL 2.7.0 from late November 2013 is required, with ASDF 3.1.2
430
        gcl:REQUIRE:*|gcl:1.*|gcl:2.*|gcl:3.0*) : ;;
431 432
        # LispWorks is broken at ASDF 3.0.3, but can upgrade from earlier and later ASDFs.
        lispworks:3.0.3:*) : ;;
433 434
        # MKCL is only supported starting with specific versions 2.24, 2.26.x, 3.0.3.0.x, so skip.
        mkcl:[12]*|mkcl:3.0*) : ;;
435 436
        # XCL support starts with ASDF 2.014.2
        # — It also dies during upgrade trying to show the backtrace.
437
        xcl:1.*|xcl:2.00*|xcl:2.01[0-4]:*|xcl:*) : ;;
438 439 440
        *) return 0 ;;
   esac
   return 1
441
}
442
run_upgrade_tests () {
443
    cd ${ASDFDIR}
444
    mkdir -p build/results/
445
    rm -f build/*.*f* uiop/*.*f* test/*.*f* ## Remove stale FASLs from ASDF 1.x, especially when different implementations have same name
446
    ASDF_OUTPUT_TRANSLATIONS="(:output-translations (\"${ASDFDIR}\" (\"${ASDFDIR}/build/fasls/\" :implementation \"asdf/\")) (t (\"${ASDFDIR}/build/fasls/\" :implementation \"root/\")) :ignore-inherited-configuration)"
447
    su=test/script-support.lisp
448 449 450 451 452
    tags="`upgrade_tags`"
    methods="`upgrade_methods`"
    {
    for tag in $tags ; do
        for method in $methods ; do
453 454 455
            if valid_upgrade_test_p $lisp $tag $method ; then
                echo "Testing ASDF upgrade from ${tag} using method $method"
                extract_tagged_asdf $tag
456
                $bcmd $eval \
457
                "'(#.(load(string'|$su|))#.#.\`(in-package,:asdf-test)#.(test-upgrade$method\`|$tag|))" ||
458 459
                { echo "upgrade FAILED for $lisp from $tag using method $method" ;
                  echo "you can retry just that test with:" ;
460
                  echo ASDF_UPGRADE_TEST_TAGS=\"$tag\" ASDF_UPGRADE_TEST_METHODS=\"$method\" ./test/run-tests.sh -u $lisp ;
461
                  echo "or more interactively (and maybe with rlwrap or in emacs), start with:"
462
                  echo "$icmd"
463
                  echo "then copy/paste:"
464
                  echo "(load \"$su\") (asdf-test::da) (test-upgrade $method \"$tag\")"
465
                  exit 1 ;}
466 467 468
    fi ; done ; done
    echo "Upgrade test succeeded for ${lisp}"
    } 2>&1 | tee build/results/${lisp}-upgrade.text
469 470 471
}
run_tests () {
  create_config
472
  cd ./test/
473 474
  echo failure > ../build/results/status
    thedate=`date "+%Y-%m-%d"`
475
    rm -f "../build/results/${lisp}-test.text" || :
476
    do_tests "$@" 2>&1 | \
477
	tee "../build/results/${lisp}-test.text" "../build/results/${lisp}-test-${thedate}.save"
478 479
    read a < ../build/results/status
  clean_up
480 481 482 483
  if [ success = "$a" ] ; then ## exit code
      return 0
  else
     echo "To view full results and failures, try the following command:" >&2
484
     echo "     less -p ABORTED build/results/${lisp}-test.text" >&2
485 486
     return 1
  fi
487
}
488
clean_up () {
489
    rm -rf ../build/test-source-registry-conf.d ../build/test-asdf-output-translations-conf.d
490
}
491
test_clean_load () {
492
    case $lisp in
493
        gcl|cmucl) return 0 ;; # These are hopeless
494
    esac
495 496
    cd ${ASDFDIR}
    mkdir -p build/results/
497 498
    nop=build/results/${lisp}-nop.text
    load=build/results/${lisp}-load.text
499
    $bcmd $eval \
500
      "(or'#.(load(string'|test/script-support.lisp|):verbose():print())#.(asdf-test:exit-lisp'0))" \
501
      > $nop 2>&1
502
    $bcmd $eval \
503
      "(or'#.(load(string'|test/script-support.lisp|):verbose():print())#.(asdf-test:verbose())#.(load(string'|build/asdf.lisp|):verbose())#.(asdf/image:quit'0))" \
504
      > $load 2>&1
505 506 507 508 509 510
    if diff $nop $load ; then
      echo "GOOD: Loading ASDF on $lisp produces no message" >&2 ; return 0
    else
      echo "BAD: Loading ASDF on $lisp produces messages" >&2 ; return 1
    fi
}
511
test_load_systems () {
512 513
    cd ${ASDFDIR}
    mkdir -p build/results/
514
    echo "Loading all these systems: $*"
515
    $bcmd $eval \
516
      "(or #.(load(string'|test/script-support.lisp|))#.(asdf-test:with-test()(asdf-test:test-load-systems $*)))" \
517 518
        2>&1 | tee build/results/${lisp}-systems.text
}
519
test_interactively () {
520 521
    cd ${ASDFDIR}
    mkdir -p build/results/
522
    rlwrap $icmd $eval "(or'#.(load(string'|test/script-support.lisp|))#.(asdf-test:interactive-test'($*)))"
523
}
524

525
if [ -z "$command" ] ; then
Gary King's avatar
Gary King committed
526
    echo "Error: cannot find or do not know how to run Lisp named $lisp"
527 528
elif [ -n "$test_interactively" ] ; then
    test_interactively "$@"
529 530
elif [ -n "$clean_load" ] ; then
    test_clean_load
531
elif [ -n "$load_systems" ] ; then
532
    test_load_systems "$@"
533 534
elif [ -n "$upgrade" ] ; then
    run_upgrade_tests
535 536
elif [ -n "$extract_all" ] ; then
    extract_all_tagged_asdf
537
else
538
    run_tests "$@"
539
fi ; exit # NB: "; exit" makes it robust wrt the script being modified while running.