Hi, Attached you can find a set of patches for both CHICKEN 5 and 6. Please check the summary below for a more organized listing.
The main proposal of the patchset is to introduce scripts/smoke-test.sh, which performs basic tests on the code in chicken-core. It is for CHICKEN 6 only. It can be useful to test changes before the submission of patches. I've tested it on Debian GNU/Linux, FreeBSD and OpenBSD. While working on it, I realized some improvements that could be applied to both CHICKEN 5 and CHICKEN 6. Those are the remaining patches (take a look at their commit messages). Patches with a .5.patch suffix are for CHICKEN 5. Patches with a .6.patch suffix are for CHICKEN 6. Summary of attached patches: ## For CHICKEN 6 * 0001-scripts-Remove-mini-salmonella.scm.6.patch * 0002-scripts-makedist.scm-Error-out-on-missing-files.6.patch * 0003-Add-scripts-smoke-test.sh.6.patch * 0004-.gitignore-Ignore-posixwin.c.6.patch ## For CHICKEN 5 * 0001-scripts-makedist.scm-Error-out-on-missing-files.5.patch * 0002-.gitignore-Ignore-posixwin.c.5.patch * 0003-scripts-Remove-mini-salmonella.scm.5.patch All the best. Mario -- https://parenteses.org/mario
>From ea96f0d65c98cd4bbd3c6a09b670cc0ddc33753f Mon Sep 17 00:00:00 2001 From: Mario Domenech Goulart <[email protected]> Date: Fri, 5 Dec 2025 10:29:10 +0100 Subject: [PATCH 1/3] scripts/makedist.scm: Error out on missing files Make makedist.scm raise an error in case missing files are detected. This is to avoid: * accidentally generating distribution tarballs without the complete set of files * having references in distribution/manifest to files that have been intentionally removed --- scripts/makedist.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/makedist.scm b/scripts/makedist.scm index 9281a483..9de2d283 100644 --- a/scripts/makedist.scm +++ b/scripts/makedist.scm @@ -77,7 +77,8 @@ (else (cons f missing)))) '() files))) (unless (null? missing) - (warning "files missing" missing) ) ) + (fprintf (current-error-port) "[ERROR] files missing: ~A~%" missing) + (exit 1) ) ) (run "tar cfz ~a ~a" (conc distname ".tar.gz") distname) (run "rm -fr ~a" distname))) -- 2.47.3
>From 769cf61eac5cdf6abfee5f3a6a8440aa091b6eea Mon Sep 17 00:00:00 2001 From: Mario Domenech Goulart <[email protected]> Date: Fri, 5 Dec 2025 11:07:30 +0100 Subject: [PATCH 2/3] .gitignore: Ignore posixwin.c --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 40a78048..334d04cd 100644 --- a/.gitignore +++ b/.gitignore @@ -64,6 +64,7 @@ /pathname.c /port.c /posixunix.c +/posixwin.c /profiler.c /read-syntax.c /repl.c -- 2.47.3
>From f082b79692ec133e61db54d8b698b3fd00262da5 Mon Sep 17 00:00:00 2001 From: Mario Domenech Goulart <[email protected]> Date: Fri, 5 Dec 2025 10:29:10 +0100 Subject: [PATCH 2/4] scripts/makedist.scm: Error out on missing files Make makedist.scm raise an error in case missing files are detected. This is to avoid: * accidentally generating distribution tarballs without the complete set of files * having references in distribution/manifest to files that have been intentionally removed --- scripts/makedist.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/makedist.scm b/scripts/makedist.scm index bda4272c..93128475 100644 --- a/scripts/makedist.scm +++ b/scripts/makedist.scm @@ -72,7 +72,8 @@ (else (cons f missing)))) '() files))) (unless (null? missing) - (warning "files missing" missing) ) ) + (fprintf (current-error-port) "[ERROR] files missing: ~A~%" missing) + (exit 1) ) ) (run "tar cfz ~a ~a" (conc distname ".tar.gz") distname) (run "rm -fr ~a" distname))) -- 2.47.3
>From 6c5b64cc01daecc05d8c0f35690cfbf0b1635cbb Mon Sep 17 00:00:00 2001 From: Mario Domenech Goulart <[email protected]> Date: Thu, 4 Dec 2025 22:35:14 +0100 Subject: [PATCH 3/4] Add scripts/smoke-test.sh Add script to perform basic tests on the code in this repository. It can be useful to test changes before the submission of patches. --- .gitignore | 4 ++ NEWS | 1 + distribution/manifest | 1 + scripts/smoke-test.sh | 107 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 113 insertions(+) create mode 100755 scripts/smoke-test.sh diff --git a/.gitignore b/.gitignore index aa42fbe0..cf79b3c5 100644 --- a/.gitignore +++ b/.gitignore @@ -134,3 +134,7 @@ # Generated manual (from dist) /manual-html + +# Generated by scripts/smoke-test.sh + +/smoke-test-* diff --git a/NEWS b/NEWS index f3822211..067b0ca8 100644 --- a/NEWS +++ b/NEWS @@ -113,6 +113,7 @@ - The `csc-options' and `link-options' configuration clauses in egg specifications now allow `custom-config' forms to produce arbitrary computed compiler and linker options. + - Added scripts/smoke-test.sh to automate basic testing of chicken-core - Build system - A "configure" script is now used to prepare the sources for building diff --git a/distribution/manifest b/distribution/manifest index 785b5d1f..e8fffb22 100644 --- a/distribution/manifest +++ b/distribution/manifest @@ -418,6 +418,7 @@ scripts/compare-documentation-exports.scm scripts/mini-salmonella.scm scripts/make-wrapper.scm scripts/makedist.scm +scripts/smoke-test.sh manual-html/Accessing external objects.html manual-html/Acknowledgements.html manual-html/Bibliography.html diff --git a/scripts/smoke-test.sh b/scripts/smoke-test.sh new file mode 100755 index 00000000..0a21f1ba --- /dev/null +++ b/scripts/smoke-test.sh @@ -0,0 +1,107 @@ +#! /bin/sh + +set -e + +ALL_GOOD="========== ALL GOOD! ==========" + +usage() { + cat <<EOF +Usage: $(basename "$0") [-h|-help|--help] + +This script runs basic tests on the chicken-core repository: + +* Creates a distribution tarball with the Scheme code compiled to C. +* Extracts, builds, installs and tests the code from the distribution + tarball. +* Uses CHICKEN installed out of the distribution tarball to install + salmonella, and uses it to test an egg with dependencies. + +If everything goes well, you should see + +$ALL_GOOD + +printed to stdout and the script will exit 0. + +The following environment variables are considered by this script: + +* CHICKEN: path to the chicken executable to be used to compile Scheme + code to C. By default, chicken will be used from \$PATH. + +* MAKE_JOBS: the maximum number of make jobs to use. On systems where + the nproc program is available, its output will be used by default, + otherwise 1 will be used. + +* C_COMPILER: the C compiler to use. The default is gcc on Linux and + cc on BSDs. + +* EGGS: eggs to be used as input for salmonella (space-separated, in + case of multiple eggs). By default, the base64 egg will be used. + Note that, unless you tweak setup.defaults to configure + chicken-install to use egg sources from a local filesystem, testing + the installation of eggs requires Internet access. If you want to + skip the egg installation test, set this variable to ":". +EOF +} + +[ "$1" = "-h" ] || [ "$1" = "-help" ] || [ "$1" = "--help" ] && { + usage + exit 0 +} + +set -x + +chicken=${CHICKEN:-chicken} +c_compiler=${C_COMPILER:-gcc} +make="make" + +if command -v nproc >/dev/null; then + make_jobs=${MAKE_JOBS:-$(nproc)} +else + make_jobs=${MAKE_JOBS:-1} +fi + +case "$(uname)" in + *BSD) + c_compiler=${C_COMPILER:-cc} + make=gmake + ;; +esac + +# manual-labor is needed by make dist to generate the HTML files of +# the manual +command -v manual-labor >/dev/null || { + set +x + echo "[ERROR] manual-labor could not be found. \ +Install it with chicken-install and/or make sure its location is in \$PATH." >&2 + exit 1 +} + +# Using a directory in the current directory as /tmp might be mounted +# on a filesystem that disallows execution +tmpdir=$(mktemp -p "$PWD" -d smoke-test-XXXXXX) + +./configure --chicken "$chicken" +"$make" dist -j "$make_jobs" + +tarball_basename=chicken-$(cat buildversion) +tarball=${tarball_basename}.tar.gz + +mv "$tarball" "$tmpdir" +cd "$tmpdir" +tar xzf "$tarball" +cd "$tarball_basename" +./configure --prefix "$PWD/../chicken" --chicken "$chicken" --c-compiler "$c_compiler" +"$make" -j "$make_jobs" +"$make" install +"$make" check + +eggs=${EGGS:-base64} +# : is not a valid egg name +if [ "$eggs" != ":" ]; then + ../chicken/bin/chicken-install -v salmonella + # shellcheck disable=SC2086 + ../chicken/bin/salmonella $eggs +fi + +set +x +echo "$ALL_GOOD" -- 2.47.3
>From e2036fc1db820e8f971360b1735291c91aa056e4 Mon Sep 17 00:00:00 2001 From: Mario Domenech Goulart <[email protected]> Date: Fri, 5 Dec 2025 11:10:38 +0100 Subject: [PATCH 3/3] scripts: Remove mini-salmonella.scm mini-salmonella.scm is for CHICKEN 4, and that is an indication that it is not being used for CHICKEN 5 and 6. --- distribution/manifest | 1 - scripts/README | 9 +-- scripts/mini-salmonella.scm | 135 ------------------------------------ 3 files changed, 1 insertion(+), 144 deletions(-) delete mode 100644 scripts/mini-salmonella.scm diff --git a/distribution/manifest b/distribution/manifest index 4c676f87..7bc17f82 100644 --- a/distribution/manifest +++ b/distribution/manifest @@ -395,7 +395,6 @@ scripts/chicken-flymake.bat scripts/csc-trans scripts/compile-all scripts/compare-documentation-exports.scm -scripts/mini-salmonella.scm scripts/make-wrapper.scm scripts/makedist.scm manual-html/Accessing external objects.html diff --git a/scripts/README b/scripts/README index ca845742..a97dcd85 100644 --- a/scripts/README +++ b/scripts/README @@ -11,11 +11,4 @@ This directory contains a couple of things that might be useful: makedist.scm - Creates a distribution tarball from a chicken svn checkout. - - mini-salmonella.scm - - A minimalistic version of `salmonella', the egg-test tool. It - takes a path to a local checkout of the extensions repository - and compiles each egg from scratch, reporting success or - failure. + Creates a distribution tarball from a chicken-core git checkout. diff --git a/scripts/mini-salmonella.scm b/scripts/mini-salmonella.scm deleted file mode 100644 index 45bffee9..00000000 --- a/scripts/mini-salmonella.scm +++ /dev/null @@ -1,135 +0,0 @@ -;;;; mini-salmonella.scm - very simple tool to build all eggs - - -(module mini-salmonella () - -(import scheme chicken) -(import posix file extras data-structures setup-api (chicken process)) - -(define (usage code) - (print "usage: mini-salmonella [-h] [-test] [-debug] [-download] [-trunk] EGGDIR [PREFIX]") - (exit code) ) - -(define *eggdir* #f) -(define *debug* #f) -(define *run-tests* #f) -(define *download* #f) -(define *trunk* #f) - -(define *prefix* (get-environment-variable "CHICKEN_PREFIX")) - -(let loop ((args (command-line-arguments))) - (when (pair? args) - (let ((arg (car args))) - (cond ((string=? "-h" arg) (usage 0)) - ((string=? "-test" arg) (set! *run-tests* #t)) - ((string=? "-debug" arg) (set! *debug* #t)) - ((string=? "-download" arg) (set! *download* #t)) - ((string=? "-trunk" arg) (set! *trunk* #t)) - (*eggdir* (set! *prefix* arg)) - (else (set! *eggdir* arg))) - (loop (cdr args))))) - -(unless *eggdir* (usage 1)) - -(define-foreign-variable *binary-version* int "C_BINARY_VERSION") -(define *repository* (make-pathname *prefix* (conc "lib/chicken/" *binary-version*))) -(define *snapshot* (directory *repository*)) - -(define (cleanup-repository) - (for-each - (lambda (f) - (let ((f2 (make-pathname *repository* f))) - (cond ((member f2 *snapshot*)) - ((directory? f2) - (remove-directory f2)) - (else - (delete-file f2))))) - (directory *repository*))) - -(define *chicken-install* - (normalize-pathname (make-pathname *prefix* "bin/chicken-install"))) - -(define *eggs* (directory *eggdir*)) - -(define (find-newest egg) - (let* ((ed (make-pathname *eggdir* egg)) - (tagsdir (directory-exists? (make-pathname ed "tags"))) - (trunkdir (directory-exists? (make-pathname ed "trunk")))) - (cond ((and *trunk* trunkdir) trunkdir) - (tagsdir - (let ((tags (sort (directory tagsdir) version>=?))) - (if (null? tags) - (or trunkdir ed) - (make-pathname ed (string-append "tags/" (car tags)))))) - (else (or trunkdir ed))))) - -(define (report egg msg . args) - (printf "~a..~?~%" (make-string (max 2 (- 32 (string-length egg))) #\.) - msg args) ) - -(define *errlogfile* "mini-salmonella.errors.log") -(define *logfile* "mini-salmonella.log") -(define *tmplogfile* "mini-salmonella.tmp.log") - -(on-exit (lambda () (delete-file* *tmplogfile*))) - -(define (copy-log egg file) - (let ((log (with-input-from-file file read-string))) - (with-output-to-file *errlogfile* - (lambda () - (print #\newline egg #\:) - (display log)) - #:append))) - -(define *failed* 0) -(define *succeeded* 0) - -(define (install-egg egg dir) - (let ((command - (conc - *chicken-install* " -force " - (if *run-tests* "-test " "") - (if *trunk* "-trunk " "") - (if *download* - "" - (string-append "-t local -l " (normalize-pathname *eggdir*) " ")) - egg " " - (cond ((not *debug*) - (delete-file* (string-append *logfile* ".out")) - (sprintf "2>~a >>~a.out" *tmplogfile* *logfile*)) - (else ""))))) - (when *debug* - (print " " command)) - (let ((status (system command))) - (cond ((zero? status) - (report egg "OK") - (set! *succeeded* (add1 *succeeded*))) - (else - (report egg "FAILED") - (set! *failed* (add1 *failed*)) - (unless *debug* (copy-log egg *tmplogfile*))))))) - -(delete-file* *errlogfile*) -(delete-file* *logfile*) - -(for-each - (lambda (egg) - (and-let* ((dir (find-newest egg))) - (if *debug* - (print "\n\n######################################## " egg "\n") - (print* egg)) - (cleanup-repository) - (let ((meta (file-exists? (make-pathname dir egg "meta")))) - (if meta - (let ((setup (file-exists? (make-pathname dir egg "setup")))) - (if setup - (install-egg egg dir) - (report egg "<no .setup script>")) ) - (report egg "<no .meta file>"))))) - (sort (directory *eggdir*) string<?)) - -(print "\nSucceeded: " *succeeded* ", failed: " *failed* ", total: " - (+ *succeeded* *failed*)) - -) -- 2.47.3
>From f03e4f5e420211621a92746e348546e3fde4b5c0 Mon Sep 17 00:00:00 2001 From: Mario Domenech Goulart <[email protected]> Date: Fri, 5 Dec 2025 10:59:57 +0100 Subject: [PATCH 4/4] .gitignore: Ignore posixwin.c --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index cf79b3c5..6c1979c5 100644 --- a/.gitignore +++ b/.gitignore @@ -63,6 +63,7 @@ /pathname.c /port.c /posixunix.c +/posixwin.c /profiler.c /r7lib.c /read-syntax.c -- 2.47.3
>From 94ee09c188062830728b8cb10b55afb404141423 Mon Sep 17 00:00:00 2001 From: Mario Domenech Goulart <[email protected]> Date: Thu, 4 Dec 2025 21:01:50 +0100 Subject: [PATCH 1/4] scripts: Remove mini-salmonella.scm mini-salmonella.scm is for CHICKEN 4, and that is an indication that it is not being used for CHICKEN 5 and 6. --- distribution/manifest | 1 - scripts/README | 12 ---- scripts/mini-salmonella.scm | 135 ------------------------------------ 3 files changed, 148 deletions(-) delete mode 100644 scripts/mini-salmonella.scm diff --git a/distribution/manifest b/distribution/manifest index 785b5d1f..7ffd4d9c 100644 --- a/distribution/manifest +++ b/distribution/manifest @@ -415,7 +415,6 @@ scripts/chicken-flymake scripts/csc-trans scripts/compile-all scripts/compare-documentation-exports.scm -scripts/mini-salmonella.scm scripts/make-wrapper.scm scripts/makedist.scm manual-html/Accessing external objects.html diff --git a/scripts/README b/scripts/README index ca845742..55c3619b 100644 --- a/scripts/README +++ b/scripts/README @@ -4,18 +4,6 @@ README for scripts/ This directory contains a couple of things that might be useful: - test-dist.sh - - Takes a platform-designator and the path to a tarball and unpacks, - builds and tests the chicken distribution contained therein. - makedist.scm Creates a distribution tarball from a chicken svn checkout. - - mini-salmonella.scm - - A minimalistic version of `salmonella', the egg-test tool. It - takes a path to a local checkout of the extensions repository - and compiles each egg from scratch, reporting success or - failure. diff --git a/scripts/mini-salmonella.scm b/scripts/mini-salmonella.scm deleted file mode 100644 index 45bffee9..00000000 --- a/scripts/mini-salmonella.scm +++ /dev/null @@ -1,135 +0,0 @@ -;;;; mini-salmonella.scm - very simple tool to build all eggs - - -(module mini-salmonella () - -(import scheme chicken) -(import posix file extras data-structures setup-api (chicken process)) - -(define (usage code) - (print "usage: mini-salmonella [-h] [-test] [-debug] [-download] [-trunk] EGGDIR [PREFIX]") - (exit code) ) - -(define *eggdir* #f) -(define *debug* #f) -(define *run-tests* #f) -(define *download* #f) -(define *trunk* #f) - -(define *prefix* (get-environment-variable "CHICKEN_PREFIX")) - -(let loop ((args (command-line-arguments))) - (when (pair? args) - (let ((arg (car args))) - (cond ((string=? "-h" arg) (usage 0)) - ((string=? "-test" arg) (set! *run-tests* #t)) - ((string=? "-debug" arg) (set! *debug* #t)) - ((string=? "-download" arg) (set! *download* #t)) - ((string=? "-trunk" arg) (set! *trunk* #t)) - (*eggdir* (set! *prefix* arg)) - (else (set! *eggdir* arg))) - (loop (cdr args))))) - -(unless *eggdir* (usage 1)) - -(define-foreign-variable *binary-version* int "C_BINARY_VERSION") -(define *repository* (make-pathname *prefix* (conc "lib/chicken/" *binary-version*))) -(define *snapshot* (directory *repository*)) - -(define (cleanup-repository) - (for-each - (lambda (f) - (let ((f2 (make-pathname *repository* f))) - (cond ((member f2 *snapshot*)) - ((directory? f2) - (remove-directory f2)) - (else - (delete-file f2))))) - (directory *repository*))) - -(define *chicken-install* - (normalize-pathname (make-pathname *prefix* "bin/chicken-install"))) - -(define *eggs* (directory *eggdir*)) - -(define (find-newest egg) - (let* ((ed (make-pathname *eggdir* egg)) - (tagsdir (directory-exists? (make-pathname ed "tags"))) - (trunkdir (directory-exists? (make-pathname ed "trunk")))) - (cond ((and *trunk* trunkdir) trunkdir) - (tagsdir - (let ((tags (sort (directory tagsdir) version>=?))) - (if (null? tags) - (or trunkdir ed) - (make-pathname ed (string-append "tags/" (car tags)))))) - (else (or trunkdir ed))))) - -(define (report egg msg . args) - (printf "~a..~?~%" (make-string (max 2 (- 32 (string-length egg))) #\.) - msg args) ) - -(define *errlogfile* "mini-salmonella.errors.log") -(define *logfile* "mini-salmonella.log") -(define *tmplogfile* "mini-salmonella.tmp.log") - -(on-exit (lambda () (delete-file* *tmplogfile*))) - -(define (copy-log egg file) - (let ((log (with-input-from-file file read-string))) - (with-output-to-file *errlogfile* - (lambda () - (print #\newline egg #\:) - (display log)) - #:append))) - -(define *failed* 0) -(define *succeeded* 0) - -(define (install-egg egg dir) - (let ((command - (conc - *chicken-install* " -force " - (if *run-tests* "-test " "") - (if *trunk* "-trunk " "") - (if *download* - "" - (string-append "-t local -l " (normalize-pathname *eggdir*) " ")) - egg " " - (cond ((not *debug*) - (delete-file* (string-append *logfile* ".out")) - (sprintf "2>~a >>~a.out" *tmplogfile* *logfile*)) - (else ""))))) - (when *debug* - (print " " command)) - (let ((status (system command))) - (cond ((zero? status) - (report egg "OK") - (set! *succeeded* (add1 *succeeded*))) - (else - (report egg "FAILED") - (set! *failed* (add1 *failed*)) - (unless *debug* (copy-log egg *tmplogfile*))))))) - -(delete-file* *errlogfile*) -(delete-file* *logfile*) - -(for-each - (lambda (egg) - (and-let* ((dir (find-newest egg))) - (if *debug* - (print "\n\n######################################## " egg "\n") - (print* egg)) - (cleanup-repository) - (let ((meta (file-exists? (make-pathname dir egg "meta")))) - (if meta - (let ((setup (file-exists? (make-pathname dir egg "setup")))) - (if setup - (install-egg egg dir) - (report egg "<no .setup script>")) ) - (report egg "<no .meta file>"))))) - (sort (directory *eggdir*) string<?)) - -(print "\nSucceeded: " *succeeded* ", failed: " *failed* ", total: " - (+ *succeeded* *failed*)) - -) -- 2.47.3
