Check in a clang-tidy

This should've been done when we first created the repo, but better late
than never.

Signed-off-by: Ed Tanous <edtanous@google.com>
Signed-off-by: John Edward Broadbent <jebr@google.com>
Change-Id: I68da1d13167ec94f9d008dea307c9f23a991d42c
diff --git a/src/erase/cryptoErase.cpp b/src/erase/cryptoErase.cpp
index d99f6bf..edc71d9 100644
--- a/src/erase/cryptoErase.cpp
+++ b/src/erase/cryptoErase.cpp
@@ -34,8 +34,7 @@
         throw ResourceNotFound();
     }
     /* cryptLoad */
-    if (cryptIface.get()->cryptLoad(cryptHandle.get(), CRYPT_LUKS2, nullptr) !=
-        0)
+    if (cryptIface->cryptLoad(cryptHandle.get(), CRYPT_LUKS2, nullptr) != 0)
     {
         lg2::error("Failed to load the key slots for destruction",
                    "REDFISH_MESSAGE_ID",
@@ -44,7 +43,7 @@
     }
 
     /* find key slots */
-    int nKeySlots = cryptIface.get()->cryptKeySlotMax(CRYPT_LUKS2);
+    int nKeySlots = cryptIface->cryptKeySlotMax(CRYPT_LUKS2);
     if (nKeySlots < 0)
     {
         lg2::error("Failed to find the max keyslots", "REDFISH_MESSAGE_ID",
@@ -64,12 +63,11 @@
     for (int i = 0; i < nKeySlots; i++)
     {
         crypt_keyslot_info ki =
-            cryptIface.get()->cryptKeySlotStatus(cryptHandle.get(), i);
+            cryptIface->cryptKeySlotStatus(cryptHandle.get(), i);
 
         if (ki == CRYPT_SLOT_ACTIVE || ki == CRYPT_SLOT_ACTIVE_LAST)
         {
-            if (cryptIface.get()->cryptKeyslotDestroy(cryptHandle.get(), i) !=
-                0)
+            if (cryptIface->cryptKeyslotDestroy(cryptHandle.get(), i) != 0)
             {
                 lg2::error(
                     "Estoraged erase failed to destroy keyslot, continuing",
diff --git a/src/erase/erase.cpp b/src/erase/erase.cpp
index 6cd45f2..40a954e 100644
--- a/src/erase/erase.cpp
+++ b/src/erase/erase.cpp
@@ -17,7 +17,7 @@
 uint64_t Erase::findSizeOfBlockDevice()
 {
     ManagedFd fd;
-    uint64_t bytes;
+    uint64_t bytes = 0;
     try
     {
         // open block dev
diff --git a/src/erase/pattern.cpp b/src/erase/pattern.cpp
index 0e510a0..5563661 100644
--- a/src/erase/pattern.cpp
+++ b/src/erase/pattern.cpp
@@ -30,8 +30,11 @@
     // static seed defines a fixed prng sequnce so it can be verified later,
     // and validated for entropy
     uint64_t currentIndex = 0;
+
+    // random number generator seeded with a constant value will
+    // generate a predictable sequence of values NOLINTNEXTLINE
     std::minstd_rand0 generator(seed);
-    std::array<std::byte, blockSize> randArr;
+    std::array<std::byte, blockSize> randArr{};
 
     ManagedFd fd =
         stdplus::fd::open(devPath, stdplus::fd::OpenAccess::WriteOnly);
@@ -65,9 +68,11 @@
 {
 
     uint64_t currentIndex = 0;
+    // random number generator seeded with a constant value will
+    // generate a predictable sequence of values NOLINTNEXTLINE
     std::minstd_rand0 generator(seed);
-    std::array<std::byte, blockSize> randArr;
-    std::array<std::byte, blockSize> readArr;
+    std::array<std::byte, blockSize> randArr{};
+    std::array<std::byte, blockSize> readArr{};
 
     ManagedFd fd =
         stdplus::fd::open(devPath, stdplus::fd::OpenAccess::ReadOnly);
diff --git a/src/erase/verifyDriveGeometry.cpp b/src/erase/verifyDriveGeometry.cpp
index 2d223a7..446bee9 100644
--- a/src/erase/verifyDriveGeometry.cpp
+++ b/src/erase/verifyDriveGeometry.cpp
@@ -22,7 +22,7 @@
                        std::to_string(ERASE_MAX_GEOMETRY));
         throw InternalFailure();
     }
-    else if (bytes < ERASE_MIN_GEOMETRY)
+    if (bytes < ERASE_MIN_GEOMETRY)
     {
         lg2::error(
             "eStorageD erase verify Geometry too small", "REDFISH_MESSAGE_ID",
@@ -31,12 +31,9 @@
             std::to_string(bytes) + "<" + std::to_string(ERASE_MIN_GEOMETRY));
         throw InternalFailure();
     }
-    else
-    {
-        lg2::info("eStorageD erase verify Geometry in range",
-                  "REDFISH_MESSAGE_ID",
-                  std::string("OpenBMC.0.1.DriveEraseSuccess"));
-    }
+
+    lg2::info("eStorageD erase verify Geometry in range", "REDFISH_MESSAGE_ID",
+              std::string("OpenBMC.0.1.DriveEraseSuccess"));
 }
 
 } // namespace estoraged
diff --git a/src/erase/zero.cpp b/src/erase/zero.cpp
index 2c0d615..2c5a6f5 100644
--- a/src/erase/zero.cpp
+++ b/src/erase/zero.cpp
@@ -51,7 +51,7 @@
         stdplus::fd::open(devPath, stdplus::fd::OpenAccess::ReadOnly);
 
     uint64_t currentIndex = 0;
-    std::array<std::byte, blockSize> readArr;
+    std::array<std::byte, blockSize> readArr{};
     const std::array<const std::byte, blockSize> blockOfZeros{};
 
     while (currentIndex < driveSize)
@@ -70,7 +70,7 @@
                        std::string("eStorageD.1.0.EraseFailure"));
             throw InternalFailure();
         }
-        if (memcmp(readArr.data(), blockOfZeros.data(), readSize))
+        if (memcmp(readArr.data(), blockOfZeros.data(), readSize) != 0)
         {
             lg2::error("Estoraged erase zeros block is not zero",
                        "REDFISH_MESSAGE_ID",
diff --git a/src/estoraged.cpp b/src/estoraged.cpp
index 4f7fc40..b52a5f4 100644
--- a/src/estoraged.cpp
+++ b/src/estoraged.cpp
@@ -9,11 +9,11 @@
 
 #include <libcryptsetup.h>
 #include <openssl/rand.h>
-#include <stdlib.h>
 
 #include <phosphor-logging/lg2.hpp>
 #include <xyz/openbmc_project/Common/error.hpp>
 
+#include <cstdlib>
 #include <filesystem>
 #include <iostream>
 #include <string_view>
@@ -26,7 +26,7 @@
 using sdbusplus::xyz::openbmc_project::Common::Error::ResourceNotFound;
 using sdbusplus::xyz::openbmc_project::Common::Error::UnsupportedRequest;
 
-void eStoraged::formatLuks(std::vector<uint8_t> password, FilesystemType type)
+void EStoraged::formatLuks(std::vector<uint8_t> password, FilesystemType type)
 {
     std::string msg = "OpenBMC.0.1.DriveFormat";
     lg2::info("Starting format", "REDFISH_MESSAGE_ID", msg);
@@ -53,7 +53,7 @@
     mountFilesystem();
 }
 
-void eStoraged::erase(EraseMethod inEraseMethod)
+void EStoraged::erase(EraseMethod inEraseMethod)
 {
     std::cerr << "Erasing encrypted eMMC" << std::endl;
     lg2::info("Starting erase", "REDFISH_MESSAGE_ID",
@@ -115,7 +115,7 @@
     }
 }
 
-void eStoraged::lock()
+void EStoraged::lock()
 {
     std::string msg = "OpenBMC.0.1.DriveLock";
     lg2::info("Starting lock", "REDFISH_MESSAGE_ID", msg);
@@ -124,7 +124,7 @@
     deactivateLuksDev();
 }
 
-void eStoraged::unlock(std::vector<uint8_t> password)
+void EStoraged::unlock(std::vector<uint8_t> password)
 {
     std::string msg = "OpenBMC.0.1.DriveUnlock";
     lg2::info("Starting unlock", "REDFISH_MESSAGE_ID", msg);
@@ -141,24 +141,25 @@
     mountFilesystem();
 }
 
-void eStoraged::changePassword(std::vector<uint8_t>, std::vector<uint8_t>)
+void EStoraged::changePassword(std::vector<uint8_t> /*oldPassword*/,
+                               std::vector<uint8_t> /*newPassword*/)
 {
     std::cerr << "Changing password for encrypted eMMC" << std::endl;
     lg2::info("Starting change password", "REDFISH_MESSAGE_ID",
               std::string("OpenBMC.0.1.DrivePasswordChanged"));
 }
 
-bool eStoraged::isLocked() const
+bool EStoraged::isLocked() const
 {
     return locked();
 }
 
-std::string_view eStoraged::getMountPoint() const
+std::string_view EStoraged::getMountPoint() const
 {
     return mountPoint;
 }
 
-void eStoraged::formatLuksDev(struct crypt_device* cd,
+void EStoraged::formatLuksDev(struct crypt_device* cd,
                               std::vector<uint8_t> password)
 {
     lg2::info("Formatting device {DEV}", "DEV", devPath, "REDFISH_MESSAGE_ID",
@@ -206,7 +207,7 @@
               std::string("OpenBMC.0.1.FormatLuksDevSuccess"));
 }
 
-void eStoraged::activateLuksDev(struct crypt_device* cd,
+void EStoraged::activateLuksDev(struct crypt_device* cd,
                                 std::vector<uint8_t> password)
 {
     lg2::info("Activating LUKS dev {DEV}", "DEV", devPath, "REDFISH_MESSAGE_ID",
@@ -241,11 +242,11 @@
               std::string("OpenBMC.0.1.ActivateLuksDevSuccess"));
 }
 
-void eStoraged::createFilesystem()
+void EStoraged::createFilesystem()
 {
     /* Run the command to create the filesystem. */
     int retval = fsIface->runMkfs(containerName);
-    if (retval)
+    if (retval != 0)
     {
         lg2::error("Failed to create filesystem: {RETVAL}", "RETVAL", retval,
                    "REDFISH_MESSAGE_ID",
@@ -257,7 +258,7 @@
               std::string("OpenBMC.0.1.CreateFilesystemSuccess"));
 }
 
-void eStoraged::mountFilesystem()
+void EStoraged::mountFilesystem()
 {
     /*
      * Create directory for the filesystem, if it's not already present. It
@@ -281,7 +282,7 @@
     std::string luksContainer("/dev/mapper/" + containerName);
     int retval = fsIface->doMount(luksContainer.c_str(), mountPoint.c_str(),
                                   "ext4", 0, nullptr);
-    if (retval)
+    if (retval != 0)
     {
         lg2::error("Failed to mount filesystem: {RETVAL}", "RETVAL", retval,
                    "REDFISH_MESSAGE_ID",
@@ -302,10 +303,10 @@
               std::string("OpenBMC.0.1.MountFilesystemSuccess"));
 }
 
-void eStoraged::unmountFilesystem()
+void EStoraged::unmountFilesystem()
 {
     int retval = fsIface->doUnmount(mountPoint.c_str());
-    if (retval)
+    if (retval != 0)
     {
         lg2::error("Failed to unmount filesystem: {RETVAL}", "RETVAL", retval,
                    "REDFISH_MESSAGE_ID",
@@ -328,7 +329,7 @@
               std::string("OpenBMC.0.1.MountFilesystemSuccess"));
 }
 
-void eStoraged::deactivateLuksDev()
+void EStoraged::deactivateLuksDev()
 {
     lg2::info("Deactivating LUKS device {DEV}", "DEV", devPath,
               "REDFISH_MESSAGE_ID",
diff --git a/src/main.cpp b/src/main.cpp
index c23ff19..1f50a25 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -26,7 +26,7 @@
 
     std::string physicalBlockDev = "/dev/mmcblk0";
     std::string containerBlockDev;
-    int opt;
+    int opt = 0;
     while ((opt = getopt(argc, argv, "b:c:")) != -1)
     {
         switch (opt)
@@ -38,46 +38,54 @@
                 containerBlockDev = optarg;
                 break;
             default:
-                usage(argv[0]);
+                usage(*argv);
                 exit(EXIT_FAILURE);
         }
     }
-
-    /* Get the filename of the device (without "/dev/"). */
-    auto deviceName =
-        std::filesystem::path(physicalBlockDev).filename().string();
-
-    /* If containerName arg wasn't provided, create one based on deviceName. */
-    if (containerBlockDev.empty())
+    try
     {
-        containerBlockDev = "luks-" + deviceName;
+        /* Get the filename of the device (without "/dev/"). */
+        std::string deviceName =
+            std::filesystem::path(physicalBlockDev).filename().string();
+        /* If containerName arg wasn't provided, create one based on deviceName.
+         */
+        if (containerBlockDev.empty())
+        {
+            containerBlockDev = "luks-" + deviceName;
+        }
+
+        /* DBus path location to place the object. */
+        std::string path = "/xyz/openbmc_project/storage/" + deviceName;
+
+        /*
+         * Create a new bus and affix an object manager for the subtree path we
+         * intend to place objects at.
+         */
+        auto b = sdbusplus::bus::new_default();
+        sdbusplus::server::manager_t m{b, path.c_str()};
+
+        /* Reserve the dbus service name. */
+        std::string busName = "xyz.openbmc_project.eStoraged." + deviceName;
+        b.request_name(busName.c_str());
+
+        /* Create an eStoraged object. */
+        estoraged::EStoraged esObject{b, path.c_str(), physicalBlockDev,
+                                      containerBlockDev};
+        lg2::info("Storage management service is running", "REDFISH_MESSAGE_ID",
+                  std::string("OpenBMC.1.0.ServiceStarted"));
+
+        while (true)
+        {
+            b.wait();
+            b.process_discard();
+        }
     }
-
-    /* DBus path location to place the object. */
-    std::string path = "/xyz/openbmc_project/storage/" + deviceName;
-
-    /*
-     * Create a new bus and affix an object manager for the subtree path we
-     * intend to place objects at.
-     */
-    auto b = sdbusplus::bus::new_default();
-    sdbusplus::server::manager_t m{b, path.c_str()};
-
-    /* Reserve the dbus service name. */
-    std::string busName = "xyz.openbmc_project.eStoraged." + deviceName;
-    b.request_name(busName.c_str());
-
-    /* Create an eStoraged object. */
-    estoraged::eStoraged esObject{b, path.c_str(), physicalBlockDev,
-                                  containerBlockDev};
-    lg2::info("Storage management service is running", "REDFISH_MESSAGE_ID",
-              std::string("OpenBMC.1.0.ServiceStarted"));
-
-    while (true)
+    catch (const std::exception& e)
     {
-        b.wait();
-        b.process_discard();
-    }
+        lg2::error(e.what(), "REDFISH_MESSAGE_ID",
+                   std::string("OpenBMC.1.0.ServiceException"));
 
+        return 2;
+    }
     return 1;
 }
diff --git a/src/test/erase/crypto_test.cpp b/src/test/erase/crypto_test.cpp
index 917b23b..9eefa9d 100644
--- a/src/test/erase/crypto_test.cpp
+++ b/src/test/erase/crypto_test.cpp
@@ -20,25 +20,23 @@
 {
 
 using estoraged::CryptErase;
-using estoraged::Cryptsetup;
-using estoraged::CryptsetupInterface;
 using sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
 using sdbusplus::xyz::openbmc_project::Common::Error::ResourceNotFound;
-using sdbusplus::xyz::openbmc_project::Inventory::Item::server::Volume;
 using ::testing::_;
 using ::testing::Return;
 using ::testing::StrEq;
 
-class cryptoEraseTest : public testing::Test
+const std::string testFileName = "testFile";
+
+class CryptoEraseTest : public testing::Test
 {
   public:
-    static constexpr char testFileName[] = "testfile";
     std::ofstream testFile;
 
     void SetUp() override
     {
         /* Create an empty file that we'll pretend is a 'storage device'. */
-        testFile.open(testFileName,
+        testFile.open(testFileName.c_str(),
                       std::ios::out | std::ios::binary | std::ios::trunc);
         testFile.close();
         if (testFile.fail())
@@ -49,7 +47,7 @@
     }
 };
 
-TEST_F(cryptoEraseTest, EraseCryptPass)
+TEST_F(CryptoEraseTest, EraseCryptPass)
 {
     std::unique_ptr<MockCryptsetupInterface> mockCryptIface =
         std::make_unique<MockCryptsetupInterface>();
@@ -66,11 +64,11 @@
     EXPECT_CALL(*mockCryptIface, cryptKeyslotDestroy(_, 0)).Times(1);
 
     CryptErase myCryptErase =
-        CryptErase(testFileName, std::move(mockCryptIface));
+        CryptErase(testFileName.c_str(), std::move(mockCryptIface));
     EXPECT_NO_THROW(myCryptErase.doErase());
 }
 
-TEST_F(cryptoEraseTest, EraseCrypMaxSlotFails)
+TEST_F(CryptoEraseTest, EraseCrypMaxSlotFails)
 {
     std::unique_ptr<MockCryptsetupInterface> mockCryptIface =
         std::make_unique<MockCryptsetupInterface>();
@@ -82,11 +80,11 @@
         .WillOnce(Return(-1));
 
     CryptErase myCryptErase =
-        CryptErase(testFileName, std::move(mockCryptIface));
+        CryptErase(testFileName.c_str(), std::move(mockCryptIface));
     EXPECT_THROW(myCryptErase.doErase(), ResourceNotFound);
 }
 
-TEST_F(cryptoEraseTest, EraseCrypMaxSlotZero)
+TEST_F(CryptoEraseTest, EraseCrypMaxSlotZero)
 {
     std::unique_ptr<MockCryptsetupInterface> mockCryptIface =
         std::make_unique<MockCryptsetupInterface>();
@@ -98,11 +96,11 @@
         .WillOnce(Return(0));
 
     CryptErase myCryptErase =
-        CryptErase(testFileName, std::move(mockCryptIface));
+        CryptErase(testFileName.c_str(), std::move(mockCryptIface));
     EXPECT_THROW(myCryptErase.doErase(), ResourceNotFound);
 }
 
-TEST_F(cryptoEraseTest, EraseCrypOnlyInvalid)
+TEST_F(CryptoEraseTest, EraseCrypOnlyInvalid)
 {
     std::unique_ptr<MockCryptsetupInterface> mockCryptIface =
         std::make_unique<MockCryptsetupInterface>();
@@ -117,11 +115,11 @@
         .WillRepeatedly(Return(CRYPT_SLOT_INVALID));
 
     CryptErase myCryptErase =
-        CryptErase(testFileName, std::move(mockCryptIface));
+        CryptErase(testFileName.c_str(), std::move(mockCryptIface));
     EXPECT_NO_THROW(myCryptErase.doErase());
 }
 
-TEST_F(cryptoEraseTest, EraseCrypDestoryFails)
+TEST_F(CryptoEraseTest, EraseCrypDestoryFails)
 {
     std::unique_ptr<MockCryptsetupInterface> mockCryptIface =
         std::make_unique<MockCryptsetupInterface>();
@@ -139,7 +137,7 @@
         .WillOnce(Return(-1));
 
     CryptErase myCryptErase =
-        CryptErase(testFileName, std::move(mockCryptIface));
+        CryptErase(testFileName.c_str(), std::move(mockCryptIface));
     EXPECT_THROW(myCryptErase.doErase(), InternalFailure);
 }
 
diff --git a/src/test/erase/pattern_test.cpp b/src/test/erase/pattern_test.cpp
index 98eb374..e0192a0 100644
--- a/src/test/erase/pattern_test.cpp
+++ b/src/test/erase/pattern_test.cpp
@@ -63,7 +63,8 @@
 
     int dummyValue = 88;
     testFile.open(testFileName, std::ios::binary | std::ios::out);
-    testFile.write((const char*)&dummyValue, sizeof(dummyValue));
+    testFile.write((reinterpret_cast<const char*>(&dummyValue)),
+                   sizeof(dummyValue));
     testFile.close();
 
     EXPECT_NO_THROW(pass.writePattern(size - sizeof(dummyValue)));
diff --git a/src/test/erase/zero_test.cpp b/src/test/erase/zero_test.cpp
index 70a62e2..846059d 100644
--- a/src/test/erase/zero_test.cpp
+++ b/src/test/erase/zero_test.cpp
@@ -17,7 +17,6 @@
 
 using estoraged::Zero;
 using sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
-using stdplus::fd::ManagedFd;
 
 namespace estoraged_test
 {
@@ -61,9 +60,10 @@
     std::ofstream testFile;
 
     // open the file and write none zero to it
-    int dummyValue = 0x88776655;
+    uint32_t dummyValue = 0x88776655;
     testFile.open(testFileName, std::ios::binary | std::ios::out);
-    testFile.write((const char*)&dummyValue, sizeof(dummyValue));
+    testFile.write((reinterpret_cast<const char*>(&dummyValue)),
+                   sizeof(dummyValue));
     testFile.close();
     uint64_t size = 4096;
     Zero pass(testFileName);
@@ -88,7 +88,7 @@
 
     uint64_t size = 4096;
     Zero pass(testFileName);
-    int dummyValue = 88;
+    uint32_t dummyValue = 88;
     EXPECT_NO_THROW(pass.writeZero(size - sizeof(dummyValue)));
 
     // open the file and write none zero to it
diff --git a/src/test/estoraged_test.cpp b/src/test/estoraged_test.cpp
index 10357fe..7a3286c 100644
--- a/src/test/estoraged_test.cpp
+++ b/src/test/estoraged_test.cpp
@@ -38,23 +38,23 @@
  */
 sdbusplus::SdBusMock sdbusMock;
 
-class eStoragedTest : public testing::Test
+class EStoragedTest : public testing::Test
 {
   public:
-    static constexpr char testFileName[] = "testfile";
-    static constexpr char testLuksDevName[] = "testfile_luksDev";
+    const char* testFileName = "testfile";
+    const char* testLuksDevName = "testfile_luksDev";
     std::ofstream testFile;
-    std::unique_ptr<estoraged::eStoraged> esObject;
-    static constexpr auto TEST_PATH = "/test/openbmc_project/storage/test_dev";
-    static constexpr auto ESTORAGED_INTERFACE =
+    std::unique_ptr<estoraged::EStoraged> esObject;
+    const char* testPath = "/test/openbmc_project/storage/test_dev";
+    const char* estoragedInterface =
         "xyz.openbmc_project.Inventory.Item.Volume";
     sdbusplus::bus::bus bus;
     std::string passwordString;
     std::vector<uint8_t> password;
-    MockCryptsetupInterface* mockCryptIface;
-    MockFilesystemInterface* mockFsIface;
+    MockCryptsetupInterface* mockCryptIface{};
+    MockFilesystemInterface* mockFsIface{};
 
-    eStoragedTest() :
+    EStoragedTest() :
         bus(sdbusplus::get_mocked_new(&sdbusMock)), passwordString("password"),
         password(passwordString.begin(), passwordString.end())
     {}
@@ -71,16 +71,16 @@
         }
 
         EXPECT_CALL(sdbusMock,
-                    sd_bus_add_object_vtable(IsNull(), _, StrEq(TEST_PATH),
-                                             StrEq(ESTORAGED_INTERFACE), _, _))
+                    sd_bus_add_object_vtable(IsNull(), _, StrEq(testPath),
+                                             StrEq(estoragedInterface), _, _))
             .WillRepeatedly(Return(0));
 
         EXPECT_CALL(sdbusMock,
-                    sd_bus_emit_object_added(IsNull(), StrEq(TEST_PATH)))
+                    sd_bus_emit_object_added(IsNull(), StrEq(testPath)))
             .WillRepeatedly(Return(0));
 
         EXPECT_CALL(sdbusMock,
-                    sd_bus_emit_object_removed(IsNull(), StrEq(TEST_PATH)))
+                    sd_bus_emit_object_removed(IsNull(), StrEq(testPath)))
             .WillRepeatedly(Return(0));
 
         std::unique_ptr<MockCryptsetupInterface> cryptIface =
@@ -90,9 +90,8 @@
             std::make_unique<MockFilesystemInterface>();
         mockFsIface = fsIface.get();
 
-        esObject = std::make_unique<estoraged::eStoraged>(
-            bus, TEST_PATH, std::string(testFileName),
-            std::string(testLuksDevName), std::move(cryptIface),
+        esObject = std::make_unique<estoraged::EStoraged>(
+            bus, testPath, testFileName, testLuksDevName, std::move(cryptIface),
             std::move(fsIface));
     }
 
@@ -103,11 +102,11 @@
 };
 
 /* Test case to format and then lock the LUKS device. */
-TEST_F(eStoragedTest, FormatPass)
+TEST_F(EStoragedTest, FormatPass)
 {
     EXPECT_CALL(sdbusMock,
                 sd_bus_emit_properties_changed_strv(
-                    IsNull(), StrEq(TEST_PATH), StrEq(ESTORAGED_INTERFACE), _))
+                    IsNull(), StrEq(testPath), StrEq(estoragedInterface), _))
         .WillRepeatedly(Return(0));
 
     EXPECT_CALL(*mockCryptIface, cryptFormat(_, _, _, _, _, _, _, _)).Times(1);
@@ -153,11 +152,11 @@
  * Test case where the mount point directory already exists, so it shouldn't
  * try to create it.
  */
-TEST_F(eStoragedTest, MountPointExistsPass)
+TEST_F(EStoragedTest, MountPointExistsPass)
 {
     EXPECT_CALL(sdbusMock,
                 sd_bus_emit_properties_changed_strv(
-                    IsNull(), StrEq(TEST_PATH), StrEq(ESTORAGED_INTERFACE), _))
+                    IsNull(), StrEq(testPath), StrEq(estoragedInterface), _))
         .WillRepeatedly(Return(0));
 
     EXPECT_CALL(*mockCryptIface, cryptFormat(_, _, _, _, _, _, _, _)).Times(1);
@@ -200,7 +199,7 @@
 }
 
 /* Test case where the device/file doesn't exist. */
-TEST_F(eStoragedTest, FormatNoDeviceFail)
+TEST_F(EStoragedTest, FormatNoDeviceFail)
 {
     /* Delete the test file. */
     EXPECT_EQ(0, unlink(testFileName));
@@ -216,7 +215,7 @@
 }
 
 /* Test case where we fail to format the LUKS device. */
-TEST_F(eStoragedTest, FormatFail)
+TEST_F(EStoragedTest, FormatFail)
 {
     EXPECT_CALL(*mockCryptIface, cryptFormat(_, _, _, _, _, _, _, _))
         .WillOnce(Return(-1));
@@ -227,11 +226,11 @@
 }
 
 /* Test case where we fail to set the password for the LUKS device. */
-TEST_F(eStoragedTest, AddKeyslotFail)
+TEST_F(EStoragedTest, AddKeyslotFail)
 {
     EXPECT_CALL(sdbusMock,
                 sd_bus_emit_properties_changed_strv(
-                    IsNull(), StrEq(TEST_PATH), StrEq(ESTORAGED_INTERFACE), _))
+                    IsNull(), StrEq(testPath), StrEq(estoragedInterface), _))
         .WillRepeatedly(Return(0));
 
     EXPECT_CALL(*mockCryptIface, cryptFormat(_, _, _, _, _, _, _, _)).Times(1);
@@ -245,11 +244,11 @@
 }
 
 /* Test case where we fail to load the LUKS header. */
-TEST_F(eStoragedTest, LoadLuksHeaderFail)
+TEST_F(EStoragedTest, LoadLuksHeaderFail)
 {
     EXPECT_CALL(sdbusMock,
                 sd_bus_emit_properties_changed_strv(
-                    IsNull(), StrEq(TEST_PATH), StrEq(ESTORAGED_INTERFACE), _))
+                    IsNull(), StrEq(testPath), StrEq(estoragedInterface), _))
         .WillRepeatedly(Return(0));
 
     EXPECT_CALL(*mockCryptIface, cryptFormat(_, _, _, _, _, _, _, _)).Times(1);
@@ -265,11 +264,11 @@
 }
 
 /* Test case where we fail to activate the LUKS device. */
