Skip to content

Commit

Permalink
workflow: Make sleep time a variable
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasHabets committed Jun 13, 2024
1 parent dec639c commit 303700f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ jobs:
- name: make distcheck with optional deps
run: make distcheck
- name: end to end tests
run: sudo bash -x ./tests/run
run: sudo bash -x ./tests/run 10
2 changes: 1 addition & 1 deletion src/arping.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ drop_fs_root()
struct passwd *pw;
errno = 0;
if (!(pw = getpwnam(chroot_user))) {
if (verbose) {
if (verbose > 1) {
printf("arping: getpwnam(%s): %s\n",
chroot_user, strerror(errno));
}
Expand Down
14 changes: 7 additions & 7 deletions tests/run
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ run_test() {
PID=$!

# wait for tcpdump to wake up.
sleep 10
sleep "${SLEEP?}"

# Run arping.
set +e
Expand All @@ -77,16 +77,15 @@ run_test() {
echo "FAIL: wrong output:"
echo "----"
echo "${OUT?}"
echo "${OUT?}" > a
#echo "${OUT?}" > a
echo "---- Should match -----"
cat "tests/${NAME?}.out"
exit 1
fi

sleep 10

# Wait for tcpdump to see the packets.
sleep "${SLEEP?}"
kill -INT "${PID?}"
sleep 10
kill -9 "${PID?}" || true
wait "${PID?}" || true

TXT="$(mktemp)"
Expand Down Expand Up @@ -170,6 +169,7 @@ run_tests() {

main() {
cd "$(dirname $0)/.."
SLEEP="${1:-0.1}"
setup

run_tests
Expand All @@ -178,4 +178,4 @@ main() {
echo "All OK"
}

main
main "$@"

0 comments on commit 303700f

Please sign in to comment.