Skip to content

Commit 9e37f8f

Browse files
LinuxJediclaude
andcommitted
Fix contention tests: only SFTP supports non-blocking mode
The test failures revealed that only echoserver (-N flag) and wolfsftp (-N flag) properly support non-blocking I/O handling. wolfscp and wolfsshd do not have the retry logic to handle WS_WANT_READ/WS_WANT_WRITE returns from TEST_BLOCK. Changes: - scp.test: Revert to skip (exit 77) when TEST_BLOCK is detected since wolfscp doesn't support non-blocking mode - network-contention-test.yml: Remove SCP tests, fix SFTP tests to use expect instead of echo pipe (which was causing "fgets error") - Remove paramiko-contention-test.yml: wolfsshd doesn't support TEST_BLOCK (hangs during SSH handshake) The remaining SFTP contention tests properly exercise the non-blocking code paths using echoserver -N and wolfsftp -N. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 6a6a371 commit 9e37f8f

File tree

3 files changed

+39
-331
lines changed

3 files changed

+39
-331
lines changed

.github/workflows/network-contention-test.yml

Lines changed: 24 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ jobs:
107107
timeout-minutes: 10
108108
run: ./scripts/sftp.test
109109

110+
- name: Install expect for extended tests
111+
run: sudo apt-get update && sudo apt-get install -y expect
112+
110113
- name: Create large test files
111114
run: |
112115
dd if=/dev/urandom of=/tmp/test_1kb.dat bs=1K count=1
@@ -125,9 +128,27 @@ jobs:
125128
SERVER_PID=$!
126129
sleep 2
127130
131+
# Create expect script for file transfers
132+
cat > /tmp/sftp_test.exp << 'EXPECTEOF'
133+
#!/usr/bin/expect -f
134+
set timeout 120
135+
set testfile [lindex $argv 0]
136+
set outfile [lindex $argv 1]
137+
138+
spawn ./examples/sftpclient/wolfsftp -N -h 127.0.0.1 -p 22222 -u jill
139+
expect "Password:"
140+
send "upthehill\r"
141+
expect "wolfSSH sftp>"
142+
send "get $testfile $outfile\r"
143+
expect "wolfSSH sftp>"
144+
send "exit\r"
145+
expect eof
146+
EXPECTEOF
147+
chmod +x /tmp/sftp_test.exp
148+
128149
# Test 1KB file transfer
129150
echo "Testing 1KB file transfer..."
130-
echo "get /tmp/test_1kb.dat /tmp/recv_1kb.dat" | ./examples/sftpclient/wolfsftp -N -h 127.0.0.1 -p 22222 -u jill -P upthehill
151+
/tmp/sftp_test.exp /tmp/test_1kb.dat /tmp/recv_1kb.dat
131152
if ! cmp -s /tmp/test_1kb.dat /tmp/recv_1kb.dat; then
132153
echo "FAILED: 1KB file integrity check"
133154
kill $SERVER_PID 2>/dev/null || true
@@ -137,7 +158,7 @@ jobs:
137158
138159
# Test 2MB file transfer
139160
echo "Testing 2MB file transfer..."
140-
echo "get /tmp/test_2mb.dat /tmp/recv_2mb.dat" | ./examples/sftpclient/wolfsftp -N -h 127.0.0.1 -p 22222 -u jill -P upthehill
161+
/tmp/sftp_test.exp /tmp/test_2mb.dat /tmp/recv_2mb.dat
141162
if ! cmp -s /tmp/test_2mb.dat /tmp/recv_2mb.dat; then
142163
echo "FAILED: 2MB file integrity check"
143164
kill $SERVER_PID 2>/dev/null || true
@@ -147,7 +168,7 @@ jobs:
147168
148169
# Test 10MB file transfer
149170
echo "Testing 10MB file transfer..."
150-
echo "get /tmp/test_10mb.dat /tmp/recv_10mb.dat" | ./examples/sftpclient/wolfsftp -N -h 127.0.0.1 -p 22222 -u jill -P upthehill
171+
/tmp/sftp_test.exp /tmp/test_10mb.dat /tmp/recv_10mb.dat
151172
if ! cmp -s /tmp/test_10mb.dat /tmp/recv_10mb.dat; then
152173
echo "FAILED: 10MB file integrity check"
153174
kill $SERVER_PID 2>/dev/null || true
@@ -161,58 +182,3 @@ jobs:
161182
- name: Cleanup network delay
162183
if: always()
163184
run: sudo tc qdisc del dev lo root netem || true
164-
165-
test_scp_contention:
166-
needs:
167-
- build_wolfssl
168-
- create_matrix
169-
strategy:
170-
fail-fast: false
171-
matrix:
172-
os: [ ubuntu-latest ]
173-
wolfssl: ${{ fromJson(needs.create_matrix.outputs['versions']) }}
174-
block_prob: [ 30, 50, 70 ]
175-
name: SCP contention test (prob=${{ matrix.block_prob }}%)
176-
runs-on: ${{ matrix.os }}
177-
timeout-minutes: 15
178-
steps:
179-
- name: Checking cache for wolfssl
180-
uses: actions/cache@v4
181-
with:
182-
path: build-dir/
183-
key: wolfssh-contention-wolfssl-${{ matrix.wolfssl }}-${{ matrix.os }}
184-
fail-on-cache-miss: true
185-
186-
- uses: actions/checkout@v4
187-
with:
188-
path: wolfssh/
189-
190-
- name: autogen
191-
working-directory: ./wolfssh/
192-
run: ./autogen.sh
193-
194-
- name: configure with TEST_BLOCK
195-
working-directory: ./wolfssh/
196-
run: |
197-
./configure --enable-scp \
198-
LDFLAGS="-L${{ github.workspace }}/build-dir/lib" \
199-
CPPFLAGS="-I${{ github.workspace }}/build-dir/include -DWOLFSSH_TEST_BLOCK -DWOLFSSH_BLOCK_PROB=${{ matrix.block_prob }} -DWOLFSSH_NO_FPKI"
200-
201-
- name: make
202-
working-directory: ./wolfssh/
203-
run: make
204-
205-
- name: Setup network delay with tc/netem
206-
run: |
207-
sudo tc qdisc add dev lo root netem delay 10ms 5ms loss 0.1%
208-
echo "Network delay configured:"
209-
tc qdisc show dev lo
210-
211-
- name: Run SCP contention tests
212-
working-directory: ./wolfssh/
213-
timeout-minutes: 10
214-
run: ./scripts/scp.test
215-
216-
- name: Cleanup network delay
217-
if: always()
218-
run: sudo tc qdisc del dev lo root netem || true

.github/workflows/paramiko-contention-test.yml

Lines changed: 0 additions & 252 deletions
This file was deleted.

0 commit comments

Comments
 (0)