[gem5-dev] Change in gem5/gem5[develop]: base: Add enum to_number tests

2021-02-14 Thread Daniel Carvalho (Gerrit) via gem5-dev
Daniel Carvalho has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/41334 )


Change subject: base: Add enum to_number tests
..

base: Add enum to_number tests

Add a test to convert a string containing a number into enums.

One of the tests has been disabled to highlight an error-prone
situation where a number that is not a valid enum manages to
be converted to an enum.

Change-Id: I7967c62feea335f3ffda40d8bf0334c20b53ee6c
Signed-off-by: Daniel R. Carvalho 
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/41334
Tested-by: kokoro 
Reviewed-by: Bobby R. Bruce 
Maintainer: Bobby R. Bruce 
---
M src/base/str.test.cc
1 file changed, 24 insertions(+), 0 deletions(-)

Approvals:
  Bobby R. Bruce: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/base/str.test.cc b/src/base/str.test.cc
index a064a87..f0cd483 100644
--- a/src/base/str.test.cc
+++ b/src/base/str.test.cc
@@ -301,6 +301,30 @@
 EXPECT_FALSE(to_number(input, output));
 }

+TEST(StrTest, ToNumberEnum)
+{
+enum Number
+{
+TWO=2,
+};
+Number output;
+std::string input = "2";
+EXPECT_TRUE(to_number(input, output));
+EXPECT_EQ(TWO, output);
+}
+
+/** Test that trying to convert a number to an enum that is not valid  
fails. */

+TEST(StrTest, DISABLED_ToNumberEnumInvalid)
+{
+enum Number
+{
+TWO=2,
+};
+Number output;
+std::string input = "3";
+EXPECT_FALSE(to_number(input, output));
+}
+
 TEST(StrTest, ToNumberFloat)
 {
 float output;



The change was submitted with unreviewed changes in the following files:

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/41334
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: I7967c62feea335f3ffda40d8bf0334c20b53ee6c
Gerrit-Change-Number: 41334
Gerrit-PatchSet: 4
Gerrit-Owner: Daniel Carvalho 
Gerrit-Reviewer: Bobby R. Bruce 
Gerrit-Reviewer: Daniel Carvalho 
Gerrit-Reviewer: kokoro 
Gerrit-MessageType: merged
___
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

[gem5-dev] Change in gem5/gem5[develop]: base: Add unit test for base/logging

2021-02-14 Thread Daniel Carvalho (Gerrit) via gem5-dev
Daniel Carvalho has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/41398 )



Change subject: base: Add unit test for base/logging
..

base: Add unit test for base/logging

Add unit test for base/logging.

One of the tests has been disabled due to incorrectness
of output.

Change-Id: Ia890c06b44134b70eada7a9deadef882f00a5c27
Signed-off-by: Daniel R. Carvalho 
---
M src/base/SConscript
A src/base/logging.test.cc
2 files changed, 588 insertions(+), 0 deletions(-)



diff --git a/src/base/SConscript b/src/base/SConscript
index 03f54f6..7fe77ae 100644
--- a/src/base/SConscript
+++ b/src/base/SConscript
@@ -58,6 +58,7 @@
 GTest('inifile.test', 'inifile.test.cc', 'inifile.cc', 'str.cc')
 GTest('intmath.test', 'intmath.test.cc', with_tag('gem5 logging'))
 Source('logging.cc', add_tags='gem5 logging')
+GTest('logging.test', 'logging.test.cc', with_tag('gem5 logging'))
 Source('match.cc')
 GTest('match.test', 'match.test.cc', 'match.cc', 'str.cc')
 Source('output.cc')
