-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from self-five/tests
Add more tests
- Loading branch information
Showing
2 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
|
||
# https://github.com/docker-library/official-images/blob/618a85a87796c8bbea059011d94d888dc7554158/test/config.sh | ||
|
||
imageTests+=( | ||
[bash]='bash-optional-features' | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/usr/bin/env bash | ||
set -Eeuo pipefail | ||
|
||
# there's a lot of commands we expect Bash to have, but that it might not due to compilation quirks | ||
# see https://github.com/tianon/docker-bash/pull/45 | ||
# and https://www.gnu.org/software/bash/manual/html_node/Optional-Features.html#:~:text=unless%20the%20operating%20system%20does%20not%20provide%20the%20necessary%20support | ||
|
||
image="$1" | ||
|
||
args=( --rm --interactive ) | ||
if [ -t 0 ] && [ -t 1 ]; then | ||
args+=( --tty ) | ||
fi | ||
|
||
docker run "${args[@]}" "$image" -Eeuo pipefail -xc ' | ||
# --enable-array-variables 😏 | ||
cmds=( | ||
# --enable-alias | ||
alias unalias | ||
# --enable-command-timing | ||
time | ||
# --enable-cond-command | ||
"[[" | ||
# --enable-directory-stack | ||
pushd popd dirs | ||
# --enable-disabled-builtins | ||
builtin enable | ||
# --enable-help-builtin | ||
help | ||
# --enable-history | ||
fc history | ||
# --enable-job-control | ||
bg fg jobs kill wait disown suspend | ||
# --enable-progcomp | ||
complete | ||
# --enable-select | ||
select | ||
) | ||
if [ "${BASH_VERSINFO:-0}" -ge 4 ]; then | ||
# Bash 3.0 does not support arr+=( ... ) and balks at this syntax even in an optional block 😂 | ||
cmds=( "${cmds[@]}" | ||
# --enable-coprocesses | ||
coproc | ||
) | ||
fi | ||
for cmd in "${cmds[@]}"; do | ||
PATH= command -v "$cmd" | ||
done | ||
' |