~ chicken-core (chicken-5) 49dd463979d57d37606b7da9c0ca8a9644dd08fa


commit 49dd463979d57d37606b7da9c0ca8a9644dd08fa
Author:     Evan Hanson <evhan@foldling.org>
AuthorDate: Tue Oct 31 21:38:26 2017 +1300
Commit:     Peter Bex <peter@more-magic.net>
CommitDate: Sat Nov 4 21:01:35 2017 +0100

    Clean up all generated files when running "make testclean"
    
    Update the test scripts and "testclean" make target to remove all files
    generated by the tests.
    
    Add an ".out" suffix to generated files so they can be easily
    distinguished.
    
    Escape the ">" in "string->number" when calling echo in runtests.bat.
    This avoids accidentally creating a file called "number" when running
    the test suite on Windows.
    
    Ignore the exit status of the USES_SONAME library removal command in the
    "clean" target.
    
    Always invoke diff(1) with expected on the left, actual on the right.
    
    Signed-off-by: Peter Bex <peter@more-magic.net>

diff --git a/rules.make b/rules.make
index 7b6461d6..beebe8c4 100644
--- a/rules.make
+++ b/rules.make
@@ -955,7 +955,7 @@ clean:
 	  $(IMPORT_LIBRARIES:=.import.so) $(LIBCHICKEN_IMPORT_LIBRARY) \
 	  $(foreach lib,$(DYNAMIC_IMPORT_LIBRARIES),chicken.$(lib).import.scm)
 ifdef USES_SONAME
-	$(REMOVE_COMMAND) $(REMOVE_COMMAND_OPTIONS) lib$(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX).so.$(BINARYVERSION)
+	-$(REMOVE_COMMAND) $(REMOVE_COMMAND_OPTIONS) lib$(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX).so.$(BINARYVERSION)
 endif
 
 confclean:
@@ -966,12 +966,23 @@ spotless: distclean testclean
 	-$(REMOVE_COMMAND) $(REMOVE_COMMAND_OPTIONS) $(DISTFILES) \
 	buildid buildbranch
 
-
 distclean: clean confclean
 
 testclean:
-	$(REMOVE_COMMAND) $(REMOVE_COMMAND_RECURSIVE_OPTIONS) $(SRCDIR)tests$(SEP)a.out $(SRCDIR)tests$(SEP)scrutiny.out \
-	  $(SRCDIR)tests$(SEP)tmp* $(SRCDIR)tests$(SEP)*.so $(SRCDIR)tests$(SEP)*.import.scm $(SRCDIR)tests$(SEP)repository $(SRCDIR)tests$(SEP)*.dll
+	-$(REMOVE_COMMAND) $(REMOVE_COMMAND_RECURSIVE_OPTIONS) \
+	  $(SRCDIR)tests$(SEP)*.dll \
+	  $(SRCDIR)tests$(SEP)*.import.scm \
+	  $(SRCDIR)tests$(SEP)*.link \
+	  $(SRCDIR)tests$(SEP)*.out \
+	  $(SRCDIR)tests$(SEP)*.profile \
+	  $(SRCDIR)tests$(SEP)*.so \
+	  $(SRCDIR)tests$(SEP)tmp* \
+	  $(SRCDIR)tests$(SEP)empty-file \
+	  $(SRCDIR)tests$(SEP)null \
+	  $(SRCDIR)tests$(SEP)null.c \
+	  $(SRCDIR)tests$(SEP)null.o \
+	  $(SRCDIR)tests$(SEP)null.exe \
+	  $(SRCDIR)tests$(SEP)test-repository
 
 # run tests
 
diff --git a/tests/r4rstest.out b/tests/r4rstest.expected
similarity index 100%
rename from tests/r4rstest.out
rename to tests/r4rstest.expected
diff --git a/tests/runtests.bat b/tests/runtests.bat
index 67f3a227..b6af433c 100644
--- a/tests/runtests.bat
+++ b/tests/runtests.bat
@@ -110,15 +110,15 @@ if errorlevel 1 exit /b 1
 del /f /q foo.types foo.import.*
 
 echo ======================================== specialization benchmark ...
