| 1 | #!/usr/bin/env bash
|
| 2 | #
|
| 3 | # Usage:
|
| 4 | # test/spec-util.sh <function name>
|
| 5 |
|
| 6 | set -o nounset
|
| 7 | set -o pipefail
|
| 8 | set -o errexit
|
| 9 |
|
| 10 | REPO_ROOT=$(cd "$(dirname $0)/.."; pwd)
|
| 11 |
|
| 12 | source test/spec-common.sh
|
| 13 | source devtools/run-task.sh
|
| 14 |
|
| 15 | run-file-with-osh-bash() {
|
| 16 | local spec_name=$1
|
| 17 | shift
|
| 18 |
|
| 19 | # Note: there's no longer a way to run with 2 shells? We could do
|
| 20 | # test/sh_spec.py --shells-from-argv foo.test.sh osh bash
|
| 21 | echo TODO
|
| 22 | }
|
| 23 |
|
| 24 | _run-file-with-one() {
|
| 25 | local shell=$1
|
| 26 | local spec_name=$2
|
| 27 | shift 2
|
| 28 |
|
| 29 | # 2023-06: note --timeout 10 seems to make every test hang
|
| 30 | # I guess $SH -i doesn't run well like that
|
| 31 | sh-spec spec/$spec_name.test.sh \
|
| 32 | --oils-bin-dir $PWD/bin \
|
| 33 | -d \
|
| 34 | -t \
|
| 35 | $shell "$@"
|
| 36 | }
|
| 37 |
|
| 38 | run-file-with-osh() { _run-file-with-one $REPO_ROOT/bin/osh "$@"; }
|
| 39 | run-file-with-bash() { _run-file-with-one bash "$@"; }
|
| 40 |
|
| 41 | run-task "$@"
|