-TEST_F(eStoragedTest, ActivateFail)
+TEST_F(EStoragedTest, ActivateFail)
 {
     EXPECT_CALL(sdbusMock,
                 sd_bus_emit_properties_changed_strv(
-                    IsNull(), StrEq(TEST_PATH), StrEq(ESTORAGED_INTERFACE), _))
+                    IsNull(), StrEq(testPath), StrEq(estoragedInterface), _))
         .WillRepeatedly(Return(0));
 
     EXPECT_CALL(*mockCryptIface, cryptFormat(_, _, _, _, _, _, _, _)).Times(1);
@@ -288,11 +287,11 @@
 }
 
 /* Test case where we fail to create the filesystem. */
-TEST_F(eStoragedTest, CreateFilesystemFail)
+TEST_F(EStoragedTest, CreateFilesystemFail)
 {
     EXPECT_CALL(sdbusMock,
                 sd_bus_emit_properties_changed_strv(
-                    IsNull(), StrEq(TEST_PATH), StrEq(ESTORAGED_INTERFACE), _))
+                    IsNull(), StrEq(testPath), StrEq(estoragedInterface), _))
         .WillRepeatedly(Return(0));
 
     EXPECT_CALL(*mockCryptIface, cryptFormat(_, _, _, _, _, _, _, _)).Times(1);
