| 1 | #!/usr/bin/env bash
 | 
| 2 | #
 | 
| 3 | # Build binaries for the spec tests.  This is necessary because they tickle
 | 
| 4 | # behavior in minor versions of each shell.
 | 
| 5 | #
 | 
| 6 | # Usage:
 | 
| 7 | #   test/spec-bin.sh <function name>
 | 
| 8 | #
 | 
| 9 | # Instructions:
 | 
| 10 | #   test/spec-bin.sh download     # Get the right version of every tarball
 | 
| 11 | #   test/spec-bin.sh extract-all  # Extract source
 | 
| 12 | #   test/spec-bin.sh build-all    # Compile
 | 
| 13 | #   test/spec-bin.sh copy-all     # Put them in ../oil_DEPS/spec-bin
 | 
| 14 | #   test/spec-bin.sh test-all     # Run a small smoke test
 | 
| 15 | #
 | 
| 16 | # Once you've run all steps manually and understand how they work, run them
 | 
| 17 | # all at once with:
 | 
| 18 | #
 | 
| 19 | #   test/spec-bin.sh all-steps
 | 
| 20 | 
 | 
| 21 | set -o nounset
 | 
| 22 | set -o pipefail
 | 
| 23 | set -o errexit
 | 
| 24 | 
 | 
| 25 | REPO_ROOT=$(cd "$(dirname $0)/.."; pwd)
 | 
| 26 | 
 | 
| 27 | source devtools/run-task.sh
 | 
| 28 | #source test/spec-common.sh
 | 
| 29 | 
 | 
| 30 | #
 | 
| 31 | # "Non-hermetic"
 | 
| 32 | #
 | 
| 33 | 
 | 
| 34 | link-busybox-ash() {
 | 
| 35 |   ### Non-hermetic ash only used for benchmarks / Soil dev-minimal
 | 
| 36 | 
 | 
| 37 |   # Could delete this at some point
 | 
| 38 |   mkdir -p _tmp/shells
 | 
| 39 |   ln -s -f --verbose "$(which busybox)" _tmp/shells/ash
 | 
| 40 | }
 | 
| 41 | 
 | 
| 42 | # dash and bash should be there by default on Ubuntu.
 | 
| 43 | install-shells-with-apt() {
 | 
| 44 |   ### Non-hermetic shells; test/spec-bin.sh replaces this for most purposes
 | 
| 45 | 
 | 
| 46 |   set -x  # show what needs sudo
 | 
| 47 | 
 | 
| 48 |   # pass -y to install in an automated way
 | 
| 49 |   sudo apt "$@" install busybox-static mksh zsh
 | 
| 50 |   set +x
 | 
| 51 |   link-busybox-ash
 | 
| 52 | }
 | 
| 53 | 
 | 
| 54 | bash-upstream() {
 | 
| 55 |   wget --directory _tmp --no-clobber \
 | 
| 56 |     https://ftp.gnu.org/gnu/bash/bash-5.2.21.tar.gz
 | 
| 57 | }
 | 
| 58 | 
 | 
| 59 | run-task "$@"
 |