diff --git a/src/base/logging.test.cc b/src/base/logging.test.cc
new file mode 100644
index 000..3075ab7
--- /dev/null
+++ b/src/base/logging.test.cc
@@ -0,0 +1,587 @@
+/*
+ * Copyright (c) 2021 Daniel R. Carvalho
+ * All rights reserved
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+#include 
+
+#include "base/logging.hh"
+
+class TestLogger : public Logger
+{
+  public:
+using Logger::Logger;
+
+  protected:
+void log(const Loc &loc, std::string s) override { std::cerr << s; }
+};
+
+#if TRACING_ON
+/** Test that a logger cannot be created with an empty prefix. */
+TEST(LoggingDeathTest, EmptyPrefix)
+{
+ASSERT_DEATH(TestLogger(nullptr), "");
+}
+#endif
+
+/** Test the most basic print using TestLogger. */
+TEST(LoggingTest, TestLoggerBasicPrint)
+{
+TestLogger logger("test: ");
+
+// The logger will automatically add '\n' to the end of the message
+// if it does not already have at least one.
+testing::internal::CaptureStderr();
+logger.print(Logger::Loc("File", 10), "message");
+ASSERT_EQ(testing::internal::GetCapturedStderr(),
+"test: message\n");
+
+testing::internal::CaptureStderr();
+logger.print(Logger::Loc("File", 10), "message\n");
+ASSERT_EQ(testing::internal::GetCapturedStderr(),
+"test: message\n");
+
+testing::internal::CaptureStderr();
+logger.print(Logger::Loc("File", 10), "sample message");
+ASSERT_EQ(testing::internal::GetCapturedStderr(),
+"test: sample message\n");
+
+testing::internal::CaptureStderr();
+logger.print(Logger::Loc("File", 10),
+"sample message\nwith \nthree lines");
+ASSERT_EQ(testing::internal::GetCapturedStderr(),
+"test: sample message\nwith \nthree lines\n");
+
+testing::internal::CaptureStderr();
+logger.print(Logger::Loc("File", 10), "sample message\n\n");
+ASSERT_EQ(testing::internal::GetCapturedStderr(),
+"test: sample message\n\n");
+}
+
+/** Test the variadic-arg print for chars using TestLogger. */
+TEST(LoggingTest, TestLoggerVariadicCharPrint)
+{
+TestLogger logger("test: ");
+
+testing::internal::CaptureStderr();
+logger.print(Logger::Loc("File", 10), (const char *)"%s message",
+"sample");
+ASSERT_EQ(testing::internal::GetCapturedStderr(),
+"test: sample message\n");
+
+testing::internal::CaptureStderr();
+logger.print(Logger::Loc("File", 10), (const char *)"sample %s %

[gem5-dev] Change in gem5/gem5[develop]: tests: Remove GTestLogger

2021-02-14 Thread Daniel Carvalho (Gerrit) via gem5-dev
Daniel Carvalho has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/41396 )



Change subject: tests: Remove GTestLogger
..

tests: Remove GTestLogger

Use the default logger functionality instead, and print the
log to cerr.

Change-Id: If4510eeeb40c936f986d84b639206c5884a08984
Signed-off-by: Daniel R. Carvalho 
---
M src/base/gtest/logging.cc
1 file changed, 3 insertions(+), 12 deletions(-)



diff --git a/src/base/gtest/logging.cc b/src/base/gtest/logging.cc
index d9cb9eb..8d40682 100644
--- a/src/base/gtest/logging.cc
+++ b/src/base/gtest/logging.cc
@@ -43,15 +43,6 @@
 struct GTestException
 {};

-class GTestLogger : public Logger
-{
-  public:
-using Logger::Logger;
-
-  protected:
-void log(const Loc &loc, std::string s) override { SUCCEED() << s; }
-};
-
 class GTestExitLogger : public Logger
 {
   public:
@@ -69,9 +60,9 @@

 GTestExitLogger panicLogger("panic: ");
 GTestExitLogger fatalLogger("fatal: ");
-GTestLogger warnLogger("warn: ");
-GTestLogger infoLogger("info: ");
-GTestLogger hackLogger("hack: ");
+Logger warnLogger("warn: ");
+Logger infoLogger("info: ");
+Logger hackLogger("hack: ");

 } // anonymous namespace


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/41396
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: If4510eeeb40c936f986d84b639206c5884a08984
Gerrit-Change-Number: 41396
Gerrit-PatchSet: 1
Gerrit-Owner: Daniel Carvalho 
Gerrit-MessageType: newchange
___
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

[gem5-dev] Change in gem5/gem5[develop]: base: Fix incorrect use of Logger::print

2021-02-14 Thread Daniel Carvalho (Gerrit) via gem5-dev
Daniel Carvalho has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/41399 )



Change subject: base: Fix incorrect use of Logger::print
..

base: Fix incorrect use of Logger::print

Previously when a formatted message was printed in a
Logger it would use the wrong function, and thus skip
the warning triggered by ccprintf. Fix this by merging
two prints to avoid ambiguity.

Change-Id: Idc51d2ef28ab4721d2be16f3e5fce19c494a0d47
Signed-off-by: Daniel R. Carvalho 
---
M src/base/logging.hh
M src/base/logging.test.cc
2 files changed, 10 insertions(+), 14 deletions(-)



diff --git a/src/base/logging.hh b/src/base/logging.hh
index e740e1d..4ef700a 100644
--- a/src/base/logging.hh
+++ b/src/base/logging.hh
@@ -90,24 +90,20 @@

 virtual ~Logger() {};

-void
-print(const Loc &loc, const std::string &str)
-{
-std::stringstream ss;
-ss << prefix << str;
-if (str.length() && str.back() != '\n' && str.back() != '\r')
-ss << std::endl;
-if (!enabled)
-return;
-log(loc, ss.str());
-}
-
 template void
 print(const Loc &loc, const char *format, const Args &...args)
 {
 std::stringstream ss;
 ccprintf(ss, format, args...);
-print(loc, ss.str());
+const std::string str = ss.str();
+
+std::stringstream ss_formatted;
+ss_formatted << prefix << str;
+if (str.length() && str.back() != '\n' && str.back() != '\r')
+ss_formatted << std::endl;
+if (!enabled)
+return;
+log(loc, ss_formatted.str());
 }

 template void
diff --git a/src/base/logging.test.cc b/src/base/logging.test.cc
index 3075ab7..c979148 100644
--- a/src/base/logging.test.cc
+++ b/src/base/logging.test.cc
@@ -141,7 +141,7 @@
  * Test the variadic-arg print for strings with arguments missing using
  * TestLogger.
  */
