erlangcommon-test

Fail test run if Common Test suite cannot be compiled


If I have a syntax error in one of my Common Test suites, ct_run simply waits for 15 seconds and then continues. It displays this message:

{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)

If I use -noshell, then it displays:

{error,make_failed}

...and continues anyway.

How do I make it abort if compilation fails?


Solution

  • Answer is 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 based on -abort_if_missing_suites.

    So, you need to ct_run -abort_if_missing_suites -erl_args -noshell.