@@ -313,11 +312,11 @@
 }
 
 /* Test case where we fail to create the mount point. */
-TEST_F(eStoragedTest, CreateMountPointFail)
+TEST_F(EStoragedTest, CreateMountPointFail)
 {
     EXPECT_CALL(sdbusMock,
                 sd_bus_emit_properties_changed_strv(
-                    IsNull(), StrEq(TEST_PATH), StrEq(ESTORAGED_INTERFACE), _))
+                    IsNull(), StrEq(testPath), StrEq(estoragedInterface), _))
         .WillRepeatedly(Return(0));
 
     EXPECT_CALL(*mockCryptIface, cryptFormat(_, _, _, _, _, _, _, _)).Times(1);
@@ -344,11 +343,11 @@
 }
 
 /* Test case where we fail to mount the filesystem. */
-TEST_F(eStoragedTest, MountFail)
+TEST_F(EStoragedTest, MountFail)
 {
     EXPECT_CALL(sdbusMock,
                 sd_bus_emit_properties_changed_strv(
-                    IsNull(), StrEq(TEST_PATH), StrEq(ESTORAGED_INTERFACE), _))
+                    IsNull(), StrEq(testPath), StrEq(estoragedInterface), _))
         .WillRepeatedly(Return(0));
 
     EXPECT_CALL(*mockCryptIface, cryptFormat(_, _, _, _, _, _, _, _)).Times(1);
