summaryrefslogtreecommitdiffstats
path: root/tests/support/benchmark.tcl
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/support/benchmark.tcl33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/support/benchmark.tcl b/tests/support/benchmark.tcl
new file mode 100644
index 0000000..156b205
--- /dev/null
+++ b/tests/support/benchmark.tcl
@@ -0,0 +1,33 @@
+proc redisbenchmark_tls_config {testsdir} {
+ set tlsdir [file join $testsdir tls]
+ set cert [file join $tlsdir client.crt]
+ set key [file join $tlsdir client.key]
+ set cacert [file join $tlsdir ca.crt]
+
+ if {$::tls} {
+ return [list --tls --cert $cert --key $key --cacert $cacert]
+ } else {
+ return {}
+ }
+}
+
+proc redisbenchmark {host port {opts {}}} {
+ set cmd [list src/redis-benchmark -h $host -p $port]
+ lappend cmd {*}[redisbenchmark_tls_config "tests"]
+ lappend cmd {*}$opts
+ return $cmd
+}
+
+proc redisbenchmarkuri {host port {opts {}}} {
+ set cmd [list src/redis-benchmark -u redis://$host:$port]
+ lappend cmd {*}[redisbenchmark_tls_config "tests"]
+ lappend cmd {*}$opts
+ return $cmd
+}
+
+proc redisbenchmarkuriuserpass {host port user pass {opts {}}} {
+ set cmd [list src/redis-benchmark -u redis://$user:$pass@$host:$port]
+ lappend cmd {*}[redisbenchmark_tls_config "tests"]
+ lappend cmd {*}$opts
+ return $cmd
+}