Permalink
Browse files
Mark the readlink gold test as one that is passing.
It will be run on every release.
Also:
- adjust the test harness a bit
- add comments to the demo
- Loading branch information...
Showing
with
35 additions
and
7 deletions.
-
+5
−0
demo/readlink-demo.sh
-
+28
−6
gold/readlink.sh
-
+2
−1
test/gold.sh
|
|
@@ -11,11 +11,16 @@ two-file-symlinks() { |
|
|
# NOTE: Two levels of symlinks requires readlink -f, not readlink.
|
|
|
ln -s -f $PWD/demo/readlink-demo-target.sh /tmp/demo.sh
|
|
|
ln -s -f /tmp/demo.sh /tmp/demo-level2.sh
|
|
|
|
|
|
# Call readlink-demo-target.sh through TWO file symlinks
|
|
|
/tmp/demo-level2.sh
|
|
|
}
|
|
|
|
|
|
dir-symlink() {
|
|
|
ln -s -f --no-target-directory $PWD/demo/ /tmp/oil-demo
|
|
|
|
|
|
# Calling readlink-demo-target.sh when a PATH component is a symlink to a
|
|
|
# directory
|
|
|
/tmp/oil-demo/readlink-demo-target.sh
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1,13 +1,19 @@ |
|
|
#!/bin/bash
|
|
|
#
|
|
|
# Test case for OSH readlink.
|
|
|
#
|
|
|
# Note: there is also a demo to run like this:
|
|
|
#
|
|
|
# $ demo/readlink-demo.sh all
|
|
|
#
|
|
|
# Usage:
|
|
|
# ./readlink.sh <function name>
|
|
|
|
|
|
set -o nounset
|
|
|
set -o pipefail
|
|
|
#set -o errexit
|
|
|
|
|
|
dir-does-not-exist() {
|
|
|
test-readlink() {
|
|
|
readlink -f _tmp/gold-bin/readlink
|
|
|
echo $?
|
|
|
|
|
|
@@ -21,12 +27,28 @@ dir-does-not-exist() { |
|
|
echo $?
|
|
|
}
|
|
|
|
|
|
# For this readlink gold test, we need a custom test driver.
|
|
|
compare() {
|
|
|
PATH="_tmp/gold-bin:$PATH" $0 dir-does-not-exist > _tmp/busybox-readlink.txt
|
|
|
|
|
|
PATH="bin/:$PATH" $0 dir-does-not-exist > _tmp/osh-readlink.txt
|
|
|
|
|
|
diff -u _tmp/busybox-readlink.txt _tmp/osh-readlink.txt
|
|
|
mkdir -p _tmp/gold-bin
|
|
|
ln -s -f /bin/busybox _tmp/gold-bin/readlink
|
|
|
|
|
|
_tmp/gold-bin/readlink --help 2>/dev/null
|
|
|
if test $? -ne 0; then
|
|
|
echo "busybox readlink not working"
|
|
|
fi
|
|
|
|
|
|
# Use the readlink in busybox.
|
|
|
PATH="_tmp/gold-bin:$PATH" $0 test-readlink > _tmp/busybox-readlink.txt
|
|
|
|
|
|
# Use the readlink in OSH.
|
|
|
PATH="bin/:$PATH" $0 test-readlink > _tmp/osh-readlink.txt
|
|
|
|
|
|
if diff -u _tmp/{busybox,osh}-readlink.txt; then
|
|
|
echo PASS
|
|
|
else
|
|
|
echo FAIL
|
|
|
return 1
|
|
|
fi
|
|
|
}
|
|
|
|
|
|
"$@"
|
|
|
@@ -115,7 +115,7 @@ declare() { _compare gold/declare.sh demo; } |
|
|
scope() { _compare gold/scope.sh; }
|
|
|
|
|
|
readlink-case() {
|
|
|
_compare gold/readlink.sh dir-does-not-exist
|
|
|
gold/readlink.sh compare
|
|
|
}
|
|
|
|
|
|
readonly -a PASSING=(
|
|
|
@@ -144,6 +144,7 @@ readonly -a PASSING=( |
|
|
one-spec-test
|
|
|
html-summary
|
|
|
gen-module-init
|
|
|
readlink-case
|
|
|
|
|
|
# This one takes a little long, but it's realistic.
|
|
|
#wild
|
|
|
|
0 comments on commit
0133ecc