#!/bin/sh # brintOS wasm32-hwjs: poky's libssh2 run-ptest with automake's per-case artifacts # moved off the ptest directory. Same three cases, same order, same test-driver, # same PASS:/FAIL: protocol -- the difference is where the .log and .trs files go. # # WHY. The rootfs is served READ-ONLY over virtio-fs at browser runtime, and # upstream's line writes both artifacts into the installed ptest directory: # # ./../test-driver --test-name $test --log-file ../$test.log --trs-file ../$test.trs ... # # Every one of those redirects fails there. test-driver runs the program with its # stdout and stderr redirected INTO the log file, so a log it cannot create means # the program never runs at all, and the case is reported FAIL whatever libssh2 # would have done -- all three of them, for a filesystem reason. The artifacts are # only ever read on a failure, so they go to a writable scratch directory instead # and the tail of a failing case is echoed inline, where a reader of the # ptest-runner log will actually see it (upstream leaves it in a file the reader # would have to go and find). # # The cd into tests/ is upstream's and is load-bearing: test_sshd.test resolves # its keys and its openssh_server/ fixtures relative to its own directory. ptestdir=$(dirname "$(readlink -f "$0")") cd "$ptestdir"/tests || exit 1 d=${TMPDIR:-/tmp}/libssh2-ptest.$$ mkdir -p "$d" || exit 1 for test in mansyntax.sh test_simple test_sshd.test; do ../test-driver --test-name "$test" \ --log-file "$d/$test.log" --trs-file "$d/$test.trs" \ --color-tests no --enable-hard-errors yes --expect-failure no \ -- ./"$test" if [ -f "$d/$test.log" ] && grep -q '^:test-result: FAIL' "$d/$test.trs" 2>/dev/null; then sed -n 's/^/ /p' "$d/$test.log" | tail -12 fi done rm -rf "$d"