summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBret Curtis <psi29a@gmail.com>2023-04-29 21:26:51 +0200
committerBret Curtis <psi29a@gmail.com>2023-04-29 21:26:51 +0200
commit70465c534620c7ca192435aadbc1c17d12312467 (patch)
tree608946fe1a849716a6c77c69d4b68b1ce0e1e431
parent850576873646588337d63e3751f6810a558d6468 (diff)
make sure we can run on all systems; but require that it run in the same directory as the binary we wish to testcxxopts_mwiniimporter
-rw-r--r--apps/mwiniimporter_tests/CMakeLists.txt3
-rw-r--r--apps/mwiniimporter_tests/main.cpp12
2 files changed, 4 insertions, 11 deletions
diff --git a/apps/mwiniimporter_tests/CMakeLists.txt b/apps/mwiniimporter_tests/CMakeLists.txt
index eb6a191cd3..6692c6021d 100644
--- a/apps/mwiniimporter_tests/CMakeLists.txt
+++ b/apps/mwiniimporter_tests/CMakeLists.txt
@@ -9,9 +9,6 @@ openmw_add_executable(openmw-iniimporter-tests ${INIIMPORTER_TESTS_SRC_FILES})
target_include_directories(openmw-iniimporter-tests SYSTEM PRIVATE ${GTEST_INCLUDE_DIRS})
target_include_directories(openmw-iniimporter-tests SYSTEM PRIVATE ${GMOCK_INCLUDE_DIRS})
-#add_definitions(-DCMAKE_BINARY_DIR="${CMAKE_BINARY_DIR}")
-target_compile_definitions(openmw-iniimporter-tests PRIVATE CMAKE_BINARY_DIR=u8"${CMAKE_BINARY_DIR}")
-
target_link_libraries(openmw-iniimporter-tests PRIVATE
GTest::GTest
GMock::GMock
diff --git a/apps/mwiniimporter_tests/main.cpp b/apps/mwiniimporter_tests/main.cpp
index f6cd2d2b37..bd68c27306 100644
--- a/apps/mwiniimporter_tests/main.cpp
+++ b/apps/mwiniimporter_tests/main.cpp
@@ -1,14 +1,9 @@
-#include <components/misc/strings/conversion.hpp>
#include <filesystem>
#include <fstream>
#include <gtest/gtest.h>
#include <sstream>
#include <vector>
-#ifndef CMAKE_BINARY_DIR
-#define CMAKE_BINARY_DIR "." /* default to current directory */
-#endif
-
struct TestParam
{
std::string name;
@@ -35,11 +30,12 @@ Archive 1=game2.bsa
tempFile << iniData;
tempFile.close();
std::filesystem::path tempCfgFile = std::filesystem::temp_directory_path() / (param.fileName + ".cfg");
+ std::filesystem::path binaryPath = std::filesystem::current_path() / "openmw-iniimporter";
- std::basic_stringstream<char8_t> cmd;
- cmd << CMAKE_BINARY_DIR << u8"/openmw-iniimporter -i " << tempIniFile << u8" -c " << tempCfgFile;
+ std::stringstream cmd;
+ cmd << binaryPath << " -i " << tempIniFile << " -c " << tempCfgFile;
- int ret = std::system(Misc::StringUtils::u8StringToString(std::u8string(cmd.str())).c_str());
+ int ret = std::system(cmd.str().c_str());
ASSERT_EQ(ret, 0);
// Verify the cfg file was created and has the expected contents