Skip to content

Commit 85bc9b0

Browse files
committed
speed-regression.tcl script: killing previously tested instance fixed. Don't run if there is already an instance running in the same port.
1 parent 84c6bdf commit 85bc9b0

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

utils/speed-regression.tcl

+22-6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
# Copyright (C) 2011 Salvatore Sanfilippo
33
# Released under the BSD license like Redis itself
44

5+
source ../tests/support/redis.tcl
6+
set ::port 12123
7+
58
proc run-tests branches {
69
set runs {}
710
set branch_id 0
@@ -22,16 +25,21 @@ proc run-tests branches {
2225

2326
# Start the Redis server
2427
puts " starting the server... [exec ./redis-server -v]"
25-
set pids [exec echo "port 12123\nloglevel warning\n" | ./redis-server - > /dev/null 2> /dev/null &]
28+
set pids [exec echo "port $::port\nloglevel warning\n" | ./redis-server - > /dev/null 2> /dev/null &]
29+
puts " pids: $pids"
2630
after 1000
2731
puts " running the benchmark"
28-
set output [exec /tmp/redis-benchmark -n 100000 --csv -p 12123]
32+
33+
set r [redis 127.0.0.1 $::port]
34+
set i [$r info]
35+
puts " redis INFO shows version: [lindex [split $i] 0]"
36+
$r close
37+
38+
set output [exec /tmp/redis-benchmark -n 100000 --csv -p $::port]
2939
lappend runs $b $output
3040
puts " killing server..."
31-
catch {
32-
exec kill -9 [lindex $pids 0]
33-
exec kill -9 [lindex $pids 1]
34-
}
41+
catch {exec kill -9 [lindex $pids 0]}
42+
catch {exec kill -9 [lindex $pids 1]}
3543
incr branch_id
3644
}
3745
return $runs
@@ -87,4 +95,12 @@ if {![file exists speed-regression.tcl]} {
8795
puts "Example: cd utils; ./speed-regression.tcl"
8896
exit 1
8997
}
98+
99+
# Make sure there is not already a server runnign on port 12123
100+
set is_not_running [catch {set r [redis 127.0.0.1 $::port]}]
101+
if {!$is_not_running} {
102+
puts "Sorry, you have a running server on port $::port"
103+
exit 1
104+
}
105+
90106
main

0 commit comments

Comments
 (0)