Skip to content

[FR]: Please improve documentation regarding "test crashes" #4790

Open
@pkrukp

Description

@pkrukp

Does the feature exist in the most recent commit?

No.

Why do we need this feature?

Documentation should be clear.

Describe the proposal.

In "Basic Concepts" in Primer it says:

If a test crashes or has a failed assertion, then it fails

What is a test crash ?

My guess is that the word "crash" was used incorrectly here... Maybe you mean "uncaught exception or structured exception is thrown from the test"? Or are there any other kinds of "crashes" that are handled by GoogleTest?


For example, if I do division by 0, then on Linux the test exec will crash with Floating point exception (core dumped) and exit code 136, no other tests will be executed. (On Windows, a structured exception will be thrown and handled by GoogleTest).

Also, in "Detecting Test Premature Exit" in Advanced Topics it says:

Google Test implements the premature-exit-file protocol for test runners to catch any kind of unexpected exits of test programs

But even if I set the TEST_PREMATURE_EXIT_FILE, the file is created, but the test exec behavior does not change.

I understand there are Death Tests and I assume they would detect/catch such crash (haven't checked).


Repro:

#include "gtest/gtest.h"

int x = 0;

TEST(CrashTest, Test1) {
  ASSERT_FALSE(10 / x > 0);
}

TEST(CrashTest, Test2) {
  ASSERT_TRUE(10 > 0);
}

Is the feature specific to an operating system, compiler, or build system version?

No.

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