diff options
author | Alexei Frolov <frolv@google.com> | 2023-08-16 20:20:01 +0000 |
---|---|---|
committer | CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-08-16 20:20:01 +0000 |
commit | 9f56449292f686e2f3dfcaefc3313d6de83430aa (patch) | |
tree | e9de7046f5e5ecaf0e94e722fae477585f6b3fdf /pw_unit_test | |
parent | db314ef0d07942b69591c251de0f12524963b0a0 (diff) | |
download | pigweed-9f56449292f686e2f3dfcaefc3313d6de83430aa.tar.gz |
pw_unit_test: Reset static value before running tests
The test framework unit tests which verify the SetUpTestSuite and
TearDownTestSuite functions set and check a static variable. If the
tests are run multiple times in the same execution context, all
subsequent runs will fail due to the value having been previously
modified. This resets the value to its initial state before every
test run.
Bug: 296157327
Change-Id: I5387af75471af3095a32930ba12542deff8f1cea
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/166590
Reviewed-by: Erick Pfeifer <erickpfeifer@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed-service-accounts.iam.gserviceaccount.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
Pigweed-Auto-Submit: Alexei Frolov <frolv@google.com>
Diffstat (limited to 'pw_unit_test')
-rw-r--r-- | pw_unit_test/framework_test.cc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/pw_unit_test/framework_test.cc b/pw_unit_test/framework_test.cc index c06348b54..6581d8c20 100644 --- a/pw_unit_test/framework_test.cc +++ b/pw_unit_test/framework_test.cc @@ -198,6 +198,7 @@ class SetUpAndTearDown : public ::testing::Test { static int value; static void SetUpTestSuite() { + value = 1; EXPECT_EQ(value, 1); value++; } |