-TEST(LoggingTest, DISABLED_TestLoggerVariadicStringMissingPrint)
+TEST(LoggingTest, TestLoggerVariadicStringMissingPrint)
 {
 TestLogger logger("test: ");


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/41399
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: Idc51d2ef28ab4721d2be16f3e5fce19c494a0d47
Gerrit-Change-Number: 41399
Gerrit-PatchSet: 1
Gerrit-Owner: Daniel Carvalho 
Gerrit-MessageType: newchange
___
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

[gem5-dev] Change in gem5/gem5[develop]: tests: Remove gtest/logging

2021-02-14 Thread Daniel Carvalho (Gerrit) via gem5-dev
Daniel Carvalho has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/41397 )



Change subject: tests: Remove gtest/logging
..

tests: Remove gtest/logging

The existence of this file does not allow testing logging.cc,
since they are mutually exclusive.

Change-Id: Ib2dc780e06e7790526b34fb12d15dbb588e6c425
---
M src/base/SConscript
M src/base/debug.test.cc
D src/base/gtest/SConscript
D src/base/gtest/logging.cc
M src/base/loader/SConscript
M src/base/socket.test.cc
M src/base/stats/SConscript
M src/base/stats/storage.test.cc
M src/dev/SConscript
M src/sim/SConscript
10 files changed, 35 insertions(+), 159 deletions(-)



diff --git a/src/base/SConscript b/src/base/SConscript
index 1190b93..03f54f6 100644
--- a/src/base/SConscript
+++ b/src/base/SConscript
@@ -41,22 +41,23 @@
 GTest('cprintf.test', 'cprintf.test.cc')
 Executable('cprintftime', 'cprintftime.cc', 'cprintf.cc')
 Source('debug.cc')
-GTest('debug.test', 'debug.test.cc', 'debug.cc')
+GTest('debug.test', 'debug.test.cc', 'debug.cc', with_tag('gem5 logging'))
 if env['USE_FENV']:
 Source('fenv.c')
 if env['USE_PNG']:
 Source('pngwriter.cc')
 Source('fiber.cc')
-GTest('fiber.test', 'fiber.test.cc', 'fiber.cc')
+GTest('fiber.test', 'fiber.test.cc', 'fiber.cc', with_tag('gem5 logging'))
 GTest('flags.test', 'flags.test.cc')
-GTest('coroutine.test', 'coroutine.test.cc', 'fiber.cc')
+GTest('coroutine.test', 'coroutine.test.cc', 'fiber.cc',
+with_tag('gem5 logging'))
 Source('framebuffer.cc')
-Source('hostinfo.cc')
+Source('hostinfo.cc', add_tags='gem5 logging')
 Source('inet.cc')
 Source('inifile.cc')
 GTest('inifile.test', 'inifile.test.cc', 'inifile.cc', 'str.cc')
-GTest('intmath.test', 'intmath.test.cc')
-Source('logging.cc')
+GTest('intmath.test', 'intmath.test.cc', with_tag('gem5 logging'))
+Source('logging.cc', add_tags='gem5 logging')
 Source('match.cc')
 GTest('match.test', 'match.test.cc', 'match.cc', 'str.cc')
 Source('output.cc')
@@ -67,27 +68,29 @@
 if env['TARGET_ISA'] != 'null':
 Source('remote_gdb.cc')
 Source('socket.cc')
