#!/bin/bash # # An absolute BASH_SHELL is taken verbatim by AC_PATH_PROGS and a relative one is dropped # for the search result, so configure has to check what it ends up with: BASH_SHELL=/bin/sh # otherwise puts #895 back and only shows up at "make check" or "make deb" (#908). set -euo pipefail # shellcheck source=tests/testlib.sh . "$(dirname "$0")/testlib.sh" # shellcheck source=tests/proclib.sh . "$(dirname "$0")/proclib.sh" sh=${BASH_SHELL:-} test -n "$sh" || { echo "BASH_SHELL is empty; tests/Makefile.am must export the configured value" >&2 exit 1 } configure="${abs_top_srcdir:-}/configure" test -r "$configure" || { echo "no configure script at $configure; tests/Makefile.am must export abs_top_srcdir" >&2 exit 1 } tmp=$(mktemp -d) cleanup() { # O_RDWR never blocks, and it releases whatever is left stuck opening the FIFO for read. exec 9<>"$tmp/fifo" && exec 9>&- rm -rf "$tmp" } cleanup_push cleanup # Symlink farm, not the real srcdir: an in-tree config.status makes autoconf refuse it. mkdir "$tmp/src" for f in "$abs_top_srcdir"/*; do case "${f##*/}" in config.status | config.log | config.h | stamp-h1 | Makefile) continue ;; esac ln -s "$f" "$tmp/src/" done mkdir "$tmp/notexec" "$tmp/with space" "$tmp/fakebin" : >"$tmp/notexec/bash" chmod 644 "$tmp/notexec/bash" ln -s "$sh" "$tmp/mybash" ln -s "$sh" "$tmp/with space/bash" ln -s "$sh" "$tmp/sh" # bash invoked as "sh" enters POSIX mode # A "bash" the PATH search will find first, and that answers -c like any other shell. printf '#!/bin/sh\nexec /bin/sh "$@"\n' >"$tmp/fakebin/bash" chmod 755 "$tmp/fakebin/bash" # Executable to "test -x", but bash blocks in open() on one it failed to exec. mkfifo "$tmp/fifo" chmod 755 "$tmp/fifo" # Sampled rather than polled per second: the size read is a fork, and an emulated # host pays for it. SILENCE clears the slowest single configure probe there. SAMPLE=5 SILENCE=${HTTRACK_CONFIGURE_SILENCE:-120} RESERVE=15 # what killing the run and skipping still needs of the budget n=0 cases=16 # reject/accept calls below; pinned again once they have all run status=0 log= rundir= took=0 # What run() launches, so the checks below can hand it a child that hangs or one that # only crawls; nothing else may override it. configure_cmd=(bash "$tmp/src/configure" --disable-https) run() { # run