Hi,

Here are some small patches that updates a few things in our make rules.

The first makes a handful of minor changes in order to bring the
"testclean" target up to date, so that it actually does clean all files
generated by the tests.

The second makes sure the "chicken.compiler.chicken.import.scm" file is
cleaned up like the other compiler import libraries. I'm not sure why it
was excluded in the first place, but it was special cased that way so
if there is a reason it should be kept around and I'm just missing it
please set me straight.

The third adds a "bootclean" target that removes the artifacts generated
by a "boot-chicken" build.

Cheers,

Evan
>From 71264fa62ea7b2f8afc4a7c0809605e3d23476a9 Mon Sep 17 00:00:00 2001
From: Evan Hanson <[email protected]>
Date: Tue, 31 Oct 2017 21:38:26 +1300
Subject: [PATCH 1/3] 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.
---
 rules.make                                | 19 +++++++++++++----
 tests/{r4rstest.out => r4rstest.expected} |  0
 tests/runtests.bat                        | 31 +++++++++++++--------------
 tests/runtests.sh                         | 35 +++++++++++++++----------------
 4 files changed, 47 insertions(+), 38 deletions(-)
 rename tests/{r4rstest.out => r4rstest.expected} (100%)

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
-- 
2.11.0

>From ddaa6323935b4132ee36787087efc687e137f842 Mon Sep 17 00:00:00 2001
From: Evan Hanson <[email protected]>
Date: Tue, 31 Oct 2017 21:41:14 +1300
Subject: [PATCH 2/3] Remove the chicken.compiler.chicken import library on
 'make clean'

---
 rules.make | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rules.make b/rules.make
index beebe8c4..f6fd89ad 100644
--- a/rules.make
+++ b/rules.make
@@ -83,7 +83,7 @@ DISTFILES = $(filter-out runtime.c,$(LIBCHICKEN_OBJECTS_1:=.c)) \
 	$(DYNAMIC_IMPORT_LIBRARIES:=.import.scm) \
 	$(foreach lib,$(DYNAMIC_CHICKEN_IMPORT_LIBRARIES),chicken.$(lib).import.scm) \
 	$(foreach lib,$(DYNAMIC_CHICKEN_UNIT_IMPORT_LIBRARIES),chicken.$(lib).import.scm) \
-	$(foreach lib,$(filter-out chicken,$(COMPILER_OBJECTS_1)),chicken.compiler.$(lib).import.scm) \
+	$(foreach lib,$(COMPILER_OBJECTS_1),chicken.compiler.$(lib).import.scm) \
 	posixunix.c posixwin.c
 # Remove the duplicate $(POSIXFILE) entry:
 DISTFILES := $(sort $(DISTFILES))
@@ -492,7 +492,7 @@ $(foreach lib, $(DYNAMIC_IMPORT_LIBRARIES),\
 $(foreach lib, $(DYNAMIC_CHICKEN_UNIT_IMPORT_LIBRARIES),\
           $(eval $(call declare-emitted-chicken-import-lib-dependency,$(lib))))
 
-$(foreach lib, $(filter-out chicken,$(COMPILER_OBJECTS_1)),\
+$(foreach lib, $(COMPILER_OBJECTS_1),\
           $(eval $(call declare-emitted-compiler-import-lib-dependency,$(lib))))
 
 # special cases for modules not corresponding directly to units
-- 
2.11.0

>From 80b87469df61c5ef6fd34246d4ea1624701d86cc Mon Sep 17 00:00:00 2001
From: Evan Hanson <[email protected]>
Date: Tue, 31 Oct 2017 21:44:38 +1300
Subject: [PATCH 3/3] Add bootclean target for removing boot-chicken artifacts

---
 rules.make | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/rules.make b/rules.make
index f6fd89ad..30e74e69 100644
--- a/rules.make
+++ b/rules.make
@@ -1005,7 +1005,7 @@ bench: $(CHICKEN_SHARED_EXECUTABLE) $(CSI_SHARED_EXECUTABLE) $(CSC_PROGRAM)$(EXE
 
 # build static bootstrapping chicken
 
-.PHONY: boot-chicken
+.PHONY: boot-chicken bootclean
 
 boot-chicken:
 	"$(MAKE)" PLATFORM=$(PLATFORM) PREFIX=/nowhere CONFIG= \
@@ -1017,6 +1017,13 @@ boot-chicken:
 	  STATICBUILD=1 C_COMPILER_OPTIMIZATION_OPTIONS="$(C_COMPILER_OPTIMIZATION_OPTIONS)" \
 	  touchfiles chicken-boot$(EXE) confclean
 
+bootclean:
+	-$(REMOVE_COMMAND) $(REMOVE_COMMAND_OPTIONS) \
+	  $(SRCDIR)chicken-boot$(EXE) \
+	  $(SRCDIR)chicken-boot-stage1$(EXE) \
+	  $(SRCDIR)libchicken-boot$(A) \
+	  $(SRCDIR)libchicken-boot-stage1$(A)
+
 .PHONY: touchfiles
 
 touchfiles:
-- 
2.11.0

_______________________________________________
Chicken-hackers mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/chicken-hackers

Reply via email to