-GTest('socket.test', 'socket.test.cc', 'socket.cc')
+GTest('socket.test', 'socket.test.cc', 'socket.cc', with_tag('gem5  
logging'))

 Source('statistics.cc')
 Source('str.cc')
-GTest('str.test', 'str.test.cc', 'str.cc')
+GTest('str.test', 'str.test.cc', 'str.cc', with_tag('gem5 logging'))
 Source('time.cc')
 Source('version.cc')
 Source('temperature.cc')
 GTest('temperature.test', 'temperature.test.cc', 'temperature.cc')
 Source('trace.cc')
-GTest('trie.test', 'trie.test.cc')
+GTest('trie.test', 'trie.test.cc', with_tag('gem5 logging'))
 Source('types.cc')
 GTest('types.test', 'types.test.cc', 'types.cc')
 GTest('uncontended_mutex.test', 'uncontended_mutex.test.cc')

-GTest('addr_range.test', 'addr_range.test.cc')
-GTest('addr_range_map.test', 'addr_range_map.test.cc')
+GTest('addr_range.test', 'addr_range.test.cc', with_tag('gem5 logging'))
+GTest('addr_range_map.test', 'addr_range_map.test.cc',
+with_tag('gem5 logging'))
 GTest('bitunion.test', 'bitunion.test.cc')
-GTest('channel_addr.test', 'channel_addr.test.cc', 'channel_addr.cc')
-GTest('circlebuf.test', 'circlebuf.test.cc')
+GTest('channel_addr.test', 'channel_addr.test.cc', 'channel_addr.cc',
+with_tag('gem5 logging'))
+GTest('circlebuf.test', 'circlebuf.test.cc', with_tag('gem5 logging'))
 GTest('circular_queue.test', 'circular_queue.test.cc')
-GTest('sat_counter.test', 'sat_counter.test.cc')
+GTest('sat_counter.test', 'sat_counter.test.cc', with_tag('gem5 logging'))
 GTest('refcnt.test','refcnt.test.cc')
 GTest('condcodes.test', 'condcodes.test.cc')
 GTest('chunk_generator.test', 'chunk_generator.test.cc')
diff --git a/src/base/debug.test.cc b/src/base/debug.test.cc
index f995a33..49b1af8 100644
--- a/src/base/debug.test.cc
+++ b/src/base/debug.test.cc
@@ -26,6 +26,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */

+#include 
 #include 

 #include "base/debug.hh"
@@ -50,14 +51,10 @@
 /** Test that names are unique. */
 TEST(DebugFlagDeathTest, UniqueNames)
 {
+// We only care that the error message contains the name of the debug  
flag

 Debug::SimpleFlag flag("FlagUniqueNamesTest", "A");
-testing::internal::CaptureStderr();
-EXPECT_ANY_THROW(Debug::SimpleFlag("FlagUniqueNamesTest", "B"));
-const std::string expected = "panic: panic condition !result.second "
-"occurred: Flag FlagUniqueNamesTest already defined!\n";
-std::string actual = testing::internal::GetCapturedStderr().substr();
-actual = actual.substr(actual.find(":", actual.find(":") + 1) + 2);
-EXPECT_EQ(expected, actual);
+ASSERT_DEATH(Debug::SimpleFlag("FlagUniqueNamesTest", "B"),
+::testing::HasSubstr("FlagUniqueNamesTest"));
 }

 /** Test format attribute. */
diff --git a/src/base/gtest/SConscript b/src/base/gtest/SConscript
deleted file mode 100644
index 4bc34b5..000
--- a/sr

[gem5-dev] Change in gem5/gem5[develop]: base: Remove hostname from hostinfo

2021-02-14 Thread Daniel Carvalho (Gerrit) via gem5-dev
Daniel Carvalho has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/41394 )



Change subject: base: Remove hostname from hostinfo
..

base: Remove hostname from hostinfo

This function is not used anywhere.

In addition, gethostname uses a fixed host name, and
sethostname is not implemented (sim/syscall_emul). If
we were to handle sethostname too it would require a
special conjoint implementation anyway.

Change-Id: I20919a49b123a6a49582d9cfacf1fd167cb44776
Signed-off-by: Daniel R. Carvalho 
---
M src/base/hostinfo.cc
M src/base/hostinfo.hh
2 files changed, 0 insertions(+), 26 deletions(-)



diff --git a/src/base/hostinfo.cc b/src/base/hostinfo.cc
index 577ab01..0e11f3f 100644
--- a/src/base/hostinfo.cc
+++ b/src/base/hostinfo.cc
@@ -28,8 +28,6 @@

 #include "base/hostinfo.hh"

-#include 
-
 #ifdef __APPLE__
 #include 
 #include 
@@ -41,22 +39,6 @@
 #include "base/logging.hh"
 #include "base/str.hh"

-std::string
-__get_hostname()
-{
-char host[256];
-if (gethostname(host, sizeof host) == -1)
-warn("could not get host name!");
-return host;
-}
-
-std::string &
-hostname()
-{
-static std::string hostname = __get_hostname();
-return hostname;
-}
-
 #ifndef __APPLE__
 uint64_t
 procInfo(const char *filename, const char *target)
diff --git a/src/base/hostinfo.hh b/src/base/hostinfo.hh
index 3efb6f4..d8a8910 100644
--- a/src/base/hostinfo.hh
+++ b/src/base/hostinfo.hh
@@ -30,14 +30,6 @@
 #define __HOSTINFO_HH__

 #include 
-#include 
-
-/**
- * Get the host name for the current machine.
- *
- * @return The machine's host name.
- */
-std::string &hostname();

 /**
  * Determine the simulator process' total virtual memory usage.

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/41394
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: I20919a49b123a6a49582d9cfacf1fd167cb44776
Gerrit-Change-Number: 41394
Gerrit-PatchSet: 1
Gerrit-Owner: Daniel Carvalho 
Gerrit-MessageType: newchange
___
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

[gem5-dev] Change in gem5/gem5[develop]: base: Add default log functionality to Logger

2021-02-14 Thread Daniel Carvalho (Gerrit) via gem5-dev
Daniel Carvalho has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/41395 )



Change subject: base: Add default log functionality to Logger
..

base: Add default log functionality to Logger

The only difference between the NormalLogger and Logger is
a simple implementation for log(), which is then called by
the other loggers. Since this is common to everybody, move
this implementation to Logger and remove NormalLogger.

This makes it possible to test the NormalLoggers using the
current gtest logging framework.

Change-Id: I6805fa14f58ddc7d37b00fcd7fcacb32e0b5d456
Signed-off-by: Daniel R. Carvalho 
---
M src/base/logging.cc
M src/base/logging.hh
2 files changed, 7 insertions(+), 15 deletions(-)



diff --git a/src/base/logging.cc b/src/base/logging.cc
index b8f20f9..1290455 100644
--- a/src/base/logging.cc
+++ b/src/base/logging.cc
@@ -46,27 +46,18 @@

 namespace {

-class NormalLogger : public Logger
+class ExitLogger : public Logger
 {
   public:
 using Logger::Logger;

   protected:
-void log(const Loc &loc, std::string s) override { std::cerr << s; }
-};
-
-class ExitLogger : public NormalLogger
-{
-  public:
-using NormalLogger::NormalLogger;
-
-  protected:
 void
 log(const Loc &loc, std::string s) override
 {
 std::stringstream ss;
 ccprintf(ss, "Memory Usage: %ld KBytes\n", memUsage());
-NormalLogger::log(loc, s + ss.str());
+Logger::log(loc, s + ss.str());
 }
 };

@@ -81,9 +72,9 @@

 ExitLogger panicLogger("panic: ");
 FatalLogger fatalLogger("fatal: ");
-NormalLogger warnLogger("warn: ");
-NormalLogger infoLogger("info: ");
-NormalLogger hackLogger("hack: ");
+Logger warnLogger("warn: ");
+Logger infoLogger("info: ");
+Logger hackLogger("hack: ");

 } // anonymous namespace

diff --git a/src/base/logging.hh b/src/base/logging.hh
index 29a9563..e740e1d 100644
--- a/src/base/logging.hh
+++ b/src/base/logging.hh
@@ -126,7 +126,8 @@
   protected:
 bool enabled;

-virtual void log(const Loc &loc, std::string s) = 0;
+/** Generates the log message. By default it is sent to cerr. */
+virtual void log(const Loc &loc, std::string s) { std::cerr << s; }
 virtual void exit() { /* Fall through to the abort in exit_helper. */ }

 const char *prefix;

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/41395
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: I6805fa14f58ddc7d37b00fcd7fcacb32e0b5d456
Gerrit-Change-Number: 41395
Gerrit-PatchSet: 1
Gerrit-Owner: Daniel Carvalho 
Gerrit-MessageType: newchange
___
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

[gem5-dev] Change in gem5/gem5[develop]: base: Clean up base/hostinfo

2021-02-14 Thread Daniel Carvalho (Gerrit) via gem5-dev
Daniel Carvalho has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/41393 )



