mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
Added one extra test
This commit is contained in:
parent
589776b6f9
commit
725f665b79
|
@ -20,8 +20,7 @@ set(CMAKE_CXX_STANDARD 17)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED 17)
|
set(CMAKE_CXX_STANDARD_REQUIRED 17)
|
||||||
|
|
||||||
# Build SAPI library
|
# Build SAPI library
|
||||||
#set(SAPI_ROOT "" CACHE PATH "Path to the Sandboxed API source tree")
|
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")
|
|
||||||
|
|
||||||
include(FetchContent)
|
include(FetchContent)
|
||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
#include "build/googletest-src/googlemock/include/gmock/gmock-more-matchers.h"
|
#include "build/googletest-src/googlemock/include/gmock/gmock-more-matchers.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
#include "sandboxed_api/sandbox2/util/path.h"
|
||||||
#include "sandboxed_api/util/status_matchers.h"
|
#include "sandboxed_api/util/status_matchers.h"
|
||||||
#include "sapi_minitar.h"
|
#include "sapi_minitar.h"
|
||||||
|
|
||||||
|
@ -259,4 +260,19 @@ TEST_F(MiniTarTest, TestBZIP2) {
|
||||||
CheckFile(std::string(kFile3_));
|
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
|
} // namespace
|
||||||
|
|
Loading…
Reference in New Issue
Block a user