2021-09-15 09:41:34 -04:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
2022-01-21 12:52:05 -06:00
|
|
|
set -eo pipefail
|
2021-09-15 09:41:34 -04:00
|
|
|
|
|
|
|
|
if ! test -d ../bfs; then
|
|
|
|
|
echo "Could not find ../bfs"
|
|
|
|
|
echo "git clone https://github.com/tavianator/bfs.git"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# build the rust implementation
|
|
|
|
|
cargo build --release
|
|
|
|
|
FIND=$(readlink -f target/release/find)
|
|
|
|
|
|
2024-08-17 03:13:30 -04:00
|
|
|
cd ../bfs
|
|
|
|
|
./configure NOLIBS=y
|
|
|
|
|
make -j "$(nproc)" bin/tests/{mksock,xtouch}
|
2021-09-15 09:41:34 -04:00
|
|
|
|
|
|
|
|
# Run the GNU find compatibility tests by default
|
|
|
|
|
if test "$#" -eq 0; then
|
2022-05-25 13:22:02 -04:00
|
|
|
set -- --verbose=tests --gnu --sudo
|
2021-09-15 09:41:34 -04:00
|
|
|
fi
|
|
|
|
|
|
2024-08-17 03:13:30 -04:00
|
|
|
LOG_FILE=tests.log
|
|
|
|
|
./tests/tests.sh --bfs="$FIND" "$@" 2>&1 | tee "$LOG_FILE" || :
|
2022-02-22 12:34:31 -05:00
|
|
|
|
2024-03-19 13:29:08 -04:00
|
|
|
PASS=$(sed -En 's|^\[PASS] *([0-9]+) / .*|\1|p' "$LOG_FILE")
|
|
|
|
|
SKIP=$(sed -En 's|^\[SKIP] *([0-9]+) / .*|\1|p' "$LOG_FILE")
|
|
|
|
|
FAIL=$(sed -En 's|^\[FAIL] *([0-9]+) / .*|\1|p' "$LOG_FILE")
|
2022-02-23 21:13:02 -05:00
|
|
|
|
|
|
|
|
# Default any missing numbers to zero (e.g. no tests skipped)
|
|
|
|
|
: ${PASS:=0}
|
|
|
|
|
: ${SKIP:=0}
|
|
|
|
|
: ${FAIL:=0}
|
|
|
|
|
|
2022-02-22 12:34:31 -05:00
|
|
|
TOTAL=$((PASS + SKIP + FAIL))
|
|
|
|
|
if (( TOTAL <= 1 )); then
|
|
|
|
|
echo "Error in the execution, failing early"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
output="BFS tests summary = TOTAL: $TOTAL / PASS: $PASS / SKIP: $SKIP / FAIL: $FAIL"
|
|
|
|
|
echo "${output}"
|
|
|
|
|
if (( FAIL > 0 )); then echo "::warning ::${output}"; fi
|
|
|
|
|
|
|
|
|
|
jq -n \
|
|
|
|
|
--arg date "$(date --rfc-email)" \
|
|
|
|
|
--arg sha "$GITHUB_SHA" \
|
|
|
|
|
--arg total "$TOTAL" \
|
|
|
|
|
--arg pass "$PASS" \
|
|
|
|
|
--arg skip "$SKIP" \
|
|
|
|
|
--arg fail "$FAIL" \
|
2024-08-17 03:13:30 -04:00
|
|
|
'{($date): { sha: $sha, total: $total, pass: $pass, skip: $skip, fail: $fail, }}' > ../bfs-result.json
|