Change subject: base: Clean up base/hostinfo
..

base: Clean up base/hostinfo

General fixes to the style of base/hostinfo.(cc|hh).

Remove unnecessary includes.

Remove signature of private functions from header.

Add documentation.

Remove unnecessary include in sim_events.cc.

Change-Id: I54e1f13231e512d26cf0127cc80256fb5e91bf91
Signed-off-by: Daniel R. Carvalho 
---
M src/base/hostinfo.cc
M src/base/hostinfo.hh
M src/sim/sim_events.cc
3 files changed, 15 insertions(+), 22 deletions(-)



diff --git a/src/base/hostinfo.cc b/src/base/hostinfo.cc
index e835a10..577ab01 100644
--- a/src/base/hostinfo.cc
+++ b/src/base/hostinfo.cc
@@ -26,28 +26,20 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */

+#include "base/hostinfo.hh"
+
 #include 

 #ifdef __APPLE__
 #include 
 #include 
 #include 
-
-#endif
-
-#include "base/hostinfo.hh"
-
-#include 
-#include 
-#include 
+#else
 #include 
-#include 
-#include 
-#include 
+#endif

 #include "base/logging.hh"
 #include "base/str.hh"
-#include "base/types.hh"

 std::string
 __get_hostname()
@@ -65,10 +57,11 @@
 return hostname;
 }

+#ifndef __APPLE__
 uint64_t
 procInfo(const char *filename, const char *target)
 {
-int  done = 0;
+int done = 0;
 char line[80];
 char format[80];
 long usage;
@@ -82,7 +75,7 @@
 sscanf(line, format, &usage);

 fclose(fp);
-return usage ;
+return usage;
 }
 }
 }
@@ -92,6 +85,7 @@

 return 0;
 }
+#endif

 uint64_t
 memUsage()
diff --git a/src/base/hostinfo.hh b/src/base/hostinfo.hh
index 5351cba..3efb6f4 100644
--- a/src/base/hostinfo.hh
+++ b/src/base/hostinfo.hh
@@ -29,20 +29,20 @@
 #ifndef __HOSTINFO_HH__
 #define __HOSTINFO_HH__

+#include 
 #include 

-#include "base/types.hh"
-
-std::string __get_hostname();
-
+/**
+ * Get the host name for the current machine.
+ *
+ * @return The machine's host name.
+ */
 std::string &hostname();

-uint64_t procInfo(const char *filename, const char *target);
-
 /**
  * Determine the simulator process' total virtual memory usage.
  *
- * @return virtual memory usage in kilobytes
+ * @return Virtual memory usage in kilobytes
  */
 uint64_t memUsage();

