Skip to content

Commit

Permalink
Add more tests
Browse files Browse the repository at this point in the history
Hopefully, this helps us catch more missing functionality.
  • Loading branch information
tianon committed Jan 25, 2025
1 parent 9d45ba2 commit ef3562c
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .test/config.sh
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'
)
44 changes: 44 additions & 0 deletions .test/tests/bash-optional-features/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/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-coprocesses
coproc
# --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
)
for cmd in "${cmds[@]}"; do
PATH= command -v "$cmd"
done
'

0 comments on commit ef3562c

Please sign in to comment.