Permalink
Browse files

More cleanup of test structure.

- Move test/smoke.sh to test/osh-usage.sh
- Use a common function in test/common.sh to run and publish all test
  results.

Still need to fix things up in scripts/release.sh.
  • Loading branch information...
Andy Chu
Andy Chu committed Aug 20, 2018
1 parent 10077ba commit fd1ffce08d342e2267843a1be0e14531606ab105
Showing with 59 additions and 24 deletions.
  1. +4 −0 scripts/release.sh
  2. +21 −4 test/common.sh
  3. +1 −6 test/gold.sh
  4. +15 −6 test/{smoke.sh → osh-usage.sh}
  5. +5 −1 test/oshc-deps.sh
  6. +3 −7 test/parse-errors.sh
  7. +10 −0 test/runtime-errors.sh
View
@@ -86,6 +86,8 @@ auto-machine1() {
# osh2oil.txt
# gold.txt
# parse-errors.txt
# runtime-errors.txt
# oshc-deps.txt
# tarball/ # log of building and running the tarball?
# asan/ # spec tests or other?
# # or it can be put under test/{spec,wild}
@@ -169,6 +171,8 @@ _test-release-build() {
test/osh2oil.sh run-for-release
test/gold.sh run-for-release
test/parse-errors.sh run-for-release
test/runtime-errors.sh run-for-release
test/oshc-deps.sh run-for-release
# Just test the release build (not under CPython or byterun. That comes later.)
OSH_LIST="$OSH_RELEASE_BINARY" test/spec.sh all
View
@@ -3,10 +3,6 @@
# Usage:
# ./common.sh <function name>
set -o nounset
set -o pipefail
set -o errexit
# TODO: Remove/rename this. The release process might use the release binary
# instead of this dev binary. test/spec.sh already has its own scheme.
# This is analogous to $OSH_OVM in benchmarks/common.sh.
@@ -74,6 +70,27 @@ run-all() {
echo "All $0 tests passed."
}
# A quick and dirty function to show logs
run-other-suite-for-release() {
local suite_name=$1
local func_name=$2
local out=_tmp/other/${suite_name}.txt
mkdir -p $(dirname $out)
echo
echo "*** Running test suite '$suite_name' ***"
echo
if $func_name 2>&1 | tee $out; then
echo
log "Test suite '$suite_name' ran without errors. Wrote $out"
else
echo
die "Test suite '$suite_name' failed (running $func_name)"
fi
}
if test "$(basename $0)" = 'common.sh'; then
"$@"
fi
View
@@ -159,12 +159,7 @@ all-passing() {
}
run-for-release() {
local out_dir=_tmp/gold
mkdir -p $out_dir
all-passing | tee $out_dir/log.txt
echo "Wrote $out_dir/log.txt"
run-other-suite-for-release gold all-passing
}
"$@"
@@ -1,26 +1,31 @@
#!/usr/bin/env bash
#
# Sanity checks for the shell.
# Test osh usage "from the outside".
#
# Usage:
# ./smoke.sh <function name>
# ./osh-usage.sh <function name>
set -o nounset
set -o pipefail
set -o errexit
source test/common.sh
# Doesn't work in release automation!
manual-oheap-test() {
# Not dumping to terminal
if bin/osh -n --ast-format oheap -c 'echo hi'; then
die "Should have failed"
fi
echo OK
}
ast-formats() {
bin/osh -n -c 'echo hi'
bin/osh -n --ast-format text -c 'echo hi'
bin/osh -n --ast-format abbrev-html -c 'echo hi'
bin/osh -n --ast-format html -c 'echo hi'
# Not dumping to terminal
if bin/osh -n --ast-format oheap -c 'echo hi'; then
die "Should have failed"
fi
local ast_bin=_tmp/smoke-ast.bin
bin/osh -n --ast-format oheap -c 'echo hi' > $ast_bin
ls -l $ast_bin
@@ -138,4 +143,8 @@ all-passing() {
run-all "${PASSING[@]}"
}
run-for-release() {
run-other-suite-for-release osh-usage all-passing
}
"$@"
View
@@ -89,11 +89,15 @@ DEPS
readonly -a PASSING=(
usage
deps
#deps
)
all-passing() {
run-all "${PASSING[@]}"
}
run-for-release() {
run-other-suite-for-release oshc-deps all-passing
}
"$@"
View
@@ -7,6 +7,8 @@ set -o nounset
set -o pipefail
set -o errexit
source test/common.sh
# Run with SH=bash too
SH=${SH:-bin/osh}
@@ -55,14 +57,8 @@ all() {
return 0
}
# TODO:
run-for-release() {
local out=_tmp/parse-errors/log.txt
mkdir -p $(dirname $out)
echo '1'
all >$out 2>&1
echo "Wrote $out"
run-other-suite-for-release parse-errors all
}
"$@"
View
@@ -5,6 +5,8 @@
#
# Run with bash/dash/mksh/zsh.
source test/common.sh
#
# PARSE ERRORS
#
@@ -302,4 +304,12 @@ all() {
done
}
run-all-with-osh() {
bin/osh $0 all
}
run-for-release() {
run-other-suite-for-release runtime-errors run-all-with-osh
}
"$@"

0 comments on commit fd1ffce

Please sign in to comment.