diff --git a/src/sim/sim_events.cc b/src/sim/sim_events.cc
index af516d3..ba2cda2 100644
--- a/src/sim/sim_events.cc
+++ b/src/sim/sim_events.cc
@@ -45,7 +45,6 @@
 #include 

 #include "base/callback.hh"
-#include "base/hostinfo.hh"
 #include "sim/eventq.hh"
 #include "sim/sim_exit.hh"
 #include "sim/stats.hh"

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/41393
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: I54e1f13231e512d26cf0127cc80256fb5e91bf91
Gerrit-Change-Number: 41393
Gerrit-PatchSet: 1
Gerrit-Owner: Daniel Carvalho 
Gerrit-MessageType: newchange
___
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

[gem5-dev] Build failed in Jenkins: Nightly #217

2021-02-14 Thread jenkins-no-reply--- via gem5-dev
See 

Changes:

[tiago.muck] mem-ruby: warns on masked functional writes

[tiago.muck] mem-ruby: fixes for masked writes

[tiago.muck] mem-ruby: fix functional reads in abstract ctrl

[tiago.muck] mem-ruby: fix Sequencer latency reporting

[gabe.black] scons: In Check(Cxx|Link)Flag, only install the flag if it exists.

[gabe.black] scons: Use conf to determine if some flags are supported.

[gabe.black] scons: Move a displaced have_posix_clock check back where it goes.

[gabe.black] scons: Simplify check for have_posix_clock.

[gabe.black] scons: Simplify backtrace implementation detection.

[gabe.black] scons: Simplify the check for hdf5 support.

[gabe.black] scons: Create a Configure checker for pkg-config.

[gabe.black] scons: Simplify the check for protoc.

[gabe.black] scons: Merge redundant checks for the socket library.

[gabe.black] scons: Simplify kvm architecture compatibility check.

[kyleroarty1716] arch-gcn3: Fix sign extension for branches with multiplied 
offset

[tiago.muck] python: more readable Ruby dot topology

[tiago.muck] mem-ruby: add andMask to WriteMask

[tiago.muck] mem-ruby: add wakeup_port statement

[tiago.muck] mem-ruby: intToTick helper

[gabe.black] arch: Stop including unnecessary FP headers.

[gabe.black] arch-x86: Use popCount from bitfields.hh.


--
[...truncated 457.62 KB...]
[   OK ] StrTest.ToNumberUnsigned8BitInt (0 ms)
[ RUN  ] StrTest.ToNumberUnsigned8BitIntNegative
[   OK ] StrTest.ToNumberUnsigned8BitIntNegative (0 ms)
[ RUN  ] StrTest.ToNumber64BitInt
[   OK ] StrTest.ToNumber64BitInt (0 ms)
[ RUN  ] StrTest.ToNumber64BitIntInvalidString
[   OK ] StrTest.ToNumber64BitIntInvalidString (0 ms)
[ RUN  ] StrTest.ToNumberFloat
[   OK ] StrTest.ToNumberFloat (1 ms)
[ RUN  ] StrTest.ToNumberFloatIntegerString
[   OK ] StrTest.ToNumberFloatIntegerString (0 ms)
[ RUN  ] StrTest.ToNumberFloatNegative
[   OK ] StrTest.ToNumberFloatNegative (0 ms)
[ RUN  ] StrTest.ToNumberDouble
[   OK ] StrTest.ToNumberDouble (0 ms)
[ RUN  ] StrTest.ToNumberDoubleIntegerString
[   OK ] StrTest.ToNumberDoubleIntegerString (0 ms)
[ RUN  ] StrTest.ToNumberDoubleNegative
[   OK ] StrTest.ToNumberDoubleNegative (0 ms)
[ RUN  ] StrTest.ToBoolTrue
[   OK ] StrTest.ToBoolTrue (0 ms)
[ RUN  ] StrTest.ToBoolFalse
[   OK ] StrTest.ToBoolFalse (0 ms)
[ RUN  ] StrTest.ToBoolInvalidInput
[   OK ] StrTest.ToBoolInvalidInput (0 ms)
[ RUN  ] StrTest.QuoteStringNoSpace
[   OK ] StrTest.QuoteStringNoSpace (0 ms)
[ RUN  ] StrTest.QuoteStringWithSpace
[   OK ] StrTest.QuoteStringWithSpace (0 ms)
[ RUN  ] StrTest.QuoteQuotedString
[   OK ] StrTest.QuoteQuotedString (0 ms)
[ RUN  ] StrTest.QuoteStringWithTab
[   OK ] StrTest.QuoteStringWithTab (0 ms)
[ RUN  ] StrTest.StartswithDoubleStringDoesStartWith
[   OK ] StrTest.StartswithDoubleStringDoesStartWith (0 ms)
[ RUN  ] StrTest.StartswithDoubleStringDoesNotStartWith
[   OK ] StrTest.StartswithDoubleStringDoesNotStartWith (0 ms)
[ RUN  ] StrTest.StartswithDoubleCharArrayDoesStartWith
[   OK ] StrTest.StartswithDoubleCharArrayDoesStartWith (0 ms)
[ RUN  ] StrTest.StartswithDoubleCharArrayDoesNotStartWith
[   OK ] StrTest.StartswithDoubleCharArrayDoesNotStartWith (0 ms)
[ RUN  ] StrTest.StartswithStringCharArrayDoesStartWith
[   OK ] StrTest.StartswithStringCharArrayDoesStartWith (0 ms)
[ RUN  ] StrTest.StartswithStringCharArrayDoesNotStartWith
[   OK ] StrTest.StartswithStringCharArrayDoesNotStartWith (0 ms)
[--] 42 tests from StrTest (1 ms total)

