Skip to content

Commit 47e9be2

Browse files
committed
Print the reproducer and commands
1 parent 9cdde56 commit 47e9be2

File tree

2 files changed

+48
-32
lines changed

2 files changed

+48
-32
lines changed

.github/workflows/check-new-library-versions-in-batch.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ jobs:
9595
readarray -t VERSIONS < <(echo '${{ toJson(matrix.item.versions) }}' | jq -r '.[]')
9696
FIRST_TESTING_VERSION="${VERSIONS[0]}"
9797
98-
TITLE_SEARCH="${{ env.ISSUE_TITLE_MIDDLE }}$GROUP_ID:$ARTIFACT_ID:$FIRST_TESTING_VERSION failed in"
98+
TITLE_SEARCH="${{ env.ISSUE_TITLE_MIDDLE }}$GROUP_ID:$ARTIFACT_ID:$FIRST_TESTING_VERSION"
9999
100100
ISSUE_NUMBER=$(gh issue list --repo "${{ github.repository }}" --state open --search "in:title $TITLE_SEARCH" --json number,title --jq \
101101
'.[] | select(.title | endswith("'"$TITLE_SEARCH"'")) | .number')
@@ -141,7 +141,7 @@ jobs:
141141
echo "EOF" >> $GITHUB_OUTPUT
142142
143143
# Extract failure type and failed version
144-
awk -F'[][]|:' '/^FAILED/ {print "failure_type="$2; print "failed_version="$4}' test_results.txt >> $GITHUB_OUTPUT
144+
awk -F'[][]' '/^FAILED/ {print "failure_type="$2; print "failed_version="$4; print "failed_command="$6}' test_results.txt >> $GITHUB_OUTPUT
145145
146146
# Fetch the job URL
147147
JOB_ID=$(
@@ -224,6 +224,7 @@ jobs:
224224
# Use single-quoted here-doc to disable any shell expansion of log content
225225
cat > "$BODY_FILE" <<'EOF'
226226
Failure kind: ${{ steps.runtests.outputs.failure_type }}
227+
Reproducer: `${{ steps.runtests.outputs.failed_command }}`
227228
Runner log: ${{ steps.runtests.outputs.runner_log_url }}
228229
Last ${{ env.LOG_LINES }} lines of the log:
229230
```console

.github/workflows/run-consecutive-tests.sh

Lines changed: 45 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
# work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
77

88
set -u
9-
set -x
109

1110
if [ $# -ne 2 ]; then
1211
echo "Usage: $0 <test-coordinates> <versions-json-array>"
@@ -23,43 +22,59 @@ VERSIONS_JSON="${VERSIONS_JSON%"${VERSIONS_JSON##*[!\']}"}"
2322

2423
# Parse versions with jq
2524
readarray -t VERSIONS < <(echo "$VERSIONS_JSON" | jq -r '.[]')
25+
export DELIMITER="========================================================================================"
2626

27-
for VERSION in "${VERSIONS[@]}"; do
28-
# check if javac works for the new version
29-
GVM_TCK_LV="$VERSION" ./gradlew clean javac -Pcoordinates="$TEST_COORDINATES"
30-
RESULT=$?
31-
if [ "$RESULT" -ne 0 ]; then
32-
echo "FAILED [javac compile]:$VERSION"
33-
break
34-
fi
27+
run_multiple_attempts() {
28+
local stage="$1"
29+
local max_attempts="$2"
30+
local gradle_command="$3"
31+
32+
echo "$DELIMITER"
33+
echo " $TEST_COORDINATES:$VERSION stage $stage"
34+
echo "$DELIMITER"
35+
36+
local attempt=0
37+
local result=0
3538

36-
# check if native-image can be built
37-
GVM_TCK_LV="$VERSION" ./gradlew clean nativeTestCompile -Pcoordinates="$TEST_COORDINATES"
38-
RESULT=$?
39-
if [ "$RESULT" -ne 0 ]; then
40-
echo "FAILED [native-image build]:$VERSION"
41-
break
39+
while [ $attempt -lt "$max_attempts" ]; do
40+
local cmd_str="GVM_TCK_LV=\"$VERSION\" ./gradlew clean $gradle_command -Pcoordinates=\"$TEST_COORDINATES\""
41+
if [ $attempt -gt 0 ]; then
42+
echo "Re-running stage '$stage' (attempt $((attempt + 1))/$max_attempts)"
4243
fi
4344

44-
echo "Running test with GVM_TCK_LV=$VERSION and coordinates=$TEST_COORDINATES"
45-
GVM_TCK_LV="$VERSION" ./gradlew test -Pcoordinates="$TEST_COORDINATES"
46-
RESULT=$?
47-
ATTEMPTS=1
48-
49-
# maybe we failed because the test was flaky => try two more times to be sure
50-
while [ "$RESULT" -ne 0 ] && [ $ATTEMPTS -le 2 ]; do
51-
echo "Re-running the test with GVM_TCK_LV=$VERSION and coordinates=$TEST_COORDINATES"
52-
GVM_TCK_LV="$VERSION" ./gradlew clean test -Pcoordinates="$TEST_COORDINATES"
53-
RESULT=$?
54-
ATTEMPTS=$((ATTEMPTS + 1))
45+
eval "$cmd_str"
46+
result=$?
47+
48+
if [ "$result" -eq 0 ]; then
49+
return 0
50+
fi
51+
52+
attempt=$((attempt + 1))
5553
done
5654

57-
if [ "$RESULT" -eq 0 ]; then
58-
echo "PASSED:$VERSION"
59-
else
60-
echo "FAILED [native-image run]:$VERSION"
55+
echo "FAILED [$stage][$VERSION][$cmd_str]"
56+
return $result
57+
}
58+
59+
for VERSION in "${VERSIONS[@]}"; do
60+
echo "$DELIMITER"
61+
echo " Testing $TEST_COORDINATES:$VERSION"
62+
echo "$DELIMITER"
63+
64+
65+
if ! run_multiple_attempts "javac compile" 1 javac; then
66+
break
67+
fi
68+
69+
if ! run_multiple_attempts "native-image build" 1 nativeTestCompile; then
6170
break
6271
fi
72+
73+
if ! run_multiple_attempts "native-image run" 3 test; then
74+
break
75+
fi
76+
77+
echo "PASSED:$VERSION"
6378
done
6479

6580
exit 0

0 commit comments

Comments
 (0)