环境
ubuntu
sudo apt-get update
sudo apt-get install -y --no-install-recommends pkg-config libjemalloc-dev git ca-certificates wget dpkg-dev gcc g++ libc6-dev libssl-dev make git cmake python3 python3-pip python3-venv python3-dev unzip rsync clang automake autoconf libtool tcl tcl-dev
centos
dnf install sudo -y
sudo dnf install jemalloc-devel -y
编译
# 以tls模式编译
make BUILD_TLS=yes
# 编译测试module
make -C tests/modules/
# 32位编译
make 32bit REDIS_CFLAGS='-Werror -DREDIS_TEST'
测试
# 执行单个测试
./runtest --single "unit/moduleapi/scan" --only "Module scan hash dict"
# linux上taskset执行
taskset -c 0 ./runtest --single "unit/memefficiency" --only "Active defrag big keys: standalone" --loop --stop
# CI忽略执行
--skipunit unit/cluster/atomic-slot-migration
# 执行单元测试
make REDIS_CFLAGS='-Werror -DREDIS_TEST'
./src/redis-server test all
一次性执行全部redis-cli命令
可以新建 a.txt 文件:
flushall
config set sanitize-dump-payload no
debug set-skip-checksum-validation 1
restore _hash 0 "\x10\x15\x15\x00\x00\x00\x06\x00\x00\x01\x00\x01\x01\x01\x82\x5F\x31\x4B\x02\x01\x02\x01\xFF\x0C\x00\x5F\x57\x3E\x3A\xFC\x78\x01\x0D" replace
然后执行 $ cat a.txt| ./src/redis-cli 结果如下:
OK
OK
OK
(error) ERR Bad data format