[--] Global test environment tear-down
[==] 42 tests from 1 test suite ran. (2 ms total)
[  PASSED  ] 42 tests.
build/NULL/base/trie.test.prof 
--gtest_output=xml:build/NULL/unittests.prof/base/trie.test.xml
build/NULL/base/types.test.prof 
--gtest_output=xml:build/NULL/unittests.prof/base/types.test.xml
Running main() from build/googletest/googletest/src/gtest_main.cc
[==] Running 6 tests from 1 test suite.
[--] Global test environment set-up.
[--] 6 tests from TemperatureTest
[ RUN  ] TemperatureTest.Constructor
[   OK ] TemperatureTest.Constructor (0 ms)
[ RUN  ] TemperatureTest.Conversion
[   OK ] TemperatureTest.Conversion (0 ms)
[ RUN  ] TemperatureTest.Comparison
[   OK ] TemperatureTest.Comparison (0 ms)
[ RUN  ] TemperatureTest.BinaryOperators
[   OK ] TemperatureTest.BinaryOperators (0 ms)
[ RUN  ] TemperatureTest.AssignmentOperators
[   OK ] TemperatureTest.AssignmentOperators (0 ms)
[ RUN  ] TemperatureTest.OutStream
[   OK ] TemperatureTest.OutStream (0 ms)
[--] 6 tests from TemperatureTest (0 ms total)

[--] Global test environment tear-down
[==] 6 tests from 1 test suite ran. (1 ms total)
[  PASSED  ] 

[gem5-dev] Re: weird issue using gcr.io/gem5-test/clang-version-9 docker image?

2021-02-14 Thread Bobby Bruce via gem5-dev
I can't recreate the "clang-version-9 docker image without python3-config"
bug on my end . I also had a little check of Kokoro and found the image
there to be fine: https://gem5-review.googlesource.com/c/public/gem5/+/41373.
python3-config appears to exist on the image inside Kokoro.

I _think_ what you have is an out-of-date image on whatever system you're
running on. I don't know under what circumstances docker will pull the
latest version of an image, but you can do so manually with `docker pull
http://gcr.io/gem5-test/clang-version-9`. Can you do that and try again? I
think this will solve your problem.

--
Dr. Bobby R. Bruce
Room 2235,
Kemper Hall, UC Davis
Davis,
CA, 95616

web: https://www.bobbybruce.net


On Fri, Feb 12, 2021 at 5:35 PM Gabe Black  wrote:

> Hi Bobby, that's not the docker I'm using. The one I'm using is
> gcr.io/gem5-test/clang-version-9 which is the one run as part of the
> presubmit tests (see original email). There may have been drift between
> that and the compiler tests? When I run that docker interactively
> (otherwise the same command as in the presubmit script) I get the following:
>
> $ docker run -i -u $UID:$GID --volume $(pwd):$(pwd) -w $(pwd) --rm "
> gcr.io/gem5-test/clang-version-9"
> which python3-config
> python3-config
> /bin/bash: line 2: python3-config: command not found
>
> There's no command prompt so what is the output of what may not be clear.
> I typed the "which" line which produced no output (nothing found). Then I
> typed python3-config which returned the error message on the last line.
>
> The "leak" I'm referring to would be if the original build of gem5 (for
> the regressions) figured out, for instance, where to get the python library
> from, etc. scons will cache these values between builds to speed up build
> time, and may not attempt to redetermine those values which it would no
> longer be able to do once python3-config goes away in the second run. I
> think it does try to figure out when those values are stale and rerun
> config checks, but in my experience it's not 100% accurate and may not
> retry when it really should. That could be hiding the error in this case.
>
> Gabe
>
> On Fri, Feb 12, 2021 at 10:37 AM Bobby Bruce  wrote:
>
>> Hey Gabe,
>>
>> So, the docker image appears to have python3-config:
>>
>> ```
>> docker run --rm gcr.io/gem5-test/clang-version-9 python3-config
>> ```
>>
>> Returns:
>>
>> ```
>> Usage: /usr/bin/python3-config
>> --prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--help|--abiflags|--configdir
>> ```
>>
>> So it's in there.
>>
>> As far as I can tell it's been this way for a while. The Dockerfile used
>> to build the image is
>> `util/dockerfiles/ubuntu-18.04_clang-version/Dockerfile`. I'm confused by
>> this, I don't think anything should "leak" into the image in this way.
>> Could you link me to an example of this issue happening?
>>
>> --
>> Dr. Bobby R. Bruce
>> Room 2235,
>> Kemper Hall, UC Davis
>> Davis,
>> CA, 95616
>>
>> web: https://www.bobbybruce.net
>>
>>
>> On Wed, Feb 10, 2021 at 10:21 PM Gabe Black  wrote:
>>
>>> Hi folks. I was trying to debug a problem in one of my scons cleanups
>>> which was failing on kokoro when trying to build under clang. I think I
>>> fixed it, but after doing so it started to fail because it didn't like the
>>> version of python it was finding, and sure enough that image has
>>> python-config and python2.7-config installed on it, but no python3-config
>>> even though it has python 3.
>>>
>>> Does anybody know what's going on here? My best guess is that values
>>> from a previous build using a docker image that does have python3-config
>>> are leaking through and making the subsequent build with this image work,
>>> even though it doesn't work when done first.
>>>
>>> Where should I/we look to fix this image so it has python3-config on it?
>>>
>>> Gabe
>>>
>>
___
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

