【问题标题】:Fail test run if Common Test suite cannot be compiled如果无法编译通用测试套件,则测试运行失败
【发布时间】:2015-09-29 04:37:02
【问题描述】:

如果我的某个 Common Test 套件出现语法错误,ct_run 只需等待 15 秒然后继续。它显示此消息:

{error,make_failed}

Failed to compile or locate one or more test suites
Press 'c' to continue or 'a' to abort.
Will continue in 15 seconds if no answer is given!
(c/a)

如果我使用-noshell,那么它会显示:

{error,make_failed}

...然后继续。

如果编译失败,我如何使其中止

【问题讨论】:

  • 不会ct_run -erl_args -noshell 禁用任何交互吗?
  • 是的,但它仍在继续......
  • 你试过-abort_if_missing_suites-noshell吗?
  • 嗯,看来我误解了原来的问题。所以是的,两个选项都需要。

标签: erlang common-test


【解决方案1】:

答案是here。当 ct_run 遇到编译错误时,它会尝试询问您是否要继续。 continue/2 函数执行 dirty trick 以确定测试是否以交互方式运行。但是你可以通过-noshell 模拟器选项来欺骗这个函数。在这种情况下,continue/2 函数将基于 -abort_if_missing_suitesmake decision

所以,你需要ct_run -abort_if_missing_suites -erl_args -noshell

【讨论】:

  • 请注意,这需要 Erlang 17.0 或更高版本;目前我们仍在使用 Erlang R16B03-1。
  • 糟糕。那很有意思。我没有偷看旧版本的代码。
  • 在 18.2 中,您不再需要 -noshell 选项来使 -abort_if_missing_suites 工作(但我们仍在使用 17.x...)
  • 重要提示(因为我犯了这个错误):只有将它放在 before -erl_args.
猜你喜欢
  • 1970-01-01
  • 2021-07-04
  • 2019-10-09
  • 1970-01-01
  • 2020-04-14
  • 1970-01-01
  • 2020-06-02
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多