summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Spinler <spinler@us.ibm.com>2017-03-28 16:37:36 -0500
committerMatt Spinler <spinler@us.ibm.com>2017-03-30 08:54:36 -0500
commitb65423413a236431a5ac53123bf568427610c190 (patch)
tree32f9eeb92f94bc14b87a2b451c682b33fde9d0fa
parentfabe92e8ed1cbb65e4b054f41688935416765917 (diff)
downloadopenpower-proc-control-b65423413a236431a5ac53123bf568427610c190.tar.gz
openpower-proc-control-b65423413a236431a5ac53123bf568427610c190.zip
Fix jenkins compile failure
Jenkins just started complaining about a mismatch between an sprintf format and its type. This code will eventually be replaced by an elog, so is only temporary anyway. Also fixed unit test fails. With the newest location of the FSI slave directory, the path had to be updated in the testcases that model its structure. Change-Id: I46af324c25ea19d9ad31e9e9ce085b93f00cb1a9 Signed-off-by: Matt Spinler <spinler@us.ibm.com>
-rw-r--r--cfam_access.cpp8
-rw-r--r--test/Makefile.am3
-rw-r--r--test/utest.cpp37
3 files changed, 29 insertions, 19 deletions
diff --git a/cfam_access.cpp b/cfam_access.cpp
index 888eefc..25b811c 100644
--- a/cfam_access.cpp
+++ b/cfam_access.cpp
@@ -51,7 +51,7 @@ void writeReg(const std::unique_ptr<Target>& target,
char msg[100];
sprintf(msg, "writeCFAMReg: Failed seek for address 0x%X, "
"processor %d. errno = %d",
- address, target->getPos(), errno);
+ address, static_cast<int>(target->getPos()), errno);
throw std::runtime_error(msg);
}
@@ -62,7 +62,7 @@ void writeReg(const std::unique_ptr<Target>& target,
char msg[100];
sprintf(msg, "writeCFAMReg: Failed write to address 0x%X, "
"processor %d. errno = %d",
- address, target->getPos(), errno);
+ address, static_cast<int>(target->getPos()), errno);
throw std::runtime_error(msg);
}
}
@@ -80,7 +80,7 @@ cfam_data_t readReg(const std::unique_ptr<Target>& target,
char msg[100];
sprintf(msg, "readCFAMReg: Failed seek for address 0x%X, "
"processor %d. errno = %d",
- address, target->getPos(), errno);
+ address, static_cast<int>(target->getPos()), errno);
throw std::runtime_error(msg);
}
@@ -91,7 +91,7 @@ cfam_data_t readReg(const std::unique_ptr<Target>& target,
char msg[100];
sprintf(msg, "readCFAMReg: Failed read for address 0x%X, "
"processor %d. errno = %d",
- address, target->getPos(), errno);
+ address, static_cast<int>(target->getPos()), errno);
throw std::runtime_error(msg);
}
diff --git a/test/Makefile.am b/test/Makefile.am
index e0d20a2..ad8a173 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -13,5 +13,4 @@ utest_LDFLAGS = -lgtest_main -lgtest $(PTHREAD_LIBS) $(OESDK_TESTCASE_FLAGS) \
$(PHOSPHOR_LOGGING_LIBS) -lstdc++fs
utest_SOURCES = utest.cpp
-utest_LDADD = $(top_srcdir)/targeting.cpp $(top_srcdir)/registration.cpp \
- $(top_srcdir)/filedescriptor.cpp
+utest_LDADD = $(top_srcdir)/targeting.cpp $(top_srcdir)/filedescriptor.cpp
diff --git a/test/utest.cpp b/test/utest.cpp
index 4572c55..6303335 100644
--- a/test/utest.cpp
+++ b/test/utest.cpp
@@ -24,6 +24,8 @@ using namespace openpower::util;
using namespace openpower::targeting;
namespace fs = std::experimental::filesystem;
+ProcedureMap Registration::procedures;
+
constexpr auto masterDir = "/tmp";
class TargetingTest : public ::testing::Test
@@ -39,15 +41,20 @@ class TargetingTest : public ::testing::Test
auto path = mkdtemp(dir);
assert(path != nullptr);
- _directory = path;
+ _slaveBaseDir = path;
+
+ _slaveDir = _slaveBaseDir / "hub@00";
+ fs::create_directory(_slaveDir);
}
virtual void TearDown()
{
- fs::remove_all(_directory);
+ fs::remove_all(_slaveDir);
+ fs::remove_all(_slaveBaseDir);
}
- std::string _directory;
+ fs::path _slaveBaseDir;
+ fs::path _slaveDir;
};
@@ -56,7 +63,7 @@ TEST_F(TargetingTest, CreateTargets)
//Test that we always create the first Target
{
- Targeting targets{masterDir, _directory};
+ Targeting targets{masterDir, _slaveDir};
ASSERT_EQ(targets.size(), 1);
auto t = targets.begin();
@@ -69,12 +76,12 @@ TEST_F(TargetingTest, CreateTargets)
//Test that we can create multiple Targets
{
//make some fake slave entries
- std::ofstream(_directory + "/slave@01:00");
- std::ofstream(_directory + "/slave@02:00");
- std::ofstream(_directory + "/slave@03:00");
- std::ofstream(_directory + "/slave@04:00");
+ std::ofstream(_slaveDir / "slave@01:00");
+ std::ofstream(_slaveDir / "slave@02:00");
+ std::ofstream(_slaveDir / "slave@03:00");
+ std::ofstream(_slaveDir / "slave@04:00");
- Targeting targets{masterDir, _directory};
+ Targeting targets{masterDir, _slaveDir};
ASSERT_EQ(targets.size(), 5);
@@ -82,20 +89,24 @@ TEST_F(TargetingTest, CreateTargets)
for (const auto& t : targets)
{
- std::ostringstream path;
+ fs::path path;
ASSERT_EQ(t->getPos(), i);
if (0 == i)
{
- path << masterDir;
+ path = masterDir;
}
else
{
- path << _directory << "/slave@0" << i << ":00/raw";
+ std::ostringstream subdir;
+ subdir << "slave@0" << i << ":00/raw";
+
+ path = _slaveDir;
+ path /= subdir.str();
}
- ASSERT_EQ(t->getCFAMPath(), path.str());
+ ASSERT_EQ(t->getCFAMPath(), path);
i++;
}
}
OpenPOWER on IntegriCloud