Skip to content

Commit 75c0f5e

Browse files
committed
rebase for WPFF with curl
1 parent eff28c0 commit 75c0f5e

File tree

2 files changed

+121
-3
lines changed

2 files changed

+121
-3
lines changed
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
if [ $# -lt 1 ]; then
6+
echo "Usage: $0 <test_result> [WOLFPROV_FORCE_FAIL] [TEST_SUITE]"
7+
exit 1
8+
fi
9+
10+
TEST_RESULT="$1"
11+
WOLFPROV_FORCE_FAIL="${2:-}"
12+
TEST_SUITE="${3:-}"
13+
14+
if [ "$WOLFPROV_FORCE_FAIL" = "1" ]; then
15+
if [ "$TEST_SUITE" = "curl" ]; then
16+
# --- curl-specific logic ---
17+
if [ -f "tests/test.log" ]; then
18+
# Extract and clean the failed test list from the log
19+
ACTUAL_FAILS=$(grep -a '^TESTFAIL: These test cases failed:' tests/test.log | sed 's/.*failed: //')
20+
else
21+
echo "Error: tests/test.log not found"
22+
exit 1
23+
fi
24+
25+
# Get curl version from the workflow ref
26+
CURL_VERSION="${CURL_REF:-}"
27+
28+
# Define expected failures based on curl version
29+
case "$CURL_VERSION" in
30+
"curl-8_4_0")
31+
EXPECTED_FAILS="9 31 39 41 44 46 61 64 65 70 71 72 73 88 153 154 158 163 166 167 168 169 170 171 173 186 206 245 246 258 259 273 277 327 335 388 420 444 540 551 552 554 565 579 584 643 645 646 647 648 649 650 651 652 653 654 666 667 668 669 670 671 672 673 977 1001 1002 1030 1053 1060 1061 1071 1072 1079 1095 1105 1133 1136 1151 1155 1158 1160 1161 1186 1187 1189 1190 1191 1192 1193 1194 1195 1196 1198 1199 1229 1284 1285 1286 1293 1315 1404 1412 1415 1418 1437 1568 1903 1905 1916 1917 1964 2024 2026 2027 2028 2030 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2073 2076 2200 2201 2202 2203 2204 3017 3018"
32+
;;
33+
"master")
34+
# TODO: Replace with actual master branch expected failures
35+
EXPECTED_FAILS="9 31 39 41 44 46 61 64 65 70 71 72 73 88 153 154 158 163 166 167 168 169 170 171 173 186 206 245 246 258 259 273 277 327 335 388 420 444 483 540 551 552 554 565 579 584 643 645 646 647 648 649 650 651 652 653 654 666 667 668 669 670 671 672 673 695 977 1001 1002 1030 1053 1060 1061 1071 1072 1079 1095 1105 1133 1136 1151 1155 1158 1160 1161 1186 1187 1189 1190 1191 1192 1193 1194 1195 1196 1198 1199 1229 1284 1285 1286 1293 1315 1404 1412 1415 1418 1437 1476 1568 1608 1610 1615 1654 1660 1903 1905 1916 1917 1964 2024 2026 2027 2028 2030 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2073 2076 2200 2201 2202 2203 2204 3017 3018"
36+
;;
37+
*)
38+
echo "Error: Unknown curl version: $CURL_VERSION"
39+
exit 1
40+
;;
41+
esac
42+
43+
# Create temporary files for sorted lists
44+
TEMP_DIR=$(mktemp -d)
45+
ACTUAL_SORTED="${TEMP_DIR}/actual_sorted.txt"
46+
EXPECTED_SORTED="${TEMP_DIR}/expected_sorted.txt"
47+
48+
# Sort both lists, one per line
49+
echo "$ACTUAL_FAILS" | tr ' ' '\n' | sort -n > "$ACTUAL_SORTED"
50+
echo "$EXPECTED_FAILS" | tr ' ' '\n' | sort -n > "$EXPECTED_SORTED"
51+
52+
# Find missing in actual (in expected but not in actual)
53+
MISSING=$(comm -23 "$EXPECTED_SORTED" "$ACTUAL_SORTED" | tr '\n' ' ')
54+
# Find extra in actual (in actual but not in expected)
55+
EXTRA=$(comm -13 "$EXPECTED_SORTED" "$ACTUAL_SORTED" | tr '\n' ' ')
56+
57+
# Clean up temporary files
58+
rm -rf "$TEMP_DIR"
59+
60+
echo "Test(s) that should have failed: $MISSING"
61+
echo "Test(s) that shouldn't have failed: $EXTRA"
62+
63+
# Check if they match by comparing the original sorted files
64+
if [ "$ACTUAL_FAILS" = "$EXPECTED_FAILS" ]; then
65+
echo "PASS: Actual failed tests match expected."
66+
exit 0
67+
else
68+
echo "FAIL: Actual failed tests do not match expected."
69+
exit 1
70+
fi
71+
else
72+
# --- generic force-fail logic for other suites ---
73+
if [ "$TEST_RESULT" -ne 0 ]; then
74+
echo "Tests failed as expected with force fail enabled (suite: $TEST_SUITE)"
75+
exit 0
76+
else
77+
echo "Tests unexpectedly succeeded with force fail enabled (suite: $TEST_SUITE)"
78+
exit 1
79+
fi
80+
fi
81+
elif [ "$TEST_RESULT" -ne 0 ]; then
82+
if [ "$TEST_RESULT" -eq 2 ]; then
83+
echo "Build/test setup failed unexpectedly"
84+
else
85+
echo "Tests failed unexpectedly"
86+
fi
87+
exit 1
88+
else
89+
echo "Tests passed successfully"
90+
exit 0
91+
fi