-%compile% fft.scm -O2 -local -d0 -disable-interrupts -b -o fft1
+%compile% fft.scm -O2 -local -d0 -disable-interrupts -b -o fft1.out
 if errorlevel 1 exit /b 1
-%compile% fft.scm -O2 -local -specialize -debug x -d0 -disable-interrupts -b -o fft2 -specialize
+%compile% fft.scm -O2 -local -specialize -debug x -d0 -disable-interrupts -b -o fft2.out -specialize
 if errorlevel 1 exit /b 1
 echo normal:
-fft1 1000 7
+fft1.out 1000 7
 if errorlevel 1 exit /b 1
 echo specialized:
-fft2 1000 7
+fft2.out 1000 7
 if errorlevel 1 exit /b 1
 
 echo ======================================== callback tests ...
@@ -336,10 +336,10 @@ if errorlevel 1 exit /b 1
 
 echo ======================================== r4rstest ...
 echo (expect mult-float-print-test to fail)
-%interpret% -R data-structures -e "(set! ##sys#procedure->string (constantly \"#<procedure>\"))" -i -s r4rstest.scm >r4rstest.log
+%interpret% -R data-structures -e "(set! ##sys#procedure->string (constantly \"#<procedure>\"))" -i -s r4rstest.scm >r4rstest.out
 if errorlevel 1 exit /b 1
 
-type r4rstest.log
+type r4rstest.out
 
 echo ======================================== syntax tests (r5rs_pitfalls) ...
 echo (expect two failures)
@@ -406,7 +406,7 @@ if errorlevel 1 exit /b 1
 a.out
 if errorlevel 1 exit /b 1
 
-echo ======================================== string->number tests ...
+echo ======================================== string-^>number tests ...
 %interpret% -s numbers-string-conversion-tests.scm
 if errorlevel 1 exit /b 1
 %compile% -specialize numbers-string-conversion-tests.scm
@@ -581,23 +581,23 @@ if errorlevel 1 exit /b 1
 
 echo ======================================== linking tests ...
 %compile2% -unit reverser reverser\tags\1.0\reverser.scm -J -c -o reverser.o
-%compile2% -link reverser linking-tests.scm
+%compile2% -link reverser linking-tests.scm -o a.out
 if errorlevel 1 exit /b 1
-linking-tests
+a.out
 if errorlevel 1 exit /b 1
-%compile2% -link reverser linking-tests.scm -static
+%compile2% -link reverser linking-tests.scm -o a.out -static
 if errorlevel 1 exit /b 1
-linking-tests
+a.out
 if errorlevel 1 exit /b 1
 move reverser.o %CHICKEN_INSTALL_REPOSITORY%
 move reverser.import.scm %CHICKEN_INSTALL_REPOSITORY%
-%compile2% -link reverser linking-tests.scm
+%compile2% -link reverser linking-tests.scm -o a.out
 if errorlevel 1 exit /b 1
-linking-tests
+a.out
 if errorlevel 1 exit /b 1
-%compile2% -link reverser linking-tests.scm -static
+%compile2% -link reverser linking-tests.scm -o a.out -static
 if errorlevel 1 exit /b 1
-linking-tests
+a.out
 if errorlevel 1 exit /b 1
 
 echo ======================================== private repository test ...
@@ -609,7 +609,6 @@ tmp\xxx %CD%\tmp
 set PATH=%CD%\tmp;%PATH% xxx %CD%\tmp
 rem this may crash, if the PATH contains a non-matching libchicken.dll on Windows:
 set PATH=%PATH%;%CD%\tmp xxx %CD%\tmp
-del /f /q /s rev-app rev-app-2 reverser\*.import.* reverser\*.so
 
 echo ======================================== multiple return values tests ...
 %interpret% -s multiple-values.scm
diff --git a/tests/runtests.sh b/tests/runtests.sh
index 24dae5c1..f512bdbe 100755
--- a/tests/runtests.sh
+++ b/tests/runtests.sh
@@ -99,10 +99,10 @@ $compile specialization-tests.scm -analyze-only -verbose -specialize 2>specializ
 
 # these are sensitive to gensym-names, so make them optional
 if test \! -f scrutiny.expected; then
