[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Impeller] started asserting golden test runner has fatal impeller validations #51357

Merged
merged 7 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
just removed conditional compilation for validation
  • Loading branch information
gaaclarke committed Mar 12, 2024
commit ff9972964e52e9ae6dfc005ce8e7c36da9fd57ae
5 changes: 1 addition & 4 deletions impeller/base/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@ impeller_component("base") {

impeller_component("base_unittests") {
testonly = true
sources = [
"base_unittests.cc",
"validation_unittests.cc",
]
sources = [ "base_unittests.cc" ]
deps = [
":base",
"//flutter/testing",
Expand Down
11 changes: 2 additions & 9 deletions impeller/base/validation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace impeller {

static std::atomic_int32_t sValidationLogsDisabledCount = 0;
static std::atomic_int32_t sValidationLogsAreFatal = 1;
static std::atomic_int32_t sValidationLogsAreFatal = 0;

void ImpellerValidationErrorsSetFatal(bool fatal) {
sValidationLogsAreFatal = fatal;
Expand Down Expand Up @@ -59,15 +59,8 @@ void ImpellerValidationBreak(const char* message) {
#endif // IMPELLER_ENABLE_VALIDATION
}

bool ImpellerValidationIsFatal() {
bool ImpellerValidationErrorsAreFatal() {
return sValidationLogsAreFatal;
}

bool ImpellerValidationIsEnabled() {
#ifdef IMPELLER_ENABLE_VALIDATION
return true;
#else
return false;
#endif
}
} // namespace impeller
10 changes: 1 addition & 9 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,9 +33,7 @@ void ImpellerValidationBreak(const char* message);

void ImpellerValidationErrorsSetFatal(bool fatal);

bool ImpellerValidationIsFatal();

bool ImpellerValidationIsEnabled();
bool ImpellerValidationErrorsAreFatal();

struct ScopedValidationDisable {
ScopedValidationDisable();
Expand Down
18 changes: 0 additions & 18 deletions impeller/base/validation_unittests.cc

This file was deleted.

7 changes: 2 additions & 5 deletions impeller/golden_tests/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,12 @@ void print_usage() {

namespace impeller {
TEST(ValidationTest, IsFatal) {
EXPECT_TRUE(ImpellerValidationIsFatal());
}

TEST(ValidationTest, IsEnabled) {
EXPECT_TRUE(ImpellerValidationIsEnabled());
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
Member

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