2024-03-21 09:30:47 -04:00
|
|
|
# SPDX-FileCopyrightText: 2024 Redict Contributors
|
|
|
|
# SPDX-FileCopyrightText: 2024 Salvatore Sanfilippo <antirez at gmail dot com>
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
2024-03-21 15:11:44 -04:00
|
|
|
# SPDX-License-Identifier: LGPL-3.0-only
|
2024-03-21 09:30:47 -04:00
|
|
|
|
2024-03-21 05:56:59 -04:00
|
|
|
proc redictbenchmark_tls_config {testsdir} {
|
2020-10-28 02:00:54 -04:00
|
|
|
set tlsdir [file join $testsdir tls]
|
2020-12-11 11:31:40 -05:00
|
|
|
set cert [file join $tlsdir client.crt]
|
|
|
|
set key [file join $tlsdir client.key]
|
2020-10-28 02:00:54 -04:00
|
|
|
set cacert [file join $tlsdir ca.crt]
|
|
|
|
|
|
|
|
if {$::tls} {
|
|
|
|
return [list --tls --cert $cert --key $key --cacert $cacert]
|
|
|
|
} else {
|
|
|
|
return {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-21 05:56:59 -04:00
|
|
|
proc redictbenchmark {host port {opts {}}} {
|
|
|
|
set cmd [list src/redict-benchmark -h $host -p $port]
|
|
|
|
lappend cmd {*}[redictbenchmark_tls_config "tests"]
|
2020-10-26 02:04:59 -04:00
|
|
|
lappend cmd {*}$opts
|
|
|
|
return $cmd
|
|
|
|
}
|
2021-09-14 12:45:06 -04:00
|
|
|
|
2024-03-21 05:56:59 -04:00
|
|
|
proc redictbenchmarkuri {host port {opts {}}} {
|
2024-03-26 06:33:40 -04:00
|
|
|
set cmd [list src/redict-benchmark -u redict://$host:$port]
|
2024-03-21 05:56:59 -04:00
|
|
|
lappend cmd {*}[redictbenchmark_tls_config "tests"]
|
2021-09-14 12:45:06 -04:00
|
|
|
lappend cmd {*}$opts
|
|
|
|
return $cmd
|
|
|
|
}
|
|
|
|
|
2024-03-21 05:56:59 -04:00
|
|
|
proc redictbenchmarkuriuserpass {host port user pass {opts {}}} {
|
2024-03-26 06:33:40 -04:00
|
|
|
set cmd [list src/redict-benchmark -u redict://$user:$pass@$host:$port]
|
2024-03-21 05:56:59 -04:00
|
|
|
lappend cmd {*}[redictbenchmark_tls_config "tests"]
|
2021-09-14 12:45:06 -04:00
|
|
|
lappend cmd {*}$opts
|
|
|
|
return $cmd
|
|
|
|
}
|