~ chicken-core (master) /scripts/smoke-test.sh
Trap1#! /bin/sh23set -e45ALL_GOOD="========== ALL GOOD! =========="67usage() {8 cat <<EOF9Usage: $(basename "$0") [-h|-help|--help]1011This script runs basic tests on the chicken-core repository:1213* Creates a distribution tarball with the Scheme code compiled to C.14* Extracts, builds, installs and tests the code from the distribution15 tarball.16* Uses CHICKEN installed out of the distribution tarball to install17 salmonella, and uses it to test an egg with dependencies.1819If everything goes well, you should see2021$ALL_GOOD2223printed to stdout and the script will exit 0.2425The following environment variables are considered by this script:2627* CHICKEN: path to the chicken executable to be used to compile Scheme28 code to C. By default, chicken will be used from \$PATH.2930* MAKE_JOBS: the maximum number of make jobs to use. On systems where31 the nproc program is available, its output will be used by default,32 otherwise 1 will be used.3334* C_COMPILER: the C compiler to use. The default is gcc on Linux and35 cc on BSDs.3637* EGGS: eggs to be used as input for salmonella (space-separated, in38 case of multiple eggs). By default, the base64 egg will be used.39 Note that, unless you tweak setup.defaults to configure40 chicken-install to use egg sources from a local filesystem, testing41 the installation of eggs requires Internet access. If you want to42 skip the egg installation test, set this variable to ":".43EOF44}4546[ "$1" = "-h" ] || [ "$1" = "-help" ] || [ "$1" = "--help" ] && {47 usage48 exit 049}5051set -x5253chicken=${CHICKEN:-chicken}54c_compiler=${C_COMPILER:-gcc}55make="make"5657if command -v nproc >/dev/null; then58 make_jobs=${MAKE_JOBS:-$(nproc)}59else60 make_jobs=${MAKE_JOBS:-1}61fi6263case "$(uname)" in64 *BSD)65 c_compiler=${C_COMPILER:-cc}66 make=gmake67 ;;68esac6970# manual-labor is needed by make dist to generate the HTML files of71# the manual72command -v manual-labor >/dev/null || {73 set +x74 echo "[ERROR] manual-labor could not be found. \75Install it with chicken-install and/or make sure its location is in \$PATH." >&276 exit 177}7879# Using a directory in the current directory as /tmp might be mounted80# on a filesystem that disallows execution81tmpdir=$(mktemp -p "$PWD" -d smoke-test-XXXXXX)8283./configure --chicken "$chicken"84"$make" dist -j "$make_jobs"8586tarball_basename=chicken-$(cat buildversion)87tarball=${tarball_basename}.tar.gz8889mv "$tarball" "$tmpdir"90cd "$tmpdir"91tar xzf "$tarball"92cd "$tarball_basename"93./configure --prefix "$PWD/../chicken" --chicken "$chicken" --c-compiler "$c_compiler"94"$make" -j "$make_jobs"95"$make" install96"$make" check9798eggs=${EGGS:-base64}99# : is not a valid egg name100if [ "$eggs" != ":" ]; then101 ../chicken/bin/chicken-install -v salmonella102 # shellcheck disable=SC2086103 ../chicken/bin/salmonella $eggs104fi105106set +x107echo "$ALL_GOOD"