Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xindoo
redis
提交
1c4114be
R
redis
项目概览
xindoo
/
redis
通知
2
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
redis
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
1c4114be
编写于
5月 14, 2010
作者:
P
Pieter Noordhuis
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
store entire server object on the stack instead of just the client
上级
9cf9e6f1
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
41 addition
and
16 deletion
+41
-16
tests/support/server.tcl
tests/support/server.tcl
+13
-11
tests/test_helper.tcl
tests/test_helper.tcl
+28
-5
未找到文件。
tests/support/server.tcl
浏览文件 @
1c4114be
...
...
@@ -103,23 +103,25 @@ proc start_server {filename overrides {code undefined}} {
}
# setup config dict
dict set ret
"config"
$config_file
dict set ret
"pid"
$pid
dict set ret
"stdout"
$stdout
dict set ret
"stderr"
$stderr
dict set ret
"client"
$client
dict set srv
"config"
$config_file
dict set srv
"pid"
$pid
dict set srv
"host"
$host
dict set srv
"port"
$port
dict set srv
"stdout"
$stdout
dict set srv
"stderr"
$stderr
dict set srv
"client"
$client
if
{
$code
ne
"undefined"
}
{
# append the
client to the client
stack
lappend ::
clients $client
# append the
server to the
stack
lappend ::
servers $srv
# execute provided block
catch
{
uplevel 1 $code
}
err
# pop the
client
object
set ::
clients
[
lrange $::client
s 0 end-1
]
# pop the
server
object
set ::
servers
[
lrange $::server
s 0 end-1
]
kill_server $
ret
kill_server $
srv
if
{[
string length $err
]
> 0
}
{
puts
"Error executing the suite, aborting..."
...
...
@@ -127,6 +129,6 @@ proc start_server {filename overrides {code undefined}} {
exit 1
}
}
else
{
set _ $
ret
set _ $
srv
}
}
tests/test_helper.tcl
浏览文件 @
1c4114be
...
...
@@ -18,12 +18,35 @@ proc execute_tests name {
source
"tests/
$name.tcl
"
}
# setup a list to hold a stack of clients. the proc
"r"
provides easy
# access to the client at the top of the stack
set ::clients
{}
# Setup a list to hold a stack of server configs. When calls to start_server
# are nested, use
"srv 0 pid"
to get the pid of the inner server. To access
# outer servers, use
"srv -1 pid"
etcetera.
set ::servers
{}
proc srv
{
level property
}
{
set srv
[
lindex $::servers end+$level
]
dict get $srv $property
}
# Provide easy access to the client for the inner server. It's possible to
# prepend the argument list with a negative level to access clients for
# servers running in outer blocks.
proc r
{
args
}
{
set client
[
lindex $::clients end
]
$client
{*}
$args
set level 0
if
{[
string is integer
[
lindex $args 0
]]}
{
set level
[
lindex $args 0
]
set args
[
lrange $args 1 end
]
}
[
srv $level
"client"
]
{*}
$args
}
# Provide easy access to INFO properties. Same semantic as
"proc r"
.
proc s
{
args
}
{
set level 0
if
{[
string is integer
[
lindex $args 0
]]}
{
set level
[
lindex $args 0
]
set args
[
lrange $args 1 end
]
}
status
[
srv $level
"client"
]
[
lindex $args 0
]
}
proc main
{}
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录