diff options
author | Gunnar Mills <gmills@us.ibm.com> | 2017-04-20 12:44:37 -0500 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2017-05-05 22:53:13 +0000 |
commit | f7419b5594db3a11f76ffa23b93721b80a3e75d6 (patch) | |
tree | 30fd768349b874bc536cd0cfe4ce6e1f8e94152c | |
parent | 9c8660656e22d2f8632160c846ea162bea923b3c (diff) | |
download | openpower-pnor-code-mgmt-f7419b5594db3a11f76ffa23b93721b80a3e75d6.tar.gz openpower-pnor-code-mgmt-f7419b5594db3a11f76ffa23b93721b80a3e75d6.zip |
Removed version gtests from openpower-pnor-code-mgmt
These gtests were moved to phosphor-bmc-code-mgmt in
https://gerrit.openbmc-project.xyz/#/c/3802/
I left the base test code since tests are needed
for other functions in this repo.
Change-Id: Id3f4666550ce04ddec5e34dcfe103cfe0ea42304
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
-rwxr-xr-x | Makefile.am | 3 | ||||
-rwxr-xr-x | test/Makefile.am | 3 | ||||
-rw-r--r-- | test/utest.cpp | 63 |
3 files changed, 2 insertions, 67 deletions
diff --git a/Makefile.am b/Makefile.am index 50681c30f..f8ef52ae9 100755 --- a/Makefile.am +++ b/Makefile.am @@ -24,8 +24,7 @@ generic_ldflags = \ $(SYSTEMD_LIBS) \ $(PHOSPHOR_DBUS_INTERFACES_LIBS) \ $(SDBUSPLUS_LIBS) \ - $(PHOSPHOR_LOGGING_LIBS) \ - -lstdc++fs + $(PHOSPHOR_LOGGING_LIBS) openpower_version_host_software_manager_CXXFLAGS = $(generic_cxxflags) openpower_version_host_software_manager_LDFLAGS = $(generic_ldflags) diff --git a/test/Makefile.am b/test/Makefile.am index cac8e378c..e2caf4ba6 100755 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -10,7 +10,6 @@ TESTS = $(check_PROGRAMS) utest_CPPFLAGS = -Igtest $(GTEST_CPPFLAGS) $(AM_CPPFLAGS) utest_CXXFLAGS = $(PTHREAD_CFLAGS) $(PHOSPHOR_LOGGING_CFLAGS) utest_LDFLAGS = -lgtest_main -lgtest $(PTHREAD_LIBS) $(OESDK_TESTCASE_FLAGS) \ - $(PHOSPHOR_LOGGING_LIBS) -lstdc++fs + $(PHOSPHOR_LOGGING_LIBS) utest_SOURCES = utest.cpp -utest_LDADD = $(top_builddir)/version_host_software_manager.o diff --git a/test/utest.cpp b/test/utest.cpp index 4fd1e78ed..21805333f 100644 --- a/test/utest.cpp +++ b/test/utest.cpp @@ -1,64 +1 @@ -#include "version_host_software_manager.hpp" #include <gtest/gtest.h> -#include <experimental/filesystem> -#include <stdlib.h> -#include <fstream> -#include <iostream> -#include <sstream> -#include <string> - -using namespace openpower::software::manager; -namespace fs = std::experimental::filesystem; - - -class VersionTest : public testing::Test -{ - protected: - - virtual void SetUp() - { - char versionDir[] = "./versionXXXXXX"; - _directory = mkdtemp(versionDir); - - if (_directory.empty()) - { - throw std::bad_alloc(); - } - } - - virtual void TearDown() - { - fs::remove_all(_directory); - } - - std::string _directory; -}; - -/** @brief Make sure we correctly get the version from getVersion()*/ -TEST_F(VersionTest, TestGetVersion) -{ - auto manifestFilePath = _directory + "/" + "MANIFEST"; - auto version = "test-version"; - - std::ofstream file; - file.open(manifestFilePath, std::ofstream::out); - ASSERT_TRUE(file.is_open()); - - file << "version=" << version << std::endl; - file.close(); - - EXPECT_EQ(Version::getVersion(manifestFilePath), version); -} - -/** @brief Make sure we correctly get the Id from getId()*/ -TEST_F(VersionTest, TestGetId) -{ - std::stringstream hexId; - auto version = "test-id"; - - hexId << std::hex << ((std::hash<std::string> {}( - version)) & 0xFFFFFFFF); - - EXPECT_EQ(Version::getId(version), hexId.str()); - -} |