From 477de3b6b7066d4248d5ace0d91737de6fee6940 Mon Sep 17 00:00:00 2001 From: Alexandra Latysheva Date: Wed, 30 Sep 2020 19:17:23 +0000 Subject: [PATCH] last for today --- oss-internship-2020/libtiff/example/CMakeLists.txt | 4 ++-- .../libtiff/example/main_sandboxed.cc | 2 +- oss-internship-2020/libtiff/test/CMakeLists.txt | 12 ++++++------ .../libtiff/test/defer_strile_writing.cc | 6 ++++-- oss-internship-2020/libtiff/test/helper.cc | 4 ++-- 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/oss-internship-2020/libtiff/example/CMakeLists.txt b/oss-internship-2020/libtiff/example/CMakeLists.txt index b266071..045e0a9 100644 --- a/oss-internship-2020/libtiff/example/CMakeLists.txt +++ b/oss-internship-2020/libtiff/example/CMakeLists.txt @@ -18,7 +18,7 @@ add_executable(sandboxed ) target_link_libraries(sandboxed PRIVATE - tiff_sapi - sapi::sapi sandbox2::temp_file + sapi::sapi + tiff_sapi ) diff --git a/oss-internship-2020/libtiff/example/main_sandboxed.cc b/oss-internship-2020/libtiff/example/main_sandboxed.cc index c09f7b4..25e2e0c 100644 --- a/oss-internship-2020/libtiff/example/main_sandboxed.cc +++ b/oss-internship-2020/libtiff/example/main_sandboxed.cc @@ -115,7 +115,7 @@ absl::Status LibTIFFMain(const std::string& srcfile) { // sandbox(absolute_path_to_dir, srcfile) or // sandbox(absolute_path_to_dir). file and dir should be exists. // srcfile must also be absolute_path_to_file - TiffSapiSandbox sandbox("", srcfile); + TiffSapiSandbox sandbox(srcfile); // initialize sapi vars after constructing TiffSapiSandbox sapi::v::UShort h, v; diff --git a/oss-internship-2020/libtiff/test/CMakeLists.txt b/oss-internship-2020/libtiff/test/CMakeLists.txt index b36e65a..ffa4213 100644 --- a/oss-internship-2020/libtiff/test/CMakeLists.txt +++ b/oss-internship-2020/libtiff/test/CMakeLists.txt @@ -18,20 +18,20 @@ add_executable(tests check_tag.h check_tag.cc defer_strile_writing.cc + helper.h + helper.cc long_tag.cc raw_decode.cc short_tag.cc - helper.h - helper.cc ) target_link_libraries(tests PRIVATE - tiff_sapi - sapi::sapi - sandbox2::temp_file - gtest gmock + gtest gtest_main + sandbox2::temp_file + sapi::sapi + tiff_sapi ) gtest_discover_tests(tests) diff --git a/oss-internship-2020/libtiff/test/defer_strile_writing.cc b/oss-internship-2020/libtiff/test/defer_strile_writing.cc index 7588075..507e3fc 100644 --- a/oss-internship-2020/libtiff/test/defer_strile_writing.cc +++ b/oss-internship-2020/libtiff/test/defer_strile_writing.cc @@ -215,7 +215,8 @@ void TestWriting(const char* mode, int tiled, int height) { api.TIFFWriteEncodedTile(&tif, i, tilebuffer_.PtrBoth(), TBS); ASSERT_THAT(status_or_int, IsOk()) << "TIFFWriteEncodedTile fatal error"; EXPECT_THAT(status_or_int.value(), Eq(TBS)) - << "line " << i << ": expected 256, got " << status_or_int.value(); + << "line " << i << ": expected " << TBS << ", got " + << status_or_int.value(); } } else { for (int i = 0; i < height; ++i) { @@ -254,7 +255,8 @@ void TestWriting(const char* mode, int tiled, int height) { ASSERT_THAT(status_or_long, IsOk()) << "TIFFReadEncodedTile fatal error"; EXPECT_THAT(status_or_long.value(), Eq(TBS)) - << "line " << i << ": expected 256, got " << status_or_long.value(); + << "line " << i << ": expected " << TBS << ", got " + << status_or_long.value(); bool cmp = tilebuffer[0] != expected_c || tilebuffer[255] != expected_c; diff --git a/oss-internship-2020/libtiff/test/helper.cc b/oss-internship-2020/libtiff/test/helper.cc index 19d3c22..7ab2996 100644 --- a/oss-internship-2020/libtiff/test/helper.cc +++ b/oss-internship-2020/libtiff/test/helper.cc @@ -23,10 +23,10 @@ std::string GetImagesDir() { LOG(ERROR) << "Something went wrong: CWD don't contain build dir. " << "Please run tests from build dir, path might be incorrect\n"; - return cwd + "/test/images"; + return sandbox2::file::JoinPath(cwd, "test", "images"); } - return cwd.substr(0, find) + "/test/images"; + return sandbox2::file::JoinPath(cwd.substr(0, find), "test", "images"); } std::string GetFilePath(const std::string& filename) {