~ chicken-core (master) 0fe2e587c2e8f44e30a242a9d5685862ab515c87
commit 0fe2e587c2e8f44e30a242a9d5685862ab515c87
Author: Mario Domenech Goulart <mario@parenteses.org>
AuthorDate: Thu Dec 4 22:35:14 2025 +0100
Commit: Mario Domenech Goulart <mario@parenteses.org>
CommitDate: Sun Dec 14 11:53:40 2025 +0100
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.
diff --git a/.gitignore b/.gitignore
index 82a4d40b..efc8eec8 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 6a5ea4dd..0bf35e8d 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 7ffd4d9c..76d53a6b 100644
--- a/distribution/manifest
+++ b/distribution/manifest
@@ -417,6 +417,7 @@ scripts/compile-all
scripts/compare-documentation-exports.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"
Trap