Skip to content

Commit 54e2be6

Browse files
yosuke-wolfsslejohnstown
authored andcommitted
sanitizer.yml, openssh-interop.test: fail instead of skipping in CI
- openssh-interop.test fails at each skip point when WOLFSSH_TEST_REQUIRE_OPENSSH=1, and skips through skip_rest() for the sshd and ssh-agent parts. - sanitizer.yml sets WOLFSSH_TEST_REQUIRE_OPENSSH=1 for make check.
1 parent f8405e2 commit 54e2be6

2 files changed

Lines changed: 30 additions & 25 deletions

File tree

‎.github/workflows/sanitizer.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ jobs:
102102
make -j$(nproc)
103103
104104
- name: Run tests
105+
env:
106+
# The runner has OpenSSH, so openssh-interop.test must run in full.
107+
WOLFSSH_TEST_REQUIRE_OPENSSH: 1
105108
run: timeout -k 30 300 make check
106109

107110
- name: Show test logs on failure

‎scripts/openssh-interop.test‎

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,29 @@ fail() {
112112
exit 1
113113
}
114114

115+
# Set WOLFSSH_TEST_REQUIRE_OPENSSH=1 where every part must run, as in CI;
116+
# each skip below is then a failure.
117+
require_openssh=${WOLFSSH_TEST_REQUIRE_OPENSSH:-0}
118+
115119
skip() {
120+
if [ "$require_openssh" = "1" ]; then
121+
fail "$1; WOLFSSH_TEST_REQUIRE_OPENSSH=1 does not allow skipping"
122+
fi
116123
printf '%s, skipping\n' "$1"
117124
rm -rf -- "$work_dir"
118125
exit 77
119126
}
120127

128+
# Skip the part named by $2, keeping the parts that already passed.
129+
skip_rest() {
130+
if [ "$require_openssh" = "1" ]; then
131+
fail "$1; WOLFSSH_TEST_REQUIRE_OPENSSH=1 does not allow skipping $2"
132+
fi
133+
echo "$1, skipping $2"
134+
do_cleanup
135+
exit 0
136+
}
137+
121138
command -v ssh > /dev/null 2>&1 || skip "no ssh in the path"
122139

123140
ssh_version=`ssh -V 2>&1`
@@ -279,19 +296,13 @@ if [ -z "$sshd_bin" ]; then
279296
fi
280297

281298
if [ -z "$sshd_bin" ] || [ ! -x "$sshd_bin" ]; then
282-
echo "no sshd on this machine, skipping the wolfSSH client half"
283-
do_cleanup
284-
exit 0
299+
skip_rest "no sshd on this machine" "the wolfSSH client half"
285300
fi
286301
if ! command -v ssh-keygen > /dev/null 2>&1; then
287-
echo "no ssh-keygen, skipping the wolfSSH client half"
288-
do_cleanup
289-
exit 0
302+
skip_rest "no ssh-keygen" "the wolfSSH client half"
290303
fi
291304
if [ ! -x ./examples/client/client ]; then
292-
echo "the example client wasn't built, skipping the wolfSSH client half"
293-
do_cleanup
294-
exit 0
305+
skip_rest "the example client wasn't built" "the wolfSSH client half"
295306
fi
296307

297308
echo "Test the wolfSSH client against OpenSSH's sshd"
@@ -358,10 +369,8 @@ while [ "$counter" -lt 5 ]; do
358369
done
359370

360371
if [ "$sshd_port" -eq 0 ]; then
361-
echo "sshd wouldn't start here, skipping the wolfSSH client half"
362372
[ -s "$sshd_log" ] && tail -n 5 "$sshd_log"
363-
do_cleanup
364-
exit 0
373+
skip_rest "sshd wouldn't start here" "the wolfSSH client half"
365374
fi
366375

367376
# The version gate above covered the client. This sshd was found on its own
@@ -372,10 +381,9 @@ sshd_version=`sed -n 's/.*sshd version \(OpenSSH_[^,]*\).*/\1/p' \
372381
"$sshd_log" | head -n 1`
373382
has_strict_kex "$sshd_version"
374383
if [ $? -ne 0 ]; then
375-
echo "$sshd_bin is ${sshd_version:-an unreadable version}, no strict KEX,"
376-
echo "skipping the wolfSSH client half"
377-
do_cleanup
378-
exit 0
384+
skip_rest \
385+
"$sshd_bin is ${sshd_version:-an unreadable version}, no strict KEX" \
386+
"the wolfSSH client half"
379387
fi
380388

381389
# sshd authenticates the user running this test, with one of the canned
@@ -455,15 +463,11 @@ echo "the wolfSSH client negotiated strict KEX with sshd"
455463

456464
# Part 3 needs the client's agent support and OpenSSH's agent tools.
457465
if ! ./examples/client/client '-?' 2>&1 | grep -q 'SSH-AGENT'; then
458-
echo "the example client has no agent support, skipping the agent half"
459-
do_cleanup
460-
exit 0
466+
skip_rest "the example client has no agent support" "the agent half"
461467
fi
462468
if ! command -v ssh-agent > /dev/null 2>&1 ||
463469
! command -v ssh-add > /dev/null 2>&1; then
464-
echo "no ssh-agent or ssh-add, skipping the agent half"
465-
do_cleanup
466-
exit 0
470+
skip_rest "no ssh-agent or ssh-add" "the agent half"
467471
fi
468472

469473
# The RSA signature algorithms this client was built with; -E lists them
@@ -475,9 +479,7 @@ for alg in rsa-sha2-256 rsa-sha2-512; do
475479
fi
476480
done
477481
if [ -z "$agent_rsa_algs" ]; then
478-
echo "the client has no rsa-sha2 algorithms, skipping the agent half"
479-
do_cleanup
480-
exit 0
482+
skip_rest "the client has no rsa-sha2 algorithms" "the agent half"
481483
fi
482484

483485
echo "Test the wolfSSH client signing through ssh-agent for sshd"

0 commit comments

Comments
 (0)