Skip to content

Commit 8975bc8

Browse files
add additional SFTP test
1 parent f9fd634 commit 8975bc8

File tree

1 file changed

+91
-6
lines changed

1 file changed

+91
-6
lines changed

.github/workflows/sftp-test.yml

Lines changed: 91 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
id: cache-wolfssl
4343
with:
4444
path: build-dir/
45-
key: wolfssh-sftp-wolfssl-${{ matrix.wolfssl }}-${{ matrix.os }}
45+
key: wolfssh-sftp-wolfssl-${{ matrix.wolfssl }}-${{ matrix.os }}-keygen
4646
lookup-only: true
4747

4848
- name: Checkout, build, and install wolfssl
@@ -52,7 +52,7 @@ jobs:
5252
repository: wolfssl/wolfssl
5353
ref: ${{ matrix.wolfssl }}
5454
path: wolfssl
55-
configure: --enable-ssh
55+
configure: --enable-ssh --enable-keygen
5656
check: false
5757
install: true
5858

@@ -73,7 +73,7 @@ jobs:
7373
uses: actions/cache@v4
7474
with:
7575
path: build-dir/
76-
key: wolfssh-sftp-wolfssl-${{ matrix.wolfssl }}-${{ matrix.os }}
76+
key: wolfssh-sftp-wolfssl-${{ matrix.wolfssl }}-${{ matrix.os }}-keygen
7777
fail-on-cache-miss: true
7878

7979
- uses: actions/checkout@v4
@@ -124,13 +124,13 @@ jobs:
124124
expect eof
125125
EOF
126126
chmod +x /tmp/sftp_test.exp
127-
127+
128128
# Install expect
129129
sudo apt-get update && sudo apt-get install -y expect
130-
130+
131131
# Run the expect script
132132
/tmp/sftp_test.exp
133-
133+
134134
# Verify the files match
135135
echo "Verifying file integrity..."
136136
if cmp -s /tmp/test.dat /tmp/sftp_test_dir/test_received.dat; then
@@ -139,3 +139,88 @@ jobs:
139139
echo "SFTP Test FAILED: Files do not match"
140140
exit 1
141141
fi
142+
143+
build_wolfssh_large_rw:
144+
needs:
145+
- build_wolfssl
146+
- create_matrix
147+
strategy:
148+
fail-fast: false
149+
matrix:
150+
os: [ ubuntu-latest ]
151+
wolfssl: ${{ fromJson(needs.create_matrix.outputs['versions']) }}
152+
name: Test wolfsftp large RW (10MB chunks, 3GB file)
153+
runs-on: ${{ matrix.os }}
154+
timeout-minutes: 20
155+
steps:
156+
- name: Checking cache for wolfssl
157+
uses: actions/cache@v4
158+
with:
159+
path: build-dir/
160+
key: wolfssh-sftp-wolfssl-${{ matrix.wolfssl }}-${{ matrix.os }}-keygen
161+
fail-on-cache-miss: true
162+
163+
- uses: actions/checkout@v4
164+
with:
165+
path: wolfssh/
166+
167+
- name: autogen
168+
working-directory: ./wolfssh/
169+
run: ./autogen.sh
170+
171+
- name: configure
172+
working-directory: ./wolfssh/
173+
run: |
174+
./configure --enable-all \
175+
LDFLAGS="-L${{ github.workspace }}/build-dir/lib" \
176+
CPPFLAGS="-I${{ github.workspace }}/build-dir/include -DWOLFSSH_NO_SFTP_TIMEOUT -DWOLFSSH_MAX_SFTP_RW=10485760 -DWOLFSSH_MAX_CHN_NAMESZ=4200"
177+
178+
- name: make
179+
working-directory: ./wolfssh/
180+
run: make
181+
182+
- name: Create 3GB random test file
183+
working-directory: ./wolfssh/
184+
run: |
185+
dd if=/dev/urandom of=large_test.dat bs=1M count=3072
186+
sha256sum large_test.dat > large_test.dat.sha256
187+
echo "Created 3GB random file, SHA-256: $(cat large_test.dat.sha256)"
188+
189+
- name: Start echoserver
190+
working-directory: ./wolfssh/
191+
run: |
192+
./examples/echoserver/echoserver -N -1 -R /tmp/echoserver_ready -d "$(pwd)" &
193+
echo $! > /tmp/echoserver.pid
194+
for i in $(seq 1 30); do
195+
[ -s /tmp/echoserver_ready ] && break
196+
sleep 0.2
197+
done
198+
if [ ! -s /tmp/echoserver_ready ]; then
199+
echo "ERROR: echoserver failed to start"
200+
exit 1
201+
fi
202+
echo "Echoserver ready on port $(cat /tmp/echoserver_ready)"
203+
204+
- name: SFTP get 3GB file with 10MB chunk size
205+
working-directory: ./wolfssh/
206+
run: |
207+
port=$(cat /tmp/echoserver_ready)
208+
./examples/sftpclient/wolfsftp -N -u jill -P upthehill -p "$port" \
209+
-G -l /tmp/large_test_copy.dat -r "$(pwd)/large_test.dat"
210+
211+
- name: Verify file integrity
212+
working-directory: ./wolfssh/
213+
run: |
214+
expected=$(awk '{print $1}' large_test.dat.sha256)
215+
actual=$(sha256sum /tmp/large_test_copy.dat | awk '{print $1}')
216+
echo "Expected SHA-256: $expected"
217+
echo "Actual SHA-256: $actual"
218+
if [ "$expected" != "$actual" ]; then
219+
echo "FAIL: SHA-256 mismatch"
220+
exit 1
221+
fi
222+
echo "PASS: 3GB SFTP transfer with WOLFSSH_MAX_SFTP_RW=10485760 succeeded"
223+
224+
- name: Stop echoserver
225+
if: always()
226+
run: kill "$(cat /tmp/echoserver.pid)" 2>/dev/null || true

0 commit comments

Comments
 (0)