如果无法编译 Common Test 套件,则测试失败 运行

Fail test run if Common Test suite cannot be compiled

如果我的一个 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}

...并继续。

编译失败如何中止

答案是 here. When ct_run encounters compilation error, it tries to ask you, whether you want to continue. continue/2 function does a dirty trick in order to determine if tests are run interactively. But you are able to cheat this function passing -noshell emulator option. In this case, continue/2 function will make decision 基于 -abort_if_missing_suites

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