Skip to content

Commit 8f072da

Browse files
committed
Add more tests
Hopefully, this helps us catch more missing functionality.
1 parent 9d45ba2 commit 8f072da

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

Diff for: .test/config.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
3+
# https://github.com/docker-library/official-images/blob/618a85a87796c8bbea059011d94d888dc7554158/test/config.sh
4+
5+
imageTests+=(
6+
[bash]='bash-optional-features'
7+
)

Diff for: .test/tests/bash-optional-features/run.sh

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/usr/bin/env bash
2+
set -Eeuo pipefail
3+
4+
# there's a lot of commands we expect Bash to have, but that it might not due to compilation quirks
5+
# see https://github.com/tianon/docker-bash/pull/45
6+
# and https://www.gnu.org/software/bash/manual/html_node/Optional-Features.html#:~:text=unless%20the%20operating%20system%20does%20not%20provide%20the%20necessary%20support
7+
8+
image="$1"
9+
10+
args=( --rm --interactive )
11+
if [ -t 0 ] && [ -t 1 ]; then
12+
args+=( --tty )
13+
fi
14+
15+
docker run "${args[@]}" "$image" -Eeuo pipefail -xc '
16+
# --enable-array-variables 😏
17+
cmds=(
18+
# --enable-alias
19+
alias unalias
20+
# --enable-command-timing
21+
time
22+
# --enable-cond-command
23+
"[["
24+
# --enable-directory-stack
25+
pushd popd dirs
26+
# --enable-disabled-builtins
27+
builtin enable
28+
# --enable-help-builtin
29+
help
30+
# --enable-history
31+
fc history
32+
# --enable-job-control
33+
bg fg jobs kill wait disown suspend
34+
# --enable-progcomp
35+
complete
36+
# --enable-select
37+
select
38+
)
39+
if [ "${BASH_VERSINFO:-0}" -ge 4 ]; then
40+
# Bash 3.0 does not support arr+=( ... ) and balks at this syntax even in an optional block 😂
41+
cmds=( "${cmds[@]}"
42+
# --enable-coprocesses
43+
coproc
44+
)
45+
fi
46+
for cmd in "${cmds[@]}"; do
47+
PATH= command -v "$cmd"
48+
done
49+
'

0 commit comments

Comments
 (0)