Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit ac7848a

Browse files
committed
[Impeller] started asserting test runners have fatal validations
1 parent eac124e commit ac7848a

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

impeller/base/BUILD.gn

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ impeller_component("base") {
3232

3333
impeller_component("base_unittests") {
3434
testonly = true
35-
sources = [ "base_unittests.cc" ]
35+
sources = [
36+
"base_unittests.cc",
37+
"validation_unittests.cc",
38+
]
3639
deps = [
3740
":base",
3841
"//flutter/testing",

impeller/base/validation.cc

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
namespace impeller {
1212

1313
static std::atomic_int32_t sValidationLogsDisabledCount = 0;
14-
static std::atomic_int32_t sValidationLogsAreFatal = 0;
14+
static std::atomic_int32_t sValidationLogsAreFatal = 1;
1515

1616
void ImpellerValidationErrorsSetFatal(bool fatal) {
1717
sValidationLogsAreFatal = fatal;
@@ -59,4 +59,15 @@ void ImpellerValidationBreak(const char* message) {
5959
#endif // IMPELLER_ENABLE_VALIDATION
6060
}
6161

62+
bool ImpellerValidationErrorsIsFatal() {
63+
return sValidationLogsAreFatal;
64+
}
65+
66+
bool ImpellerValidationIsEnabled() {
67+
#ifdef IMPELLER_ENABLE_VALIDATION
68+
return true;
69+
#else
70+
return false;
71+
#endif
72+
}
6273
} // namespace impeller

impeller/base/validation.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ void ImpellerValidationBreak(const char* message);
3939

4040
void ImpellerValidationErrorsSetFatal(bool fatal);
4141

42+
bool ImpellerValidationErrorsIsFatal();
43+
44+
bool ImpellerValidationIsEnabled();
45+
4246
struct ScopedValidationDisable {
4347
ScopedValidationDisable();
4448

0 commit comments

Comments
 (0)