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>
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 @@
         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 @@
         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 @@
         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 @@
         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 @@
 	$(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::targeting;
 namespace fs = std::experimental::filesystem;
 
+ProcedureMap Registration::procedures;
+
 constexpr auto masterDir = "/tmp";
 
 class TargetingTest : public ::testing::Test
@@ -39,15 +41,20 @@
             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 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 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 @@
 
         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++;
         }
     }