summaryrefslogtreecommitdiffstats
path: root/logging_test.cpp
diff options
context:
space:
mode:
authorAndrew Geissler <andrewg@us.ibm.com>2016-11-10 16:50:35 -0600
committerAndrew Geissler <andrewg@us.ibm.com>2016-11-18 10:22:16 -0600
commitdf048c14a282be7601a6f47516c35e6c262f4075 (patch)
tree19e4487f51fe45d1690724fb1463b83501baaff6 /logging_test.cpp
parentd311bc8d781caab241233465ad276c15a97bade5 (diff)
downloadphosphor-logging-df048c14a282be7601a6f47516c35e6c262f4075.tar.gz
phosphor-logging-df048c14a282be7601a6f47516c35e6c262f4075.zip
Update elog gen script to support the dbus specified errors
This work is in prep for running this python script against the errors defined in the phosphor-dbus-interfaces repo Change-Id: I85e6f612a5935391deaedc74aab06ca023c15703 Signed-off-by: Andrew Geissler <andrewg@us.ibm.com>
Diffstat (limited to 'logging_test.cpp')
-rw-r--r--logging_test.cpp43
1 files changed, 25 insertions, 18 deletions
diff --git a/logging_test.cpp b/logging_test.cpp
index c5f622c..6c7d343 100644
--- a/logging_test.cpp
+++ b/logging_test.cpp
@@ -75,29 +75,36 @@ int main()
const char *test_string = "/tmp/test_string/";
try
{
- elog<FILE_NOT_FOUND>(FILE_NOT_FOUND::ERRNUM(number),
- FILE_NOT_FOUND::FILE_PATH(test_string),
- FILE_NOT_FOUND::FILE_NAME("elog_test_3.txt"));
+ elog<org::freedesktop::DBus::Error::FileNotFound>(
+ org::freedesktop::DBus::Error::FileNotFound::
+ ERRNUM(number),
+ org::freedesktop::DBus::Error::FileNotFound::
+ FILE_PATH(test_string),
+ org::freedesktop::DBus::Error::FileNotFound::
+ FILE_NAME("elog_test_3.txt"));
}
- catch (elogException<FILE_NOT_FOUND>& e)
+ catch (elogException<org::freedesktop::DBus::Error::FileNotFound>& e)
{
std::cout << "elog exception caught: " << e.what() << std::endl;
}
+ // Reduce our error namespaces
+ using namespace org::freedesktop::DBus::Error;
+
// Now read back and verify our data made it into the journal
std::stringstream stream;
stream << std::hex << number;
- rc = validate_journal(FILE_NOT_FOUND::ERRNUM::str_short,
+ rc = validate_journal(FileNotFound::ERRNUM::str_short,
std::string(stream.str()).c_str());
if(rc)
return(rc);
- rc = validate_journal(FILE_NOT_FOUND::FILE_PATH::str_short,
+ rc = validate_journal(FileNotFound::FILE_PATH::str_short,
test_string);
if(rc)
return(rc);
- rc = validate_journal(FILE_NOT_FOUND::FILE_NAME::str_short,
+ rc = validate_journal(FileNotFound::FILE_NAME::str_short,
"elog_test_3.txt");
if(rc)
return(rc);
@@ -106,9 +113,9 @@ int main()
number = 0x9876;
try
{
- elog<FILE_NOT_FOUND>(FILE_NOT_FOUND::ERRNUM(number),
- prev_entry<FILE_NOT_FOUND::FILE_PATH>(),
- FILE_NOT_FOUND::FILE_NAME("elog_test_4.txt"));
+ elog<FileNotFound>(FileNotFound::ERRNUM(number),
+ prev_entry<FileNotFound::FILE_PATH>(),
+ FileNotFound::FILE_NAME("elog_test_4.txt"));
}
catch (elogExceptionBase& e)
{
@@ -118,18 +125,18 @@ int main()
// Now read back and verify our data made it into the journal
stream.str("");
stream << std::hex << number;
- rc = validate_journal(FILE_NOT_FOUND::ERRNUM::str_short,
+ rc = validate_journal(FileNotFound::ERRNUM::str_short,
std::string(stream.str()).c_str());
if(rc)
return(rc);
// This should just be equal to what we put in test 3
- rc = validate_journal(FILE_NOT_FOUND::FILE_PATH::str_short,
+ rc = validate_journal(FileNotFound::FILE_PATH::str_short,
test_string);
if(rc)
return(rc);
- rc = validate_journal(FILE_NOT_FOUND::FILE_NAME::str_short,
+ rc = validate_journal(FileNotFound::FILE_NAME::str_short,
"elog_test_4.txt");
if(rc)
return(rc);
@@ -137,13 +144,13 @@ int main()
// Compile fail tests
// Simple test to prove we fail to compile due to missing param
- //elog<FILE_NOT_FOUND>(FILE_NOT_FOUND::ERRNUM(1),
- // FILE_NOT_FOUND::FILE_PATH("test"));
+ //elog<FileNotFound>(FileNotFound::ERRNUM(1),
+ // FileNotFound::FILE_PATH("test"));
// Simple test to prove we fail to compile due to invalid param
- //elog<FILE_NOT_FOUND>(FILE_NOT_FOUND::ERRNUM(1),
- // FILE_NOT_FOUND::FILE_PATH("test"),
- // FILE_NOT_FOUND::FILE_NAME(1));
+ //elog<FileNotFound>(FileNotFound::ERRNUM(1),
+ // FileNotFound::FILE_PATH("test"),
+ // FileNotFound::FILE_NAME(1));
return 0;
}
OpenPOWER on IntegriCloud