-    cp scrutiny.out scrutiny.expected
+    cp scrutiny.expected scrutiny.out
 fi
 if test \! -f specialization.expected; then
-    cp specialization.out specialization.expected
+    cp specialization.expected specialization.out
 fi
 
 diff $DIFF_OPTS scrutiny.expected scrutiny.out
@@ -112,7 +112,7 @@ $compile scrutiny-tests-2.scm -A 2>scrutiny-2.out -verbose
 
 # this is sensitive to gensym-names, so make it optional
 if test \! -f scrutiny-2.expected; then
-    cp scrutiny-2.out scrutiny-2.expected
+    cp scrutiny-2.expected scrutiny-2.out
 fi
 
 diff $DIFF_OPTS scrutiny-2.expected scrutiny-2.out
@@ -133,12 +133,12 @@ $compile specialization-test-2.scm -types foo.types -types specialization-test-2
 rm -f foo.types foo.import.*
 
 echo "======================================== specialization benchmark ..."
-$compile fft.scm -O2 -local -d0 -disable-interrupts -b -o fft1
-$compile fft.scm -O2 -local -specialize -debug x -d0 -disable-interrupts -b -o fft2 -specialize
+$compile fft.scm -O2 -local -d0 -disable-interrupts -b -o fft1.out
+$compile fft.scm -O2 -local -specialize -debug x -d0 -disable-interrupts -b -o fft2.out -specialize
 echo "normal:"
-$time ./fft1 1000 7
+$time ./fft1.out 1000 7
 echo "specialized:"
-$time ./fft2 1000 7
+$time ./fft2.out 1000 7
 
 echo "======================================== callback tests ..."
 $compile -extend c-id-valid.scm callback-tests.scm
@@ -278,9 +278,9 @@ $interpret -s loopy-test.scm
 echo "======================================== r4rstest ..."
 echo "(expect mult-float-print-test to fail)"
 $interpret -R data-structures -e '(set! ##sys#procedure->string (constantly "#<procedure>"))' \
-  -i -s r4rstest.scm >r4rstest.log
+  -i -s r4rstest.scm >r4rstest.out
 
-diff $DIFF_OPTS r4rstest.out r4rstest.log
+diff $DIFF_OPTS r4rstest.expected r4rstest.out
 
 echo "======================================== syntax tests (r5rs_pitfalls) ..."
 echo "(expect two failures)"
@@ -454,15 +454,15 @@ $compile -e embedded3.c embedded4.scm
 
 echo "======================================== linking tests ..."
 $compile2 -unit reverser reverser/tags/1.0/reverser.scm -J -c -o reverser.o
-$compile2 -link reverser linking-tests.scm
-./linking-tests
-$compile2 -link reverser linking-tests.scm -static
-./linking-tests
+$compile2 -link reverser linking-tests.scm -o a.out
+./a.out
+$compile2 -link reverser linking-tests.scm -o a.out -static
+./a.out
 mv reverser.o reverser.import.scm "$CHICKEN_INSTALL_REPOSITORY"
-$compile2 -link reverser linking-tests.scm
-./linking-tests
-$compile2 -link reverser linking-tests.scm -static
-./linking-tests
+$compile2 -link reverser linking-tests.scm -o a.out
+./a.out
+$compile2 -link reverser linking-tests.scm -o a.out -static
+./a.out
 
 echo "======================================== private repository test ..."
 mkdir -p tmp
@@ -472,7 +472,6 @@ tmp/xxx ${TEST_DIR}/tmp
 PATH=`pwd`/tmp:$PATH xxx ${TEST_DIR}/tmp
 # this may crash, if the PATH contains a non-matching libchicken.dll on Windows:
 #PATH=$PATH:${TEST_DIR}/tmp xxx ${TEST_DIR}/tmp
-rm -fr reverser/*.import.* reverser/*.so
 
 echo "======================================== multiple return values tests ..."
 $interpret -s multiple-values.scm
Trap