regulators: Remove TmpFile class
The TmpFile class was created in the test directory for managing
temporary files used by testcases.
A new TemporaryFile class has replaced it. TemporaryFile has more
features and can be used by production (non-test) code as well.
This commit removes the TmpFile class and modifies testcases to use
TemporaryFile instead.
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
Change-Id: Id06d333416e43d5685c377ee0780b475d20cba8f
diff --git a/phosphor-regulators/test/config_file_parser_tests.cpp b/phosphor-regulators/test/config_file_parser_tests.cpp
index 80e65ba..edfa958 100644
--- a/phosphor-regulators/test/config_file_parser_tests.cpp
+++ b/phosphor-regulators/test/config_file_parser_tests.cpp
@@ -40,7 +40,7 @@
#include "run_rule_action.hpp"
#include "sensor_monitoring.hpp"
#include "set_device_action.hpp"
-#include "tmp_file.hpp"
+#include "temporary_file.hpp"
#include <sys/stat.h> // for chmod()
@@ -107,8 +107,8 @@
}
)"_json;
- TmpFile configFile;
- std::filesystem::path pathName{configFile.getName()};
+ TemporaryFile configFile;
+ std::filesystem::path pathName{configFile.getPath()};
writeConfigFile(pathName, configFileContents);
std::vector<std::unique_ptr<Rule>> rules{};
@@ -146,8 +146,8 @@
}
)"_json;
- TmpFile configFile;
- std::filesystem::path pathName{configFile.getName()};
+ TemporaryFile configFile;
+ std::filesystem::path pathName{configFile.getPath()};
writeConfigFile(pathName, configFileContents);
chmod(pathName.c_str(), 0222);
@@ -165,8 +165,8 @@
{
const std::string configFileContents = "] foo [";
- TmpFile configFile;
- std::filesystem::path pathName{configFile.getName()};
+ TemporaryFile configFile;
+ std::filesystem::path pathName{configFile.getPath()};
writeConfigFile(pathName, configFileContents);
parse(pathName);
@@ -182,8 +182,8 @@
{
const json configFileContents = R"( { "foo": "bar" } )"_json;
- TmpFile configFile;
- std::filesystem::path pathName{configFile.getName()};
+ TemporaryFile configFile;
+ std::filesystem::path pathName{configFile.getPath()};
writeConfigFile(pathName, configFileContents);
parse(pathName);