benchmark.tcl 987 B

123456789101112131415161718192021222324252627282930313233
  1. proc redisbenchmark_tls_config {testsdir} {
  2. set tlsdir [file join $testsdir tls]
  3. set cert [file join $tlsdir client.crt]
  4. set key [file join $tlsdir client.key]
  5. set cacert [file join $tlsdir ca.crt]
  6. if {$::tls} {
  7. return [list --tls --cert $cert --key $key --cacert $cacert]
  8. } else {
  9. return {}
  10. }
  11. }
  12. proc redisbenchmark {host port {opts {}}} {
  13. set cmd [list src/redis-benchmark -h $host -p $port]
  14. lappend cmd {*}[redisbenchmark_tls_config "tests"]
  15. lappend cmd {*}$opts
  16. return $cmd
  17. }
  18. proc redisbenchmarkuri {host port {opts {}}} {
  19. set cmd [list src/redis-benchmark -u redis://$host:$port]
  20. lappend cmd {*}[redisbenchmark_tls_config "tests"]
  21. lappend cmd {*}$opts
  22. return $cmd
  23. }
  24. proc redisbenchmarkuriuserpass {host port user pass {opts {}}} {
  25. set cmd [list src/redis-benchmark -u redis://$user:$pass@$host:$port]
  26. lappend cmd {*}[redisbenchmark_tls_config "tests"]
  27. lappend cmd {*}$opts
  28. return $cmd
  29. }