Commit 89391e42 authored by sundb's avatar sundb Committed by Oran Agra
Browse files

Skip test for sdsRemoveFreeSpace when mem_allocator is not jemalloc (#11878)

Test `trim on SET with big value` (introduced from #11817) fails under mac m1 with libc mem_allocator.
The reason is that malloc(33000) will allocate 65536 bytes(>42000).
This test still passes under ubuntu with libc mem_allocator.

```
*** [err]: trim on SET with big value in tests/unit/type/string.tcl
Expected [r memory usage key] < 42000 (context: type source line 471 file /Users/iospack/data/redis_fork/tests/unit/type/string.tcl cmd {assert {[r memory usage key] < 42000}} proc ::test)
```

simple test under mac m1 with libc mem_allocator:
```c
void *p = zmalloc(33000);
printf("malloc size: %zu\n", zmalloc_size(p));

# output
malloc size: 65536
```

(cherry picked from commit 3fba3ccd)
(cherry picked from commit 646069a9)
parent 8f30d2a6
...@@ -458,6 +458,7 @@ start_server {tags {"string"}} { ...@@ -458,6 +458,7 @@ start_server {tags {"string"}} {
} }
} }
if {[string match {*jemalloc*} [s mem_allocator]]} {
test {trim on SET with big value} { test {trim on SET with big value} {
# set a big value to trigger increasing the query buf # set a big value to trigger increasing the query buf
r set key [string repeat A 100000] r set key [string repeat A 100000]
...@@ -466,6 +467,7 @@ start_server {tags {"string"}} { ...@@ -466,6 +467,7 @@ start_server {tags {"string"}} {
# asset the value was trimmed # asset the value was trimmed
assert {[r memory usage key] < 42000}; # 42K to count for Jemalloc's additional memory overhead. assert {[r memory usage key] < 42000}; # 42K to count for Jemalloc's additional memory overhead.
} }
} ;# if jemalloc
test {Extended SET can detect syntax errors} { test {Extended SET can detect syntax errors} {
set e {} set e {}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment