Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .github/scripts/log-summary.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/usr/bin/env bash
set -euo pipefail

LOG_FILE="$1"

if [ ! -f "$LOG_FILE" ]; then
echo "Log file not found: $LOG_FILE"
exit 1
fi

TMPFILE=$(mktemp)
trap 'rm -f "$TMPFILE"' EXIT

INSIDE_ERROR_BLOCK=0
CURRENT_TEST=""
BLOCK=""

while IFS= read -r line; do
if [[ $INSIDE_ERROR_BLOCK -eq 0 ]]; then

if [[ "$line" =~ ^===[[:space:]]+RUN[[:space:]]+([^[:space:]]+) ]]; then
CURRENT_TEST="${BASH_REMATCH[1]}"
fi

if [[ "$line" == *"Error Trace:"* ]] || \
[[ "$line" == *"Error:"* ]] || \
[[ "$line" == *"FAIL:"* ]] || \
[[ "$line" == *"--- FAIL:"* ]]; then
INSIDE_ERROR_BLOCK=1
BLOCK=""
[ -n "$CURRENT_TEST" ] && BLOCK="Test: $CURRENT_TEST"$'\n'
BLOCK+="$line"$'\n'
fi

elif [[ $INSIDE_ERROR_BLOCK -eq 1 ]]; then
if [[ -z "$line" ]] || [[ "$line" =~ ^=== ]]; then
echo "===================" >> "$TMPFILE"
echo "$BLOCK" >> "$TMPFILE"
echo "===================" >> "$TMPFILE"
echo "" >> "$TMPFILE"
INSIDE_ERROR_BLOCK=0
CURRENT_TEST=""
BLOCK=""
else
BLOCK+="$line"$'\n'
fi
fi
done < "$LOG_FILE"

# Save current error block if log file ended.
if [[ $INSIDE_ERROR_BLOCK -eq 1 && -n "$BLOCK" ]]; then
echo "=== FAILED TEST ===" >> "$TMPFILE"
echo "$BLOCK" >> "$TMPFILE"
echo "===================" >> "$TMPFILE"
fi

if [ ! -s "$TMPFILE" ]; then
echo "No failed tests found."
exit 0
fi

cat "$TMPFILE"
exit 1
24 changes: 21 additions & 3 deletions .github/workflows/reusable-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,33 @@ jobs:
- name: Install test dependencies
run: make deps

- name: Create log directory
run: mkdir -p logs

- name: Run regression tests
run: make test
run: |
make test 2>&1 | tee logs/test.log; exit ${PIPESTATUS[0]}

- name: Summarize regression tests
if: always()
run: make log-summary LOG_FILE=logs/test.log

- name: Run race tests
run: make testrace
run: |
make testrace 2>&1 | tee logs/testrace.log; exit ${PIPESTATUS[0]}

- name: Summarize race tests
if: always()
run: make log-summary LOG_FILE=logs/testrace.log

- name: Run fuzzing tests
if: ${{ inputs.fuzzing }}
run: make fuzzing TAGS="go_tarantool_decimal_fuzzing"
run: |
make fuzzing TAGS="go_tarantool_decimal_fuzzing" 2>&1 | tee logs/fuzzing.log; exit ${PIPESTATUS[0]}

- name: Summarize fuzzing tests
if: always() && inputs.fuzzing
run: make log-summary LOG_FILE=logs/fuzzing.log

- name: Run tests, collect code coverage data and send to Coveralls
if: ${{ inputs.coveralls }}
Expand Down
29 changes: 26 additions & 3 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ jobs:
T_SRCDIR: ${{ format('{0}/tarantool-{1}', github.workspace, matrix.tarantool) }}
T_TARDIR: ${{ format('{0}/tarantool-{1}-build', github.workspace, matrix.tarantool) }}
SRCDIR: ${{ format('{0}/{1}', github.workspace, github.repository) }}
LOG_DIR: ${{ format('{0}/test-logs', github.workspace) }}
CONFIG_NAME: macos-${{ matrix.runs-on }}-go-${{ matrix.golang }}

runs-on: ${{ matrix.runs-on }}
steps:
Expand Down Expand Up @@ -120,21 +122,42 @@ jobs:
cd "${SRCDIR}"
make deps

- name: Create log directory
run: mkdir -p "${LOG_DIR}"

- name: Run regression tests
run: |
cd "${SRCDIR}"
make test
make test 2>&1 | tee "${LOG_DIR}"/test.log; exit ${PIPESTATUS[0]}

- name: Summarize regression tests
if: always()
run: |
cd "${SRCDIR}"
make log-summary LOG_FILE="${LOG_DIR}"/test.log

- name: Run race tests
run: |
cd "${SRCDIR}"
make testrace
make testrace 2>&1 | tee "${LOG_DIR}"/testrace.log; exit ${PIPESTATUS[0]}

- name: Summarize race tests
if: always()
run: |
cd "${SRCDIR}"
make log-summary LOG_FILE="${LOG_DIR}"/testrace.log

- name: Run fuzzing tests
if: ${{ matrix.fuzzing }}
run: |
cd "${SRCDIR}"
make fuzzing TAGS="go_tarantool_decimal_fuzzing"
make fuzzing TAGS="go_tarantool_decimal_fuzzing" 2>&1 | tee "${LOG_DIR}"/fuzzing.log; exit ${PIPESTATUS[0]}

- name: Summarize fuzzing tests
if: always() && matrix.fuzzing
run: |
cd "${SRCDIR}"
make log-summary LOG_FILE="${LOG_DIR}"/fuzzing.log

- name: Check workability of benchmark tests
if: matrix.golang == 'stable'
Expand Down
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,15 @@ fuzzing:
codespell:
@echo "Running codespell"
codespell

.PHONY: log-summary
log-summary:
@if [ -z "$(LOG_FILE)" ]; then \
echo "ERROR: LOG_FILE is not set"; \
exit 1; \
fi
@if [ ! -f "$(LOG_FILE)" ]; then \
echo "ERROR: log file '$(LOG_FILE)' not found"; \
exit 1; \
fi
@.github/scripts/log-summary.sh "$(LOG_FILE)"
Loading