.github/workflows/curl.yml

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ jobs:
7474
curl_ref: [ 'master', 'curl-8_4_0' ]
7575
wolfssl_ref: [ 'master', 'v5.7.4-stable' ]
7676
steps:
77+
- name: Checkout wolfProvider
78+
uses: actions/checkout@v4
79+
7780
- name: Retrieving OpenSSL from cache
7881
uses: actions/cache/restore@v4
7982
id: openssl-cache
@@ -109,13 +112,37 @@ jobs:
109112
repository: curl/curl
110113
path: curl
111114
ref: ${{ matrix.curl_ref }}
112-
configure: --with-openssl=$GITHUB_WORKSPACE/openssl-install/
115+
configure: --with-openssl
113116
check: false
114117

115-
- name: Test curl with wolfProvider
118+
- name: Test curl with wolfProvider - default
119+
working-directory: curl
120+
run: |
121+
# Set environment variables for default
122+
export LD_LIBRARY_PATH=$GITHUB_WORKSPACE/wolfssl-install/lib:$GITHUB_WORKSPACE/openssl-install/lib64
123+
export OPENSSL_CONF=$GITHUB_WORKSPACE/provider.conf
124+
export OPENSSL_MODULES=$GITHUB_WORKSPACE/wolfprov-install/lib
125+
export PKG_CONFIG_PATH=$GITHUB_WORKSPACE/openssl-install/lib64/pkgconfig
126+
127+
# Run tests
128+
make -j$(nproc) test-ci || true
129+
TEST_RESULT=$?
130+
$GITHUB_WORKSPACE/.github/scripts/check-workflow-result.sh $TEST_RESULT 0 curl
131+
132+
# Test WPFF after default so certs get generated
133+
- name: Test curl with wolfProvider - force fail
116134
working-directory: curl
117135
run: |
136+
# Set environment variables for force fail
118137
export LD_LIBRARY_PATH=$GITHUB_WORKSPACE/wolfssl-install/lib:$GITHUB_WORKSPACE/openssl-install/lib64
119138
export OPENSSL_CONF=$GITHUB_WORKSPACE/provider.conf
120139
export OPENSSL_MODULES=$GITHUB_WORKSPACE/wolfprov-install/lib
121-
make -j $(nproc) test-ci
140+
export PKG_CONFIG_PATH=$GITHUB_WORKSPACE/openssl-install/lib64/pkgconfig
141+
export WOLFPROV_FORCE_FAIL=1
142+
export CURL_REF=${{ matrix.curl_ref }}
143+
144+
# Run tests and save output to test.log
145+
mkdir -p tests
146+
make -j$(nproc) test-ci 2>&1 | tee tests/test.log || true
147+
TEST_RESULT=$?
148+
$GITHUB_WORKSPACE/.github/scripts/check-workflow-result.sh $TEST_RESULT 1 curl

0 commit comments

Comments
 (0)