mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-28 21:07:59 +03:00
make sure we can run on all systems; but require that it run in the same directory as the binary we wish to test
This commit is contained in:
parent
8505768736
commit
70465c5346
2 changed files with 4 additions and 11 deletions
|
@ -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 ${GTEST_INCLUDE_DIRS})
|
||||||
target_include_directories(openmw-iniimporter-tests SYSTEM PRIVATE ${GMOCK_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
|
target_link_libraries(openmw-iniimporter-tests PRIVATE
|
||||||
GTest::GTest
|
GTest::GTest
|
||||||
GMock::GMock
|
GMock::GMock
|
||||||
|
|
|
@ -1,14 +1,9 @@
|
||||||
#include <components/misc/strings/conversion.hpp>
|
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#ifndef CMAKE_BINARY_DIR
|
|
||||||
#define CMAKE_BINARY_DIR "." /* default to current directory */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct TestParam
|
struct TestParam
|
||||||
{
|
{
|
||||||
std::string name;
|
std::string name;
|
||||||
|
@ -35,11 +30,12 @@ Archive 1=game2.bsa
|
||||||
tempFile << iniData;
|
tempFile << iniData;
|
||||||
tempFile.close();
|
tempFile.close();
|
||||||
std::filesystem::path tempCfgFile = std::filesystem::temp_directory_path() / (param.fileName + ".cfg");
|
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;
|
std::stringstream cmd;
|
||||||
cmd << CMAKE_BINARY_DIR << u8"/openmw-iniimporter -i " << tempIniFile << u8" -c " << tempCfgFile;
|
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);
|
ASSERT_EQ(ret, 0);
|
||||||
|
|
||||||
// Verify the cfg file was created and has the expected contents
|
// Verify the cfg file was created and has the expected contents
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue