Skip to content

Commit a8ad694

Browse files
committed
Fix mock_defrag memory realloc in test_vest.c
Signed-off-by: Ran Shidlansik <[email protected]>
1 parent db11e41 commit a8ad694

File tree

2 files changed

+20
-176
lines changed

2 files changed

+20
-176
lines changed

.github/workflows/ci.yml

Lines changed: 19 additions & 175 deletions
Original file line numberDiff line numberDiff line change
@@ -10,187 +10,31 @@ permissions:
1010
contents: read
1111

1212
jobs:
13-
test-ubuntu-latest:
13+
test-valgrind-no-malloc-usable-size-misc:
1414
runs-on: ubuntu-latest
15+
timeout-minutes: 1440
1516
steps:
16-
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
17-
- name: make
18-
# Fail build if there are warnings
19-
# build with TLS just for compilation coverage
20-
run: make -j4 all-with-unit-tests SERVER_CFLAGS='-Werror' BUILD_TLS=yes USE_FAST_FLOAT=yes
21-
- name: install old server for compatibility testing
22-
run: |
23-
cd tests/tmp
24-
wget https://download.valkey.io/releases/valkey-8.1.3-noble-x86_64.tar.gz
25-
tar -xvf valkey-8.1.3-noble-x86_64.tar.gz
26-
- name: test
27-
run: |
28-
sudo apt-get install tcl8.6 tclx
29-
./runtest --verbose --tags -slow --dump-logs --other-server-path tests/tmp/valkey-8.1.3-noble-x86_64/bin/valkey-server
30-
- name: module api test
31-
run: CFLAGS='-Werror' ./runtest-moduleapi --verbose --dump-logs --other-server-path tests/tmp/valkey-8.1.3-noble-x86_64/bin/valkey-server
32-
- name: validate commands.def up to date
17+
- name: prep
18+
if: github.event_name == 'workflow_dispatch'
3319
run: |
34-
touch src/commands/ping.json
35-
make commands.def
36-
dirty="$(git diff)"
37-
if [[ ! -z "$dirty" ]]; then echo "$dirty"; exit 1; fi
38-
- name: unit tests
39-
run: |
40-
./src/valkey-unit-tests
41-
42-
test-ubuntu-latest-cmake:
43-
runs-on: ubuntu-latest
44-
steps:
45-
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
46-
- name: cmake and make
47-
run: |
48-
sudo apt-get install -y cmake libssl-dev
49-
mkdir -p build-release
50-
cd build-release
51-
cmake -DCMAKE_BUILD_TYPE=Release .. -DBUILD_TLS=yes -DBUILD_UNIT_TESTS=yes
52-
make -j$(nproc)
53-
- name: test
54-
run: |
55-
sudo apt-get install -y tcl8.6 tclx
56-
ln -sf $(pwd)/build-release/bin/valkey-server $(pwd)/src/valkey-server
57-
ln -sf $(pwd)/build-release/bin/valkey-cli $(pwd)/src/valkey-cli
58-
ln -sf $(pwd)/build-release/bin/valkey-benchmark $(pwd)/src/valkey-benchmark
59-
ln -sf $(pwd)/build-release/bin/valkey-server $(pwd)/src/valkey-check-aof
60-
ln -sf $(pwd)/build-release/bin/valkey-server $(pwd)/src/valkey-check-rdb
61-
ln -sf $(pwd)/build-release/bin/valkey-server $(pwd)/src/valkey-sentinel
62-
./runtest --verbose --tags -slow --dump-logs
63-
- name: unit tests
64-
run: |
65-
./build-release/bin/valkey-unit-tests
66-
67-
test-sanitizer-address:
68-
runs-on: ubuntu-latest
69-
steps:
20+
echo "GITHUB_REPOSITORY=${{github.event.inputs.use_repo}}" >> $GITHUB_ENV
21+
echo "GITHUB_HEAD_REF=${{github.event.inputs.use_git_ref}}" >> $GITHUB_ENV
22+
echo "skipjobs: ${{github.event.inputs.skipjobs}}"
23+
echo "skiptests: ${{github.event.inputs.skiptests}}"
24+
echo "test_args: ${{github.event.inputs.test_args}}"
25+
echo "cluster_test_args: ${{github.event.inputs.cluster_test_args}}"
7026
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
27+
with:
28+
repository: ${{ env.GITHUB_REPOSITORY }}
29+
ref: ${{ env.GITHUB_HEAD_REF }}
7130
- name: make
72-
# build with TLS module just for compilation coverage
73-
run: make -j4 all-with-unit-tests SANITIZER=address SERVER_CFLAGS='-Werror' BUILD_TLS=module
31+
run: make valgrind all-with-unit-tests CFLAGS="-DNO_MALLOC_USABLE_SIZE" SERVER_CFLAGS='-Werror'
7432
- name: testprep
75-
run: sudo apt-get install tcl8.6 tclx -y
76-
- name: test
77-
run: ./runtest --verbose --tags -slow --dump-logs
78-
- name: module api test
79-
run: CFLAGS='-Werror' ./runtest-moduleapi --verbose --dump-logs
80-
- name: unit tests
81-
run: ./src/valkey-unit-tests
82-
83-
test-rdma:
84-
runs-on: ubuntu-latest
85-
steps:
86-
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
87-
- name: prepare-development-libraries
88-
run: sudo apt-get install librdmacm-dev libibverbs-dev
89-
- name: make-rdma-module
90-
run: make -j4 BUILD_RDMA=module
91-
- name: make-rdma-builtin
92-
run: |
93-
make distclean
94-
make -j4 BUILD_RDMA=yes
95-
- name: clone-rxe-kmod
96-
run: |
97-
mkdir -p tests/rdma/rxe
98-
git clone https://github.com/pizhenwei/rxe.git tests/rdma/rxe
99-
make -C tests/rdma/rxe
100-
- name: clear-kernel-log
101-
run: sudo dmesg -c > /dev/null
102-
- name: test
103-
run: sudo ./runtest-rdma --install-rxe
104-
- name: show-kernel-log
105-
run: sudo dmesg -c
106-
107-
build-debian-old:
108-
runs-on: ubuntu-latest
109-
container: debian:bullseye
110-
steps:
111-
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
112-
- name: make
113-
run: |
114-
apt-get update && apt-get install -y build-essential
115-
make -j4 SERVER_CFLAGS='-Werror'
116-
117-
build-macos-latest:
118-
runs-on: macos-latest
119-
steps:
120-
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
121-
- name: make
122-
# Build with additional upcoming features
123-
run: make -j3 all-with-unit-tests SERVER_CFLAGS='-Werror' USE_FAST_FLOAT=yes
124-
125-
build-32bit:
126-
runs-on: ubuntu-latest
127-
steps:
128-
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
129-
- name: make
130-
# Fast float requires C++ 32-bit libraries to compile on 64-bit ubuntu
131-
# machine i.e. "-cross" suffixed version. Cross-compiling c++ to 32-bit
132-
# also requires multilib support for g++ compiler i.e. "-multilib"
133-
# suffixed version of g++. g++-multilib generally includes libstdc++.
134-
# *cross version as well, but it is also added explicitly just in case.
13533
run: |
13634
sudo apt-get update
137-
sudo apt-get install libc6-dev-i386 libstdc++-11-dev-i386-cross gcc-multilib g++-multilib
138-
make -j4 SERVER_CFLAGS='-Werror' 32bit USE_FAST_FLOAT=yes
139-
- name: unit tests
140-
run: |
141-
./src/valkey-unit-tests
142-
143-
build-libc-malloc:
144-
runs-on: ubuntu-latest
145-
steps:
146-
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
147-
- name: make
148-
run: make -j4 SERVER_CFLAGS='-Werror' MALLOC=libc USE_FAST_FLOAT=yes
149-
150-
build-almalinux8-jemalloc:
151-
runs-on: ubuntu-latest
152-
container: almalinux:8
153-
steps:
154-
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
155-
156-
- name: make
157-
run: |
158-
dnf -y install epel-release gcc gcc-c++ make procps-ng which
159-
make -j4 SERVER_CFLAGS='-Werror' USE_FAST_FLOAT=yes
160-
161-
format-yaml:
162-
runs-on: ubuntu-latest
163-
steps:
164-
- name: Checkout code
165-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
166-
167-
- name: Set up Go
168-
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
169-
with:
170-
go-version: "1.22.4"
171-
172-
- name: Setup YAML formatter
173-
run: |
174-
go install github.com/google/yamlfmt/cmd/yamlfmt@latest
175-
176-
- name: Run yamlfmt
177-
id: yamlfmt
178-
run: |
179-
yamlfmt -lint -conf .config/format.yml .
180-
# Capture the diff output
181-
DIFF=$(git diff)
182-
if [ ! -z "$DIFF" ]; then
183-
# Encode the diff in Base64 to ensure it's handled as a single line
184-
ENCODED_DIFF=$(echo "$DIFF" | base64 -w 0)
185-
echo "diff=$ENCODED_DIFF" >> $GITHUB_OUTPUT
186-
fi
187-
shell: bash
188-
189-
- name: Check for formatting changes
190-
if: ${{ steps.yamlfmt.outputs.diff }}
35+
sudo apt-get install tcl8.6 tclx valgrind -y
36+
- name: unittest
37+
if: true && !contains(github.event.inputs.skiptests, 'unittest')
19138
run: |
192-
echo "ERROR: YAML file is not formatted properly. Here is the diff: "
193-
# Decode the Base64 diff to display it
194-
echo "${{ steps.clang-format.outputs.diff }}" | base64 --decode
195-
exit 1
196-
shell: bash
39+
valgrind --track-origins=yes --suppressions=./src/valgrind.sup --show-reachable=no --show-possibly-lost=no --leak-check=full --log-file=err.txt ./src/valkey-unit-tests --valgrind
40+
if grep -q 0x err.txt; then cat err.txt; exit 1; fi

tests/unit/hashexpire.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4275,7 +4275,7 @@ foreach command {HEXPIRE HPEXPIRE HEXPIREAT HPEXPIREAT} {
42754275

42764276
# For each key, set expire for 5 fields
42774277
for {set i 1} {$i <= 5} {incr i} {
4278-
r $command myhash$i [get_short_expire_value $command] FIELDS 5 f1 f2 f3 f4 f5
4278+
assert_equal {1 1 1 1 1} [r $command myhash$i [get_short_expire_value $command] FIELDS 5 f1 f2 f3 f4 f5]
42794279
}
42804280

42814281
# Wait for expiry

0 commit comments

Comments
 (0)