@@ -383,11 +382,11 @@
 }
 
 /* Test case where we fail to unmount the filesystem. */
-TEST_F(eStoragedTest, UnmountFail)
+TEST_F(EStoragedTest, UnmountFail)
 {
     EXPECT_CALL(sdbusMock,
                 sd_bus_emit_properties_changed_strv(
-                    IsNull(), StrEq(TEST_PATH), StrEq(ESTORAGED_INTERFACE), _))
+                    IsNull(), StrEq(testPath), StrEq(estoragedInterface), _))
         .WillRepeatedly(Return(0));
 
     EXPECT_CALL(*mockCryptIface, cryptFormat(_, _, _, _, _, _, _, _)).Times(1);
@@ -424,11 +423,11 @@
 }
 
 /* Test case where we fail to remove the mount point. */
-TEST_F(eStoragedTest, RemoveMountPointFail)
+TEST_F(EStoragedTest, RemoveMountPointFail)
 {
     EXPECT_CALL(sdbusMock,
                 sd_bus_emit_properties_changed_strv(
-                    IsNull(), StrEq(TEST_PATH), StrEq(ESTORAGED_INTERFACE), _))
+                    IsNull(), StrEq(testPath), StrEq(estoragedInterface), _))
         .WillRepeatedly(Return(0));
 
     EXPECT_CALL(*mockCryptIface, cryptFormat(_, _, _, _, _, _, _, _)).Times(1);
@@ -469,11 +468,11 @@
 }
 
 /* Test case where we fail to deactivate the LUKS device. */
-TEST_F(eStoragedTest, DeactivateFail)
+TEST_F(EStoragedTest, DeactivateFail)
 {
     EXPECT_CALL(sdbusMock,
                 sd_bus_emit_properties_changed_strv(
-                    IsNull(), StrEq(TEST_PATH), StrEq(ESTORAGED_INTERFACE), _))
+                    IsNull(), StrEq(testPath), StrEq(estoragedInterface), _))
         .WillRepeatedly(Return(0));
 
     EXPECT_CALL(*mockCryptIface, cryptFormat(_, _, _, _, _, _, _, _)).Times(1);