diff options
| author | Stefan Boberg <[email protected]> | 2021-06-18 15:43:23 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2021-06-18 15:43:23 +0200 |
| commit | 9e97f5eef6c89f02f5b0c04886fbc3670e243856 (patch) | |
| tree | 2d21ef998fa6f8ae0b92e2f01085ca25b634f0d6 | |
| parent | Added simple control of test executable exit code (diff) | |
| download | zen-9e97f5eef6c89f02f5b0c04886fbc3670e243856.tar.xz zen-9e97f5eef6c89f02f5b0c04886fbc3670e243856.zip | |
Added ZenTestEnvironment::RootDir to construct a path to a subdirectory in the project tree
| -rw-r--r-- | zentestutil/include/zenserverprocess.h | 1 | ||||
| -rw-r--r-- | zentestutil/zenserverprocess.cpp | 15 | ||||
| -rw-r--r-- | zentestutil/zentestutil.vcxproj | 2 | ||||
| -rw-r--r-- | zentestutil/zentestutil.vcxproj.filters | 2 |
4 files changed, 17 insertions, 3 deletions
diff --git a/zentestutil/include/zenserverprocess.h b/zentestutil/include/zenserverprocess.h index 3f86f283c..ecbe39f90 100644 --- a/zentestutil/include/zenserverprocess.h +++ b/zentestutil/include/zenserverprocess.h @@ -18,6 +18,7 @@ public: std::filesystem::path CreateNewTestDir(); std::filesystem::path ProgramBaseDir() const { return m_ProgramBaseDir; } + std::filesystem::path RootDir(std::string_view Path); bool IsInitialized() const { return m_IsInitialized; } private: diff --git a/zentestutil/zenserverprocess.cpp b/zentestutil/zenserverprocess.cpp index 9d62d692f..04314bc5f 100644 --- a/zentestutil/zenserverprocess.cpp +++ b/zentestutil/zenserverprocess.cpp @@ -26,7 +26,8 @@ ZenTestEnvironment::Initialize(std::filesystem::path ProgramBaseDir, std::filesy m_ProgramBaseDir = ProgramBaseDir; m_TestBaseDir = TestBaseDir; - spdlog::info("Cleaning '{}'", TestBaseDir); + spdlog::info("Program base dir is '{}'", ProgramBaseDir); + spdlog::info("Cleaning test base dir '{}'", TestBaseDir); zen::DeleteDirectories(TestBaseDir.c_str()); m_IsInitialized = true; @@ -42,11 +43,23 @@ ZenTestEnvironment::CreateNewTestDir() std::filesystem::path TestPath = m_TestBaseDir / TestDir.c_str(); + spdlog::info("Creating new test dir @ '{}'", TestPath); + zen::CreateDirectories(TestPath.c_str()); return TestPath; } +std::filesystem::path +ZenTestEnvironment::RootDir(std::string_view Path) +{ + std::filesystem::path Root = m_ProgramBaseDir.parent_path().parent_path(); + + std::filesystem::path Relative { Path }; + + return Root / Relative; +} + ////////////////////////////////////////////////////////////////////////// std::atomic<int> ChildIdCounter{0}; diff --git a/zentestutil/zentestutil.vcxproj b/zentestutil/zentestutil.vcxproj index cf8b02dc1..6b0656759 100644 --- a/zentestutil/zentestutil.vcxproj +++ b/zentestutil/zentestutil.vcxproj @@ -98,7 +98,7 @@ <ClCompile Include="zenserverprocess.cpp" /> </ItemGroup> <ItemGroup> - <ClInclude Include="zenserverprocess.h" /> + <ClInclude Include="include\zenserverprocess.h" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> diff --git a/zentestutil/zentestutil.vcxproj.filters b/zentestutil/zentestutil.vcxproj.filters index 1afefcdf7..ca1414842 100644 --- a/zentestutil/zentestutil.vcxproj.filters +++ b/zentestutil/zentestutil.vcxproj.filters @@ -4,6 +4,6 @@ <ClCompile Include="zenserverprocess.cpp" /> </ItemGroup> <ItemGroup> - <ClInclude Include="zenserverprocess.h" /> + <ClInclude Include="include\zenserverprocess.h" /> </ItemGroup> </Project>
\ No newline at end of file |