Bobby R. Bruce has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/45480 )
Change subject: base,tests: Fix debug.cc tests to reflect new API changes
......................................................................
base,tests: Fix debug.cc tests to reflect new API changes
Due to simplifications in how the debug flag is enabled (here:
https://gem5-review.googlesource.com/c/public/gem5/+/45007), the
debug.cc.test tests were failing when compiled to .fast (`scons
build/NULL/unittests.fast`). This patch fixes the tests to work with
this new API.
Change-Id: Ifd49f698dcc9e5d2a81d4b4a9363b82dd8a91a97
---
M src/base/debug.test.cc
1 file changed, 20 insertions(+), 18 deletions(-)
diff --git a/src/base/debug.test.cc b/src/base/debug.test.cc
index 69ac095..03c6160 100644
--- a/src/base/debug.test.cc
+++ b/src/base/debug.test.cc
@@ -84,13 +84,13 @@
flag.enable();
ASSERT_FALSE(flag.tracing());
Debug::Flag::globalEnable();
- ASSERT_TRUE(flag.tracing());
+ ASSERT_TRUE(!TRACING_ON || flag.tracing());
// Verify that the global enabler works
Debug::Flag::globalDisable();
ASSERT_FALSE(flag.tracing());
Debug::Flag::globalEnable();
- ASSERT_TRUE(flag.tracing());
+ ASSERT_TRUE(!TRACING_ON || flag.tracing());
// Test disabling the flag with global enabled
flag.disable();
@@ -119,10 +119,10 @@
ASSERT_FALSE(flag.tracing());
Debug::Flag::globalEnable();
for (auto &kid : flag.kids()) {
- ASSERT_TRUE(kid->tracing());
+ ASSERT_TRUE(!TRACING_ON || kid->tracing());
}
- ASSERT_TRUE(flag_a.tracing());
- ASSERT_TRUE(flag_b.tracing());
+ ASSERT_TRUE(!TRACING_ON || flag_a.tracing());
+ ASSERT_TRUE(!TRACING_ON || flag_b.tracing());
// Test disabling the flag with global enabled
flag.disable();
@@ -163,22 +163,22 @@
ASSERT_FALSE(flag_b.tracing());
ASSERT_FALSE(flag.tracing());
flag_a.enable();
- ASSERT_TRUE(flag_a.tracing());
+ ASSERT_TRUE(!TRACING_ON || flag_a.tracing());
ASSERT_FALSE(flag_b.tracing());
ASSERT_FALSE(flag.tracing());
// Test that enabling both flags enables the compound flag
- ASSERT_TRUE(flag_a.tracing());
+ ASSERT_TRUE(!TRACING_ON || flag_a.tracing());
ASSERT_FALSE(flag_b.tracing());
ASSERT_FALSE(flag.tracing());
flag_b.enable();
- ASSERT_TRUE(flag_a.tracing());
- ASSERT_TRUE(flag_b.tracing());
+ ASSERT_TRUE(!TRACING_ON || flag_a.tracing());
+ ASSERT_TRUE(!TRACING_ON || flag_b.tracing());
// Test that disabling one of the flags disables the compound flag
flag_a.disable();
ASSERT_FALSE(flag_a.tracing());
- ASSERT_TRUE(flag_b.tracing());
+ ASSERT_TRUE(!TRACING_ON || flag_b.tracing());
ASSERT_FALSE(flag.tracing());
}
@@ -195,11 +195,11 @@
EXPECT_TRUE(flag = Debug::findFlag("FlagFindFlagTestA"));
ASSERT_FALSE(flag_a.tracing());
flag->enable();
- ASSERT_TRUE(flag_a.tracing());
+ ASSERT_TRUE(!TRACING_ON || flag_a.tracing());
EXPECT_TRUE(flag = Debug::findFlag("FlagFindFlagTestB"));
ASSERT_FALSE(flag_b.tracing());
flag->enable();
- ASSERT_TRUE(flag_b.tracing());
+ ASSERT_TRUE(!TRACING_ON || flag_b.tracing());
// Search for a non-existent flag
EXPECT_FALSE(Debug::findFlag("FlagFindFlagTestC"));
@@ -216,7 +216,7 @@
// enabled too
ASSERT_FALSE(flag_a.tracing());
EXPECT_TRUE(Debug::changeFlag("FlagChangeFlagTestA", true));
- ASSERT_TRUE(flag_a.tracing());
+ ASSERT_TRUE(!TRACING_ON || flag_a.tracing());
EXPECT_TRUE(Debug::changeFlag("FlagChangeFlagTestA", false));
ASSERT_FALSE(flag_a.tracing());
@@ -225,7 +225,7 @@
EXPECT_TRUE(Debug::changeFlag("FlagChangeFlagTestB", false));
ASSERT_FALSE(flag_b.tracing());
EXPECT_TRUE(Debug::changeFlag("FlagChangeFlagTestB", true));
- ASSERT_TRUE(flag_b.tracing());
+ ASSERT_TRUE(!TRACING_ON || flag_b.tracing());
// Change a non-existent flag
ASSERT_FALSE(Debug::changeFlag("FlagChangeFlagTestC", true));
@@ -241,7 +241,7 @@
// Enable and disable a flag
ASSERT_FALSE(flag_a.tracing());
setDebugFlag("FlagSetClearDebugFlagTestA");
- ASSERT_TRUE(flag_a.tracing());
+ ASSERT_TRUE(!TRACING_ON || flag_a.tracing());
clearDebugFlag("FlagSetClearDebugFlagTestA");
ASSERT_FALSE(flag_a.tracing());
@@ -250,7 +250,7 @@
clearDebugFlag("FlagSetClearDebugFlagTestB");
ASSERT_FALSE(flag_b.tracing());
setDebugFlag("FlagSetClearDebugFlagTestB");
- ASSERT_TRUE(flag_b.tracing());
+ ASSERT_TRUE(!TRACING_ON || flag_b.tracing());
// Change a non-existent flag
setDebugFlag("FlagSetClearDebugFlagTestC");
@@ -295,10 +295,12 @@
flag_c.enable();
compound_flag_b.enable();
- // Verify that the names of the enabled flags are printed
+ // Verify that the names of the enabled flags are printed if
TRACING_ON.
+ if (TRACING_ON) {
std::ostringstream os;
dumpDebugFlags(os);
std::string output = os.str();
EXPECT_EQ(output, "FlagDumpDebugFlagTestA\nFlagDumpDebugFlagTestC\n" \
- "FlagDumpDebugFlagTestE\n");
+ "FlagDumpDebugFlagTestE\n");
+ }
}
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/45480
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Ifd49f698dcc9e5d2a81d4b4a9363b82dd8a91a97
Gerrit-Change-Number: 45480
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