Skip to content

Criterion C test framework : SIGSEGV fault only generated after all tests have passed #184

Open
@nomennescio

Description

@nomennescio

Not sure what is causing this behavior, might also be related to the way error messages are handled in the output pane.

During execution of code under test, which is accessing memory beyond the last element + 1 in an array (Undefined Behavior), ALL test cases pass successfully. However after the last test case is passed succesfully in a Test(_,_){} block, and an additional message is printed after the last test case, which is shown in the output, and seemingly at the point the Test block is exited, ONLY THEN an additional error message is printed. See the example below:

  sample_test("rAnDoM CaPs CrAzInEsS", "Random Caps Craziness");
  puts ("after last test");
  fflush (stdout);
}

yields

Test Passed
Log
after last test
Test Crashed
Caught unexpected signal: SIGSEGV (11). Invalid memory access.
Completed in 0.0000ms

I would expect the test framework to not pass all tests successfully, but generate the signal sooner, and fail the first test case that exhibits such undefined behavior. Else the user is very hard pressed to find an error in his code.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions