Skip to content

Commit

Permalink
bugfix & add pikatests
Browse files Browse the repository at this point in the history
  • Loading branch information
KernelMaker committed Dec 15, 2015
1 parent b36870c commit 517f883
Show file tree
Hide file tree
Showing 68 changed files with 11,389 additions and 5 deletions.
2 changes: 1 addition & 1 deletion conf/pika.conf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ target_file_size_base : 20971520
# Expire_logs_days
expire_logs_days : 7
# Expire_logs_nums
expire_logs_nums : 7
expire_logs_nums : 10
# Root_connection_num
root_connection_num : 2
# Slowlog_log_slower_than
Expand Down
3 changes: 3 additions & 0 deletions pikatests/TESTREAD
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
1. 把pika可执行程序拷贝到./src目录里,更名为redis-server
2. 把pika配置文件拷贝到./tests/assets/目录里,更名为default.conf
3. 删除上次执行的db, log目录,执行 tclsh tests/test_helper.tcl --clients 1 --single unit/type/set 测试pika set, 也可以直接运行脚本./pikatest.sh set
10 changes: 10 additions & 0 deletions pikatests/pikatest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
rm -rf /home/songzhao/develop/pika_test/redis/log
rm -rf /home/songzhao/develop/pika_test/redis/db
cp /home/songzhao/develop/pika/output/bin/pika /home/songzhao/develop/pika_test/redis/src/redis-server
#cp /home/songzhao/develop/pika/output/conf/pika.conf /home/songzhao/develop/pika_test/redis/tests/assets/default.conf

tclsh tests/test_helper.tcl --clients 1 --single unit/type/$1

rm -rf /home/songzhao/develop/pika_test/redis/log
rm -rf /home/songzhao/develop/pika_test/redis/db
32 changes: 32 additions & 0 deletions pikatests/tests/assets/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Pika port
port : 9221
# Thread Number
thread_num : 16
# Slave Thread Number
slave_thread_num : 7
# Pika log path
log_path : ./log
# Pika glog level
log_level : 0
# Pika db path
db_path : ./db/
# Pika write_buffer_size
write_buffer_size : 268435456
# Pika timeout
timeout : 60
# Requirepass
requirepass :
# Dump Prefix
dump_prefix :
# daemonize [yes | no]
#daemonize : yes
# Dump Path
dump_path : ./dump/
# Max Connection
maxconnection : 20000
# the per file size of sst to compact, defalut is 2M
target_file_size_base : 20971520
# Expire_logs_days
expire_logs_days : 1
# Expire_logs_nums
expire_logs_nums : 20
Binary file added pikatests/tests/assets/encodings.rdb
Binary file not shown.
Binary file added pikatests/tests/assets/hash-zipmap.rdb
Binary file not shown.
10 changes: 10 additions & 0 deletions pikatests/tests/helpers/bg_complex_data.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
source tests/support/redis.tcl
source tests/support/util.tcl

proc bg_complex_data {host port db ops} {
set r [redis $host $port]
$r select $db
createComplexDataset $r $ops
}

bg_complex_data [lindex $argv 0] [lindex $argv 1] [lindex $argv 2] [lindex $argv 3]
15 changes: 15 additions & 0 deletions pikatests/tests/helpers/gen_write_load.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
source tests/support/redis.tcl

proc gen_write_load {host port seconds} {
set start_time [clock seconds]
set r [redis $host $port 1]
$r select 9
while 1 {
$r set [expr rand()] [expr rand()]
if {[clock seconds]-$start_time > $seconds} {
exit 0
}
}
}

gen_write_load [lindex $argv 0] [lindex $argv 1] [lindex $argv 2]
Loading

0 comments on commit 517f883

Please sign in to comment.