Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Port tests/expect.sh, foreign.test.sh to FreeBSD's shell

Fixes clos.test.sh, foreign.test.sh on FreeBSD 9.1.
  • Loading branch information...
commit bad78f8364214129d96f1ae0e028e2810a828791 1 parent 60bb508
@lichtblau lichtblau authored
Showing with 37 additions and 14 deletions.
  1. +33 −12 tests/expect.sh
  2. +4 −2 tests/foreign.test.sh
View
45 tests/expect.sh
@@ -5,11 +5,22 @@
# Check that compiling and loading the file $1 generates an error
# at load time; also that just loading it directly (into the
# interpreter) generates an error.
+
+# In bash,
+#
+# function callee() { cat }
+# function caller() { callee bar <<EOF \n $1 \n EOF \n }
+# caller foo
+#
+# will print "foo". In certain versions of sh, however, it will print
+# "bar" instead. Hence variables f and c in the following code.
+
expect_load_error ()
{
# Test compiling and loading.
+ f="$1"
run_sbcl <<EOF
- (compile-file "$1")
+ (compile-file "$f")
;;; But loading the file should fail.
(multiple-value-bind (value0 value1) (ignore-errors (load *))
(assert (null value0))
@@ -20,8 +31,9 @@ EOF
check_status_maybe_lose compile-and-load $?
# Test loading into the interpreter.
+ f="$1"
run_sbcl <<EOF
- (multiple-value-bind (value0 value1) (ignore-errors (load "$1"))
+ (multiple-value-bind (value0 value1) (ignore-errors (load "$f"))
(assert (null value0))
(format t "VALUE1=~S (~A)~%" value1 value1)
(assert (typep value1 'error)))
@@ -33,9 +45,10 @@ EOF
expect_clean_cload ()
{
expect_clean_compile $1
+ f="$1"
run_sbcl <<EOF
(multiple-value-bind (value0 value1)
- (ignore-errors (load (compile-file-pathname "$1")))
+ (ignore-errors (load (compile-file-pathname "$f")))
(assert value0)
(assert (null value1)))
(sb-ext:quit :unix-status $EXIT_LISP_WIN)
@@ -47,9 +60,10 @@ EOF
# STYLE-WARNINGs.
expect_clean_compile ()
{
+ f="$1"
run_sbcl <<EOF
(multiple-value-bind (pathname warnings-p failure-p)
- (compile-file "$1")
+ (compile-file "$f")
(declare (ignore pathname))
(assert (not warnings-p))
(assert (not failure-p))
@@ -60,9 +74,10 @@ EOF
expect_warned_compile ()
{
+ f="$1"
run_sbcl <<EOF
(multiple-value-bind (pathname warnings-p failure-p)
- (compile-file "$1")
+ (compile-file "$f")
(declare (ignore pathname))
(assert warnings-p)
(assert (not failure-p))
@@ -73,9 +88,10 @@ EOF
expect_failed_compile ()
{
+ f="$1"
run_sbcl <<EOF
(multiple-value-bind (pathname warnings-p failure-p)
- (compile-file "$1")
+ (compile-file "$f")
(declare (ignore pathname warnings-p))
(assert failure-p)
(sb-ext:quit :unix-status $EXIT_LISP_WIN))
@@ -85,11 +101,12 @@ EOF
expect_aborted_compile ()
{
+ f="$1"
run_sbcl <<EOF
- (let* ((lisp "$1")
+ (let* ((lisp "$f")
(fasl (compile-file-pathname lisp)))
(multiple-value-bind (pathname warnings-p failure-p)
- (compile-file "$1" :print t)
+ (compile-file "$f" :print t)
(assert (not pathname))
(assert failure-p)
(assert warnings-p)
@@ -101,9 +118,11 @@ EOF
fail_on_condition_during_compile ()
{
+ c="$1"
+ f="$2"
run_sbcl <<EOF
- (handler-bind (($1 #'error))
- (compile-file "$2")
+ (handler-bind (($c #'error))
+ (compile-file "$f")
(sb-ext:quit :unix-status $EXIT_LISP_WIN))
EOF
check_status_maybe_lose "fail-on-condition_$1" $?
@@ -111,11 +130,13 @@ EOF
expect_condition_during_compile ()
{
+ c="$1"
+ f="$2"
run_sbcl <<EOF
- (handler-bind (($1 (lambda (c)
+ (handler-bind (($c (lambda (c)
(declare (ignore c))
(sb-ext:quit :unix-status $EXIT_LISP_WIN))))
- (compile-file "$2"))
+ (compile-file "$f"))
EOF
check_status_maybe_lose "expect-condition_$1" $?
}
View
6 tests/foreign.test.sh
@@ -264,8 +264,9 @@ EOF
set +e
test_compile() {
+ x="$1"
run_sbcl <<EOF
-(progn (load (compile-file "$TEST_FILESTEM.$1.lisp"))
+(progn (load (compile-file "$TEST_FILESTEM.$x.lisp"))
(sb-ext:exit :code $EXIT_LISP_WIN))
EOF
check_status_maybe_lose "compile $1" $?
@@ -284,8 +285,9 @@ test_use fast
test_save() {
echo testing save $1
+ x="$1"
run_sbcl --load $TEST_FILESTEM.$1.fasl <<EOF
-#+linkage-table (save-lisp-and-die "$TEST_FILESTEM.$1.core")
+#+linkage-table (save-lisp-and-die "$TEST_FILESTEM.$x.core")
#-linkage-table nil
(sb-ext:exit :code 22) ; catch this
EOF
Please sign in to comment.
Something went wrong with that request. Please try again.