Skip to content

Commit

Permalink
[test/gold] Use spec-bin busybox.
Browse files Browse the repository at this point in the history
This uncovered a behavior change / bug in gold/readlink.sh that we still
need to fix.

- soil: Add test/arena, since we do it on release.
- Move more unautomated files from spec/ to demo/
  • Loading branch information
Andy C committed Feb 10, 2022
1 parent e807821 commit 6c68a0a
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 9 deletions.
5 changes: 4 additions & 1 deletion spec/unicode.sh → demo/04-unicode.sh
@@ -1,11 +1,14 @@
#!/usr/bin/env bash
#
# Usage:
# ./unicode.sh <function name>
# demo/04-unicode.sh <function name>
#
# TODO: Test what happens if you read binary data into a $(command sub)
# - internal NUL
# - invalid utf-8 sequence
#
# It would be nice to move some of this into test/gold? It depends on the
# locale.

set -o nounset
set -o pipefail
Expand Down
3 changes: 3 additions & 0 deletions spec/line-number.sh → demo/05-line-number.sh
Expand Up @@ -3,6 +3,9 @@
# Demo of line numbers, inspired by:
#
# http://lists.gnu.org/archive/html/bug-bash/2016-12/msg00119.html
#
# TODO: would be nice to move into test/gold, but OSH doesn't have the ERR trap
# yet

# This doesn't appear necessary:
#shopt -s extdebug
Expand Down
4 changes: 3 additions & 1 deletion spec/history.sh → demo/06-history.sh
@@ -1,7 +1,9 @@
#!/usr/bin/env bash
#
# Usage:
# ./history.sh <function name>
# demo/06-history.sh <function name>
#
# TODO: move into test/gold -- OSH doesn't have histexpand.

set -o nounset
set -o pipefail
Expand Down
1 change: 1 addition & 0 deletions soil/worker.sh
Expand Up @@ -203,6 +203,7 @@ syscall-by-code test/syscall.sh by-code _tmp/syscall/by-code.tx
syscall-by-input test/syscall.sh by-input _tmp/syscall/by-input.txt
osh-spec test/spec.sh soil-run-osh _tmp/spec/survey/osh.html
gold test/gold.sh all-passing -
arena test/arena.sh all-passing -
make-tarball devtools/release.sh quick-oil-tarball _release/oil.tar
test-tarball build/test.sh oil-tar -
EOF
Expand Down
8 changes: 4 additions & 4 deletions test/gold.sh
Expand Up @@ -127,9 +127,7 @@ declare() { _compare $GOLD_DIR/declare.sh demo; }
# Needs declare -p
scope() { _compare $GOLD_DIR/scope.sh; }

readlink-case() {
$GOLD_DIR/readlink.sh compare
}
test-readlink() { $GOLD_DIR/readlink.sh compare; }

errexit() { _compare $GOLD_DIR/errexit.sh all; }

Expand Down Expand Up @@ -194,7 +192,9 @@ readonly -a PASSING=(
one-spec-test
html-summary
gen-module-init
readlink-case

# TODO: make it match new busybox version and GNU readlink!
# test-readlink

errexit
errexit-confusion
Expand Down
6 changes: 3 additions & 3 deletions test/gold/readlink.sh
Expand Up @@ -20,6 +20,7 @@ test-readlink() {
readlink -f libc.so
echo $?

# busybox 1.35.0 changed behavior here! It now matches GNU readlink.
readlink -f /nonexistent
echo $?

Expand All @@ -37,10 +38,9 @@ test-readlink() {
# For this readlink gold test, we need a custom test driver.
compare() {
mkdir -p _tmp/gold-bin
ln -s -f /bin/busybox _tmp/gold-bin/readlink
ln -s -f -v $PWD/../oil_DEPS/spec-bin/busybox _tmp/gold-bin/readlink

_tmp/gold-bin/readlink --help 2>/dev/null
if test $? -ne 0; then
if ! _tmp/gold-bin/readlink --help; then
echo "busybox readlink not working"
fi

Expand Down

0 comments on commit 6c68a0a

Please sign in to comment.