Search code examples
c++ioscmakegoogletestctest

googletest with ctest "Unexpected format: " error


I've a c++ test class implemented using googletest, so it is perfectly passing on Xcode with following output:

[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from test_fixture
[ RUN      ] test_fixture.test_name
[       OK ] test_fixture.test_name (65609 ms)
[----------] 1 test from test_fixture (65609 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (65609 ms total)
[  PASSED  ] 1 test.

But when I try to run the same test on terminal by using ctest command it is giving an strange error Unexpected format: with following output:

[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from test_fixture
[ RUN      ] test_fixture.test_name
Unexpected format: [ RUN      ] test_fixture.test_name (it is always printing the above line)

<end of output>
Test time =  29.72 sec

For both Xcode and ctest, the same iOS simulator used, I don't understand why the test output giving conclusion as "FAILED" or "PASSED". I've searched a lot for that error and couldn't find any reasonable answers, so please help.

Update:
It has turned out the ios simulator tool ios-sim has a problem with apps that runs longer than 30 secs (I tried with a googletest class with three empty functions which has delay of 15 secs between them, app crashed on second one), simulator crashes the app but didn't find why yet.


Solution

  • It turns out iOS Simulator tool I was using https://github.com/phonegap/ios-sim.
    I've emptied our test classes and added 3 test functions with delay of 15 secs between, if the app runs longer than 30 seconds, ios-sim crashes it.

    The solution for this case is to use real devices with the similar project: https://github.com/phonegap/ios-deploy