Skip to content

Commit 259caad

Browse files
committed
Add automated test failure detection and issue creation
Signed-off-by: Hanxi Zhang <hanxizh@amazon.com>
1 parent d173441 commit 259caad

139 files changed

Lines changed: 9643 additions & 11881 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.config/typos.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,3 @@ ake = "ake"
7171
[type.tcl.extend-words]
7272
fo = "fo"
7373
tre = "tre"
74-
75-
[type.cpp.extend-words]
76-
fo = "fo"
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: 'Upload Test Failures'
2+
description: 'Upload test-failures.json as artifact'
3+
inputs:
4+
job-name:
5+
description: 'Unique name for the artifact'
6+
required: true
7+
runs:
8+
using: 'composite'
9+
steps:
10+
- name: Upload test failures
11+
uses: actions/upload-artifact@v4
12+
with:
13+
name: test-failures-${{ inputs.job-name }}
14+
path: test-failures.json
15+
if-no-files-found: ignore
16+
retention-days: 7

.github/instructions/core-engine.instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Apply these standards to core engine C code. Do NOT apply to `deps/` (vendored d
3636
- **PR Scope:** Separate refactoring from functional changes for easier backporting.
3737

3838
## 5. Testing & Documentation
39-
- **Unit Tests:** Required for data structures in `src/unit/`. Test files should follow `test_*.cpp` naming.
39+
- **Unit Tests:** Required for data structures in `src/unit/`. Test files should follow `test_*.c` naming.
4040
- **Integration Tests:** Required for commands in `tests/`.
4141
- **Command Changes:** New/modified commands need corresponding updates in `src/commands/*.json`.
4242
- **New C Files:** Remind to update `CMakeLists.txt` when adding new `.c` source files.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import re
2+
import json
3+
4+
5+
def parse_failure_entry(entry, job_name="unknown"):
6+
"""
7+
Parse a raw failure string from the test runner.
8+
"""
9+
m = re.match(
10+
r'\[(\w+)\]:\s*(.+?)\s+in\s+(tests/\S+\.tcl)\s*\n?(.*)',
11+
entry,
12+
re.DOTALL
13+
)
14+
if m:
15+
return {
16+
"test_name": m.group(2).strip(),
17+
"test_file": m.group(3).strip(),
18+
"error": m.group(4).strip(),
19+
"job": job_name,
20+
}
21+
22+
# Fallback: couldn't parse, return raw
23+
return {
24+
"test_name": entry[:100],
25+
"test_file": "unknown",
26+
"error": entry,
27+
"job": job_name,
28+
}

.github/workflows/ci.yml

Lines changed: 10 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ jobs:
3535
- name: make
3636
# Fail build if there are warnings
3737
# build with TLS just for compilation coverage
38-
run: |
39-
sudo apt-get install pkg-config libgtest-dev libgmock-dev
40-
make -j4 all-with-unit-tests SERVER_CFLAGS='-Werror' BUILD_TLS=yes USE_FAST_FLOAT=yes USE_LIBBACKTRACE=yes
38+
run: make -j4 all-with-unit-tests SERVER_CFLAGS='-Werror' BUILD_TLS=yes USE_FAST_FLOAT=yes USE_LIBBACKTRACE=yes
4139
- name: test
4240
run: |
4341
sudo apt-get install tcl8.6 tclx
@@ -52,7 +50,7 @@ jobs:
5250
if [[ ! -z "$dirty" ]]; then echo "$dirty"; exit 1; fi
5351
- name: unit tests
5452
run: |
55-
./src/unit/valkey-unit-gtests
53+
./src/valkey-unit-tests
5654
5755
test-ubuntu-latest-compatibility:
5856
runs-on: ubuntu-latest
@@ -64,9 +62,6 @@ jobs:
6462
- {version: "8.0.6", file: "valkey-8.0.6-noble-x86_64.tar.gz"}
6563
- {version: "8.1.4", file: "valkey-8.1.4-noble-x86_64.tar.gz"}
6664
steps:
67-
- name: Install gtest
68-
run: |
69-
sudo apt-get install pkg-config libgtest-dev libgmock-dev
7065
- name: Install libbacktrace
7166
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
7267
with:
@@ -108,7 +103,7 @@ jobs:
108103
sudo apt-get install -y cmake libssl-dev
109104
mkdir -p build-release
110105
cd build-release
111-
cmake -DCMAKE_BUILD_TYPE=Release .. -DBUILD_TLS=yes -DBUILD_UNIT_GTESTS=yes
106+
cmake -DCMAKE_BUILD_TYPE=Release .. -DBUILD_TLS=yes -DBUILD_UNIT_TESTS=yes
112107
make -j$(nproc)
113108
- name: test
114109
run: |
@@ -117,7 +112,7 @@ jobs:
117112
./build-release/runtest --verbose --tags -slow --dump-logs --tls
118113
- name: unit tests
119114
run: |
120-
./build-release/bin/valkey-unit-gtests
115+
./build-release/bin/valkey-unit-tests
121116
122117
test-sanitizer-address:
123118
runs-on: ubuntu-latest
@@ -133,18 +128,15 @@ jobs:
133128
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
134129
- name: make
135130
# build with TLS module just for compilation coverage
136-
run: |
137-
sudo apt-get install pkg-config libgtest-dev libgmock-dev
138-
make -j4 all-with-unit-tests SANITIZER=address SERVER_CFLAGS='-Werror' BUILD_TLS=module USE_LIBBACKTRACE=yes
131+
run: make -j4 all-with-unit-tests SANITIZER=address SERVER_CFLAGS='-Werror' BUILD_TLS=module USE_LIBBACKTRACE=yes
139132
- name: testprep
140133
run: sudo apt-get install tcl8.6 tclx -y
141134
- name: test
142135
run: ./runtest --verbose --tags -slow --dump-logs
143136
- name: module api test
144137
run: CFLAGS='-Werror' ./runtest-moduleapi --verbose --dump-logs
145138
- name: unit tests
146-
run: |
147-
./src/unit/valkey-unit-gtests
139+
run: ./src/valkey-unit-tests
148140

149141
test-rdma:
150142
runs-on: ubuntu-latest
@@ -228,15 +220,9 @@ jobs:
228220
- run: cd libbacktrace && ./configure && make && sudo make install
229221
- name: Checkout Valkey
230222
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
231-
- name: Install build dependencies
232-
run: brew install llvm googletest
233223
- name: make
234224
# Build with additional upcoming features
235-
run: |
236-
export PATH="/opt/homebrew/opt/llvm/bin:$PATH"
237-
export CC=/opt/homebrew/opt/llvm/bin/clang
238-
export CXX=/opt/homebrew/opt/llvm/bin/clang++
239-
make -j3 all-with-unit-tests SERVER_CFLAGS='-Werror' USE_FAST_FLOAT=yes USE_LIBBACKTRACE=yes LIBBACKTRACE_PREFIX=/usr/local
225+
run: make -j3 all-with-unit-tests SERVER_CFLAGS='-Werror' USE_FAST_FLOAT=yes USE_LIBBACKTRACE=yes
240226

241227
build-32bit:
242228
runs-on: ubuntu-latest
@@ -254,34 +240,16 @@ jobs:
254240
cd libbacktrace && ./configure CFLAGS="-m32" --prefix=/usr/local/libbacktrace32 && make && sudo make install
255241
- name: Checkout Valkey
256242
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
257-
- name: Install gtest
258-
run: |
259-
sudo apt-get update
260-
sudo apt-get install libgtest-dev
261-
mkdir -p /tmp/gtest32
262-
cd /tmp/gtest32
263-
cmake -B build32 \
264-
-DCMAKE_BUILD_TYPE=Release \
265-
-DCMAKE_C_FLAGS="-m32" \
266-
-DCMAKE_CXX_FLAGS="-m32" \
267-
-DCMAKE_EXE_LINKER_FLAGS="-m32" \
268-
/usr/src/googletest
269-
cmake --build build32 --parallel
270-
sudo cp build32/lib/*.a /usr/lib32/
271-
cd $GITHUB_WORKSPACE
272243
- name: make
273244
# Fast float requires C++ 32-bit libraries to compile on 64-bit ubuntu
274245
# machine i.e. "-cross" suffixed version. Cross-compiling c++ to 32-bit
275246
# also requires multilib support for g++ compiler i.e. "-multilib"
276247
# suffixed version of g++. g++-multilib generally includes libstdc++.
277248
# *cross version as well, but it is also added explicitly just in case.
278-
run: |
279-
make -j4 SERVER_CFLAGS='-Werror' 32bit USE_FAST_FLOAT=yes USE_LIBBACKTRACE=yes LIBBACKTRACE_PREFIX=/usr/local/libbacktrace32 \
280-
GTEST_CFLAGS="-I/usr/src/googletest/googletest/include -I/usr/src/googletest/googlemock/include" \
281-
GTEST_LIBS="/usr/lib32/libgtest.a /usr/lib32/libgmock.a"
249+
run: make -j4 SERVER_CFLAGS='-Werror' 32bit USE_FAST_FLOAT=yes USE_LIBBACKTRACE=yes LIBBACKTRACE_PREFIX=/usr/local/libbacktrace32
282250
- name: unit tests
283251
run: |
284-
./src/unit/valkey-unit-gtests
252+
./src/valkey-unit-tests
285253
286254
build-libc-malloc:
287255
runs-on: ubuntu-latest
@@ -310,7 +278,7 @@ jobs:
310278
path: libbacktrace
311279
- name: Build libbacktrace
312280
run: |
313-
dnf -y install epel-release gcc gcc-c++ make procps-ng which git cmake
281+
dnf -y install epel-release gcc gcc-c++ make procps-ng which
314282
cd libbacktrace && ./configure && make && make install
315283
- name: Checkout Valkey
316284
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

.github/workflows/clang-format.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
name: Clang Format Check
22

3-
permissions:
4-
contents: read
5-
63
on:
74
push:
85
paths-ignore:
@@ -42,7 +39,7 @@ jobs:
4239
# Run clang-format and capture the diff
4340
cd src
4441
shopt -s globstar
45-
clang-format-18 -i **/*.c **/*.h **/*.cpp **/*.hpp
42+
clang-format-18 -i **/*.c **/*.h
4643
# Capture the diff output
4744
DIFF=$(git diff)
4845
if [ ! -z "$DIFF" ]; then

.github/workflows/codecov.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
name: "Codecov"
22

3-
permissions:
4-
contents: read
5-
63
# Enabling on each push is to display the coverage changes in every PR,
74
# where each PR needs to be compared against the coverage of the head commit
85
on:
@@ -44,4 +41,4 @@ jobs:
4441
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
4542
with:
4643
token: ${{ secrets.CODECOV_TOKEN }}
47-
files: ./src/valkey.info
44+
file: ./src/valkey.info

.github/workflows/codeql-analysis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ jobs:
4040
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4141

4242
- name: Initialize CodeQL
43-
uses: github/codeql-action/init@c793b717bc78562f491db7b0e93a3a178b099162 # v4.32.5
43+
uses: github/codeql-action/init@b5ebac6f4c00c8ccddb7cdcd45fdb248329f808a # v3.32.2
4444
with:
4545
languages: ${{ matrix.language }}
4646

4747
- name: Autobuild
48-
uses: github/codeql-action/autobuild@c793b717bc78562f491db7b0e93a3a178b099162 # v4.32.5
48+
uses: github/codeql-action/autobuild@b5ebac6f4c00c8ccddb7cdcd45fdb248329f808a # v3.32.2
4949

5050
- name: Perform CodeQL Analysis
51-
uses: github/codeql-action/analyze@c793b717bc78562f491db7b0e93a3a178b099162 # v4.32.5
51+
uses: github/codeql-action/analyze@b5ebac6f4c00c8ccddb7cdcd45fdb248329f808a # v3.32.2

0 commit comments

Comments
 (0)