Skip to content

Commit c51f832

Browse files
committed
rsync workflow
1 parent a387504 commit c51f832

File tree

2 files changed

+73
-59
lines changed

2 files changed

+73
-59
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: 5 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -67,74 +67,20 @@ jobs:
6767
ref: ${{ matrix.rsync_ref }}
6868
fetch-depth: 1
6969

70-
- name: Create SHA test script
71-
run: |
72-
cat > rsync_repo/testsuite/sha-test.test << 'EOF'
73-
#!/bin/sh
74-
# Use rsync binary from current directory or parent directory
75-
if [ -f "./rsync" ]; then
76-
RSYNC="./rsync"
77-
elif [ -f "../rsync" ]; then
78-
RSYNC="../rsync"
79-
else
80-
echo "ERROR: Could not find rsync binary"
81-
exit 1
82-
fi
83-
# Verify SHA256 and SHA512 are available
84-
if $RSYNC --version | grep -A1 "Daemon auth list:" | grep -q "sha512.*sha256"; then
85-
echo "PASS: SHA256 and SHA512 available"
86-
else
87-
echo "FAIL: SHA256/SHA512 not found"
88-
exit 1
89-
fi
90-
# Verify OpenSSL crypto is enabled
91-
if $RSYNC --version | grep -q "openssl-crypto"; then
92-
echo "PASS: OpenSSL crypto enabled"
93-
else
94-
echo "FAIL: OpenSSL crypto not enabled"
95-
exit 1
96-
fi
97-
# Test daemon authentication
98-
TEST_DIR="/tmp/rsync-sha-test"
99-
SECRETS_FILE="$TEST_DIR/secrets"
100-
CONFIG_FILE="$TEST_DIR/rsyncd.conf"
101-
rm -rf "$TEST_DIR"
102-
mkdir -p "$TEST_DIR"
103-
echo "testuser:testpass" > "$SECRETS_FILE"
104-
chmod 600 "$SECRETS_FILE"
105-
cat > "$CONFIG_FILE" << EOC
106-
port = 8730
107-
[test]
108-
path = /tmp
109-
auth users = testuser
110-
secrets file = $SECRETS_FILE
111-
EOC
112-
$RSYNC --daemon --config="$CONFIG_FILE" &
113-
DAEMON_PID=$!
114-
sleep 3
115-
if echo "testpass" | $RSYNC --list-only --password-file=- rsync://testuser@localhost:8730/test/ >/dev/null 2>&1; then
116-
echo "PASS: SHA authentication works"
117-
else
118-
echo "FAIL: SHA authentication failed"
119-
kill $DAEMON_PID 2>/dev/null
120-
rm -rf "$TEST_DIR"
121-
exit 1
122-
fi
123-
kill $DAEMON_PID 2>/dev/null || true
124-
rm -rf "$TEST_DIR" || true
125-
exit 0
126-
EOF
127-
chmod +x rsync_repo/testsuite/sha-test.test
128-
12970
- name: Build and install rsync
13071
working-directory: rsync_repo
13172
run: |
13273
# Set up the environment for wolfProvider
13374
source $GITHUB_WORKSPACE/scripts/env-setup
13475
./configure --disable-xxhash
76+
77+
# Run the patch script from wolfProvider
78+
$GITHUB_WORKSPACE/.github/scripts/add-rsync-sha-test.sh
79+
13580
make -j$(nproc)
13681
#export RSYNC_CHECKSUM_LIST="none"
13782
#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
13884
13985
- name: Run rsync tests
14086
working-directory: rsync_repo

0 commit comments

Comments
 (0)