在 tcl 脚本中,exec make check RUNTESTFLAGS=“compile.exp --target_board=atmega128-sim”不起作用
我正在尝试使用 tcl 中的驱动程序脚本运行 gcc 测试套件。 当我写
if {[catch {exec make check RUNTESTFLAGS="compile.exp --target_board=atmega128-sim"} errmsg ]} {
puts "Test finished with failures\n $errmsg"
} else {
puts "Test finished"
}
这会给出错误,因为
测试完成失败
make: unrecognized option `--target_board=atmega128-sim"'
用法:make [options] [target] ... ……
但是如果我从 RUNTESTFLAGS 中删除compile.exp,它就可以正常工作。
if {[catch {exec make check RUNTESTFLAGS="--target_board=atmega128-sim"} errmsg ]} {
.....
是因为参数 RUNTESTFLAGS 中存在双引号吗? 我需要使用不同的 RUNTESTFLAGS 运行 make check。 请建议一种方法来实现这一目标。
提前致谢 !!
I am trying to run the gcc testsuite using a driver script in tcl.
When i write
if {[catch {exec make check RUNTESTFLAGS="compile.exp --target_board=atmega128-sim"} errmsg ]} {
puts "Test finished with failures\n $errmsg"
} else {
puts "Test finished"
}
This gives error as
Test finished with failures
make: unrecognized option `--target_board=atmega128-sim"'
Usage: make [options] [target] ...
......
But if I remove the compile.exp from the RUNTESTFLAGS, it works fine.
if {[catch {exec make check RUNTESTFLAGS="--target_board=atmega128-sim"} errmsg ]} {
.....
Is it because of the double quotes present in argument RUNTESTFLAGS?
I need to run make check with different RUNTESTFLAGS.
Please suggest a way to achieve this.
Thanks in advance !!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,这个问题的核心是:
其他一切都只是(正确的)包装。问题是您使用的是上面的 Bourne shell 语法,而不是 Tcl 语法,因此上面的结果是将 RUNTESTFLAGS 设置为
"compile.exp
(带引号),其余部分作为另一个参数发送到不是你想要的!(Tcl 只允许双引号字符串在单词的前面开始;bash 更宽松。)正确的版本是:但是它更容易并且更清晰把它分开,像这样:
First off, the core of this question is about:
Everything else is just (correct) wrapping. The issue is that you are using Bourne shell syntax above, not Tcl syntax, so the above ends up with RUNTESTFLAGS set to
"compile.exp
(with the quote) and the rest is sent as another argument to make. Not what you want! (Tcl only lets a double-quoted string start at the front of a word; bash is more lenient.) A correct version would be:But it's easier and much clearer to split that up, like this: