diff --git a/soil/travis.sh b/soil/travis.sh index 1328ac00f8..6b0ff4ef2c 100755 --- a/soil/travis.sh +++ b/soil/travis.sh @@ -234,8 +234,8 @@ make-job-wwz() { # Note that that index references /web/{base,soil}.css, outside the .wwz # osh-summary.html uses table-sort.js and ajax.js zip -r $wwz \ - index.html _tmp/soil _tmp/spec _tmp/syscall _tmp/benchmark-data \ - _tmp/metrics \ + index.html _tmp/soil _tmp/spec _tmp/stateful \ + _tmp/syscall _tmp/benchmark-data _tmp/metrics \ mycpp/_ninja/*.{html,txt,tsv} mycpp/_ninja/{tasks,gen} \ web/{base,spec-code,spec-tests,spec-cpp,line-counts}.css web/ajax.js \ web/table/table-sort.{css,js} \ diff --git a/soil/worker.sh b/soil/worker.sh index d1e3eb75a9..1681d06a81 100755 --- a/soil/worker.sh +++ b/soil/worker.sh @@ -109,7 +109,7 @@ lint test/lint.sh soil-run - typecheck-slice types/oil-slice.sh soil-run - typecheck-other types/run.sh soil-run - unit test/unit.sh soil-run - -stateful test/stateful.sh soil-run - +stateful test/stateful.sh soil-run _tmp/stateful/index.html parse-errors test/parse-errors.sh soil-run-py - runtime-errors test/runtime-errors.sh run-all-with-osh - oil-runtime-errors test/oil-runtime-errors.sh run-all-with-osh - diff --git a/spec/stateful/interactive.py b/spec/stateful/interactive.py index 4a22f6a7a0..e550bd3f09 100755 --- a/spec/stateful/interactive.py +++ b/spec/stateful/interactive.py @@ -28,7 +28,7 @@ def t9(sh): if __name__ == '__main__': try: - harness.main(sys.argv) + sys.exit(harness.main(sys.argv)) except RuntimeError as e: print('FATAL: %s' % e, file=sys.stderr) sys.exit(1) diff --git a/spec/stateful/job_control.py b/spec/stateful/job_control.py index 1e3953e30f..8f2a7dba7e 100755 --- a/spec/stateful/job_control.py +++ b/spec/stateful/job_control.py @@ -67,7 +67,7 @@ def t8(sh): if __name__ == '__main__': try: - harness.main(sys.argv) + sys.exit(harness.main(sys.argv)) except RuntimeError as e: print('FATAL: %s' % e, file=sys.stderr) sys.exit(1) diff --git a/spec/stateful/signals.py b/spec/stateful/signals.py index 7a70e1377f..3cecdfd880 100755 --- a/spec/stateful/signals.py +++ b/spec/stateful/signals.py @@ -292,7 +292,7 @@ def t5(sh): if __name__ == '__main__': try: - harness.main(sys.argv) + sys.exit(harness.main(sys.argv)) except RuntimeError as e: print('FATAL: %s' % e, file=sys.stderr) sys.exit(1) diff --git a/test/spec-runner.sh b/test/spec-runner.sh index 36aeae3bdd..132457be13 100755 --- a/test/spec-runner.sh +++ b/test/spec-runner.sh @@ -96,7 +96,7 @@ manifest() { #ls -l _tmp/spec/SUITE-*.txt } -run-cases() { +run-file() { local spec_name=$1 log "__ $spec_name" @@ -321,7 +321,7 @@ _all-parallel() { # The exit codes are recorded in files for html-summary to aggregate. set +o errexit - head -n $NUM_SPEC_TASKS $manifest | xargs -n 1 -P $MAX_PROCS -- $0 run-cases + head -n $NUM_SPEC_TASKS $manifest | xargs -n 1 -P $MAX_PROCS -- $0 run-file set -o errexit #ls -l _tmp/spec @@ -336,7 +336,7 @@ _all-parallel() { all-parallel() { ### Run spec tests in parallel. - # Note that this function doesn't fail because 'run-cases' saves the status + # Note that this function doesn't fail because 'run-file' saves the status # to a file. time $0 _all-parallel "$@" diff --git a/test/stateful.sh b/test/stateful.sh index 6a5330df58..4ae214b036 100755 --- a/test/stateful.sh +++ b/test/stateful.sh @@ -15,26 +15,17 @@ set -o nounset set -o pipefail set -o errexit -export PYTHONPATH=. - -readonly OSH=bin/osh +source test/common.sh # run-task-with-status # This uses ../oil_DEPS/spec-bin/{bash,dash} if they exist -source build/dev-shell.sh - -# Use system shells until the Soil CI container has spec-bin # The ovm-tarball container that has spec-bin doesn't have python3 :-( Really # we should build another container -readonly BASH=bash -readonly DASH=dash - -run() { - ### Wrapper for PYTHONPATH +source build/dev-shell.sh - spec/stateful/signals.py "$@" +export PYTHONPATH=. -} +readonly BASE_DIR=_tmp/stateful signals() { spec/stateful/signals.py --osh-failures-allowed 1 \ @@ -51,15 +42,107 @@ job-control() { $OSH bash "$@" } +manifest() { + ### List all tests + + cat < + + + +

Stateful Tests with pexpect

+ + + + + + + + + +EOF + + local all_passed=0 + + shopt -s lastpipe # to mutate all_passed in while + + manifest | while read spec_name; do + read status elapsed < $BASE_DIR/${spec_name}.task.txt + echo '' + echo "" + echo "" + + case $status in + (0) # exit code 0 is success + echo " " + ;; + (*) # everything else is a failure + # Add extra text to make red stand out. + echo " " + + # Mark failure + all_passed=1 + ;; + esac + + echo '' + done + + cat < + + +EOF + + log "all_passed = $all_passed" + + return $all_passed +} + all() { ### Run all tests + mkdir -p $BASE_DIR + # TODO: The reports for each file should be written and uploaded. - # Can we reuse the test/spec table? - signals - interactive - job-control + set +o errexit + manifest | xargs -n 1 -- $0 run-file + set -o errexit + + # Returns whether all passed + html-summary > $BASE_DIR/index.html } soil-run() {
TaskElapsedStatus
$spec_name $elapsed$statusstatus: $status