[gem5-dev] Change in gem5/gem5[develop]: tests: Update the presubit.sh to pull the latest Docker iamges

2021-02-14 Thread Bobby R. Bruce (Gerrit) via gem5-dev
Bobby R. Bruce has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/41374 )



Change subject: tests: Update the presubit.sh to pull the latest Docker  
iamges

..

tests: Update the presubit.sh to pull the latest Docker iamges

Change-Id: I6a7ad32ba44f73590d7871da6881b7b42ec3f9ee
---
M tests/jenkins/presubmit.sh
1 file changed, 4 insertions(+), 0 deletions(-)



diff --git a/tests/jenkins/presubmit.sh b/tests/jenkins/presubmit.sh
index f27c23c..f881cc1 100755
--- a/tests/jenkins/presubmit.sh
+++ b/tests/jenkins/presubmit.sh
@@ -47,6 +47,10 @@
 sudo ln -s /tmpfs/docker /var/lib/docker
 sudo /etc/init.d/docker start

+# Pull the latest docker images.
+docker pull ${DOCKER_IMAGE_ALL_DEP}
+docker pull ${DOCKER_IMAGE_CLANG_COMPILE}
+
 # Move the CWD to the gem5 checkout.
 cd git/jenkins-gem5-prod/


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/41374
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: I6a7ad32ba44f73590d7871da6881b7b42ec3f9ee
Gerrit-Change-Number: 41374
Gerrit-PatchSet: 1
Gerrit-Owner: Bobby R. Bruce 
Gerrit-MessageType: newchange
___
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

[gem5-dev] Change in gem5/gem5[develop]: tests: Mock commit to test the presubmit.sh docker images

2021-02-14 Thread Bobby R. Bruce (Gerrit) via gem5-dev
Bobby R. Bruce has uploaded this change for review. (  
https://gem5-review.googlesource.com/c/public/gem5/+/41373 )



Change subject: tests: Mock commit to test the presubmit.sh docker images
..

tests: Mock commit to test the presubmit.sh docker images

DO NOT COMMIT!!!

Change-Id: Ie90eb5e587701de14f18f1f3b1e05966e576e33b
---
M tests/jenkins/presubmit.sh
1 file changed, 4 insertions(+), 4 deletions(-)



diff --git a/tests/jenkins/presubmit.sh b/tests/jenkins/presubmit.sh
index f27c23c..9605af6 100755
--- a/tests/jenkins/presubmit.sh
+++ b/tests/jenkins/presubmit.sh
@@ -51,8 +51,8 @@
 cd git/jenkins-gem5-prod/

 #  Using a docker image with all the dependencies, we run the presubmit  
tests.

-docker run -u $UID:$GID --volume $(pwd):$(pwd) -w $(pwd) --rm \
-"${DOCKER_IMAGE_ALL_DEP}" "${PRESUBMIT_STAGE2}"
+#docker run -u $UID:$GID --volume $(pwd):$(pwd) -w $(pwd) --rm \
+#"${DOCKER_IMAGE_ALL_DEP}" "${PRESUBMIT_STAGE2}"

 # DOCKER_IMAGE_ALL_DEP compiles gem5.opt with GCC. We run a compilation of
 # gem5.fast on the Clang compiler to ensure changes are compilable with the
@@ -61,5 +61,5 @@
 # "Compiler Checks" tests: http://jenkins.gem5.org/job/Compiler-Checks.
 rm -rf build
 docker run -u $UID:$GID --volume $(pwd):$(pwd) -w $(pwd) --rm \
-"${DOCKER_IMAGE_CLANG_COMPILE}" /usr/bin/env python3 /usr/bin/scons \
-build/X86/gem5.fast -j4 --no-compress-debug
+"${DOCKER_IMAGE_CLANG_COMPILE}" python3-config #/usr/bin/env python3  
/usr/bin/scons \

+#build/X86/gem5.fast -j4 --no-compress-debug

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/41373
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: Ie90eb5e587701de14f18f1f3b1e05966e576e33b
Gerrit-Change-Number: 41373
Gerrit-PatchSet: 1
Gerrit-Owner: Bobby R. Bruce 
Gerrit-MessageType: newchange
___
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s