Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions impeller/base/validation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,8 @@ void ImpellerValidationBreak(const char* message) {
#endif // IMPELLER_ENABLE_VALIDATION
}

bool ImpellerValidationErrorsAreFatal() {
return sValidationLogsAreFatal;
}

} // namespace impeller
8 changes: 2 additions & 6 deletions impeller/base/validation.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@
#ifndef FLUTTER_IMPELLER_BASE_VALIDATION_H_
#define FLUTTER_IMPELLER_BASE_VALIDATION_H_

#ifndef IMPELLER_ENABLE_VALIDATION
#ifdef IMPELLER_DEBUG
#define IMPELLER_ENABLE_VALIDATION 1
#endif
#endif

#include <sstream>

namespace impeller {
Expand Down Expand Up @@ -39,6 +33,8 @@ void ImpellerValidationBreak(const char* message);

void ImpellerValidationErrorsSetFatal(bool fatal);

bool ImpellerValidationErrorsAreFatal();

struct ScopedValidationDisable {
ScopedValidationDisable();

Expand Down
8 changes: 8 additions & 0 deletions impeller/golden_tests/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "flutter/fml/build_config.h"
#include "flutter/fml/command_line.h"
#include "flutter/fml/logging.h"
#include "flutter/impeller/base/validation.h"
#include "flutter/impeller/golden_tests/golden_digest.h"
#include "flutter/impeller/golden_tests/working_directory.h"
#include "gtest/gtest.h"
Expand All @@ -24,7 +25,14 @@ void print_usage() {
}
} // namespace

namespace impeller {
TEST(ValidationTest, IsFatal) {
EXPECT_TRUE(ImpellerValidationErrorsAreFatal());
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to use EXPECT_EXIT but I couldn't get it to stop killing the process.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You want to use EXPECT_DEATH?

That seems to work for me

}
} // namespace impeller

int main(int argc, char** argv) {
impeller::ImpellerValidationErrorsSetFatal(true);
fml::InstallCrashHandler();
testing::InitGoogleTest(&argc, argv);
fml::CommandLine cmd = fml::CommandLineFromPlatformOrArgcArgv(argc, argv);
Expand Down