Skip to content

Commit 25edd49

Browse files
authored
Merge pull request #232 from JeremiahM37/rsync
rsync workflow
2 parents 8aac150 + c51f832 commit 25edd49

File tree

2 files changed

+170
-0
lines changed

2 files changed

+170
-0
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
i#!/bin/bash
2+
# add-rsync-sha-test.sh
3+
# Script to add SHA test to rsync testsuite
4+
# Should be placed in /wolfprovider/.github/scripts/
5+
6+
set -e
7+
8+
# Create the SHA test script in the testsuite directory
9+
cat > testsuite/sha-test.test << 'EOF'
10+
#!/bin/sh
11+
# Use rsync binary from current directory or parent directory
12+
if [ -f "./rsync" ]; then
13+
RSYNC="./rsync"
14+
elif [ -f "../rsync" ]; then
15+
RSYNC="../rsync"
16+
else
17+
echo "ERROR: Could not find rsync binary"
18+
exit 1
19+
fi
20+
# Verify SHA256 and SHA512 are available
21+
if $RSYNC --version | grep -A1 "Daemon auth list:" | grep -q "sha512.*sha256"; then
22+
echo "PASS: SHA256 and SHA512 available"
23+
else
24+
echo "FAIL: SHA256/SHA512 not found"
25+
exit 1
26+
fi
27+
# Verify OpenSSL crypto is enabled
28+
if $RSYNC --version | grep -q "openssl-crypto"; then
29+
echo "PASS: OpenSSL crypto enabled"
30+
else
31+
echo "FAIL: OpenSSL crypto not enabled"
32+
exit 1
33+
fi
34+
# Test daemon authentication
35+
TEST_DIR="/tmp/rsync-sha-test"
36+
SECRETS_FILE="$TEST_DIR/secrets"
37+
CONFIG_FILE="$TEST_DIR/rsyncd.conf"
38+
rm -rf "$TEST_DIR"
39+
mkdir -p "$TEST_DIR"
40+
echo "testuser:testpass" > "$SECRETS_FILE"
41+
chmod 600 "$SECRETS_FILE"
42+
cat > "$CONFIG_FILE" << EOC
43+
port = 8730
44+
[test]
45+
path = /tmp
46+
auth users = testuser
47+
secrets file = $SECRETS_FILE
48+
EOC
49+
$RSYNC --daemon --config="$CONFIG_FILE" &
50+
DAEMON_PID=$!
51+
sleep 3
52+
if echo "testpass" | $RSYNC --list-only --password-file=- rsync://testuser@localhost:8730/test/ >/dev/null 2>&1; then
53+
echo "PASS: SHA authentication works"
54+
else
55+
echo "FAIL: SHA authentication failed"
56+
kill $DAEMON_PID 2>/dev/null
57+
rm -rf "$TEST_DIR"
58+
exit 1
59+
fi
60+
kill $DAEMON_PID 2>/dev/null || true
61+
rm -rf "$TEST_DIR" || true
62+
exit 0
63+
EOF
64+
65+
# Make the test script executable
66+
chmod +x testsuite/sha-test.test
67+
68+
echo "SHA test script created successfully in testsuite/sha-test.test"

.github/workflows/rsync.yml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: rsync Tests
2+
on:
3+
push:
4+
branches: [ 'master', 'main', 'release/**' ]
5+
pull_request:
6+
branches: [ '*' ]
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
build_wolfprovider:
14+
uses: ./.github/workflows/build-wolfprovider.yml
15+
with:
16+
wolfssl_ref: ${{ matrix.wolfssl_ref }}
17+
openssl_ref: ${{ matrix.openssl_ref }}
18+
strategy:
19+
matrix:
20+
wolfssl_ref: [ 'master', 'v5.8.0-stable' ]
21+
openssl_ref: [ 'openssl-3.5.0' ]
22+
23+
test_rsync:
24+
runs-on: ubuntu-22.04
25+
needs: build_wolfprovider
26+
timeout-minutes: 15
27+
strategy:
28+
matrix:
29+
wolfssl_ref: [ 'master', 'v5.8.0-stable' ]
30+
openssl_ref: [ 'openssl-3.5.0' ]
31+
rsync_ref: [ 'master', 'v3.2.7' ]
32+
force_fail: [ 'WOLFPROV_FORCE_FAIL=1', '' ]
33+
exclude:
34+
- rsync_ref: 'master'
35+
force_fail: 'WOLFPROV_FORCE_FAIL=1'
36+
steps:
37+
- name: Checkout wolfProvider
38+
uses: actions/checkout@v4
39+
with:
40+
fetch-depth: 1
41+
42+
- name: Retrieving wolfSSL/wolfProvider from cache
43+
uses: actions/cache/restore@v4
44+
id: wolfprov-cache
45+
with:
46+
path: |
47+
wolfssl-install
48+
wolfprov-install
49+
openssl-install/lib64
50+
openssl-install/include
51+
openssl-install/bin
52+
key: wolfprov-${{ matrix.wolfssl_ref }}-${{ matrix.openssl_ref }}-${{ github.sha }}
53+
fail-on-cache-miss: true
54+
55+
- name: Install rsync dependencies
56+
run: |
57+
sudo apt-get update
58+
sudo apt-get install -y gcc g++ gawk autoconf automake python3-cmarkgfm \
59+
acl libacl1-dev attr libattr1-dev libxxhash-dev \
60+
libzstd-dev liblz4-dev
61+
62+
- name: Checkout rsync
63+
uses: actions/checkout@v4
64+
with:
65+
repository: RsyncProject/rsync
66+
path: rsync_repo
67+
ref: ${{ matrix.rsync_ref }}
68+
fetch-depth: 1
69+
70+
- name: Build and install rsync
71+
working-directory: rsync_repo
72+
run: |
73+
# Set up the environment for wolfProvider
74+
source $GITHUB_WORKSPACE/scripts/env-setup
75+
./configure --disable-xxhash
76+
77+
# Run the patch script from wolfProvider
78+
$GITHUB_WORKSPACE/.github/scripts/add-rsync-sha-test.sh
79+
80+
make -j$(nproc)
81+
#export RSYNC_CHECKSUM_LIST="none"
82+
#This can disable file checksums which currently use rsycs own implementation of MD4 and MD5
83+
#Causes a lot of tests in the make check to fail so im keeping it disabled
84+
85+
- name: Run rsync tests
86+
working-directory: rsync_repo
87+
run: |
88+
# Set up the environment for wolfProvider
89+
source $GITHUB_WORKSPACE/scripts/env-setup
90+
export ${{ matrix.force_fail }}
91+
92+
# Run rsync test suite including our SHA test
93+
make check 2>&1 | tee rsync-test.log
94+
95+
# Check test results - look for "0 failed" in the output
96+
if grep -q "overall result is 0" rsync-test.log; then
97+
TEST_RESULT=0
98+
else
99+
TEST_RESULT=1
100+
fi
101+
102+
$GITHUB_WORKSPACE/.github/scripts/check-workflow-result.sh $TEST_RESULT ${{ matrix.force_fail }} rsync

0 commit comments

Comments
 (0)