Bobby R. Bruce has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/34898 )
Change subject: tests,base: Fixed unittests for .fast
......................................................................
tests,base: Fixed unittests for .fast
unittests.fast, unittests.prof, and unittests.perf had failing tests due
to the stripping of asserts via compiler optimization. This patch alters
the unittests to skip these tests when TRACING_ON == 0.
Change-Id: I2d4ab795ecfc2c4556b5eb1877635409d0836ec6
---
M src/base/intmath.test.cc
M src/base/sat_counter.test.cc
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/base/intmath.test.cc b/src/base/intmath.test.cc
index 5740bd4..4e88b00 100644
--- a/src/base/intmath.test.cc
+++ b/src/base/intmath.test.cc
@@ -72,11 +72,17 @@
EXPECT_EQ(0, floorLog2((int64_t)1));
}
+/* The IntmathDeathTest floorLog2 test is dependent on an assert being
+ * triggered. We therefore only run this test for .debug and .opt (where
+ * `TRACING_ON == 1`).
+ */
+#if TRACING_ON
TEST(IntmathDeathTest, floorLog2)
{
// Verify a non-positive input triggers an assert.
EXPECT_DEATH_IF_SUPPORTED(floorLog2(0), "x > 0");
}
+#endif
TEST(IntmathTest, ceilLog2)
{
diff --git a/src/base/sat_counter.test.cc b/src/base/sat_counter.test.cc
index 6de7ef7..214b015 100644
--- a/src/base/sat_counter.test.cc
+++ b/src/base/sat_counter.test.cc
@@ -185,9 +185,13 @@
ASSERT_EQ(counter, 0);
// Make sure the counters cannot be shifted by negative numbers, since
- // that is undefined behaviour
+ // that is undefined behaviour. As these tests depend on asserts
failing,
+ // these tests are only functional if `TRACING_ON == 1`, when gem5 is
+ // compiled as `debug` or `opt`.
+ #if TRACING_ON
ASSERT_DEATH(counter >>= -1, "");
ASSERT_DEATH(counter <<= -1, "");
+ #endif
}
/**
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/34898
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: release-staging-v20.1.0.0
Gerrit-Change-Id: I2d4ab795ecfc2c4556b5eb1877635409d0836ec6
Gerrit-Change-Number: 34898
Gerrit-PatchSet: 1
Gerrit-Owner: Bobby R. Bruce <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s