OILS / test / spec-util.sh View on Github | oilshell.org

41 lines, 24 significant
1#!/usr/bin/env bash
2#
3# Usage:
4# test/spec-util.sh <function name>
5
6set -o nounset
7set -o pipefail
8set -o errexit
9
10REPO_ROOT=$(cd "$(dirname $0)/.."; pwd)
11
12source test/spec-common.sh
13source devtools/run-task.sh
14
15run-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
38run-file-with-osh() { _run-file-with-one $REPO_ROOT/bin/osh "$@"; }
39run-file-with-bash() { _run-file-with-one bash "$@"; }
40
41run-task "$@"