Added one extra test

This commit is contained in:
Andrei Medar 2020-10-02 16:52:13 +00:00
parent 589776b6f9
commit 725f665b79
2 changed files with 17 additions and 2 deletions

View File

@ -20,8 +20,7 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED 17)
# Build SAPI library
#set(SAPI_ROOT "" CACHE PATH "Path to the Sandboxed API source tree")
set(SAPI_ROOT "/usr/local/google/home/amedar/internship/sandboxed-api" CACHE PATH "Path to the Sandboxed API source tree")
set(SAPI_ROOT "" CACHE PATH "Path to the Sandboxed API source tree")
include(FetchContent)
FetchContent_Declare(

View File

@ -16,6 +16,7 @@
#include "build/googletest-src/googlemock/include/gmock/gmock-more-matchers.h"
#include "gtest/gtest.h"
#include "sandboxed_api/sandbox2/util/path.h"
#include "sandboxed_api/util/status_matchers.h"
#include "sapi_minitar.h"
@ -259,4 +260,19 @@ TEST_F(MiniTarTest, TestBZIP2) {
CheckFile(std::string(kFile3_));
}
TEST_F(MiniTarTest, TestPaths) {
// These should be equivalent to kFile1_ and kDir1_ after cleaning.
std::vector<std::string> v = {JoinPath("a/b/../../c/../", kFile1_).data(),
JoinPath("d/../e/././///../", kDir1_).data()};
create(id_.data(), 0, VecStringToCharPtrArr(v), false);
ASSERT_THAT(chdir(tmp_dir_.data()), Eq(0))
<< "Could not chdir into test data directory";
extract(JoinPath(data_dir_, id_).data(), 1, 0, false);
CheckFile(std::string(kFile1_));
CheckFile(std::string(kFile2_));
CheckFile(std::string(kFile3_));
}
} // namespace