diff --git a/oss-internship-2020/sapi_lodepng/CMakeLists.txt b/oss-internship-2020/sapi_lodepng/CMakeLists.txt index 34396b0..e0edd79 100644 --- a/oss-internship-2020/sapi_lodepng/CMakeLists.txt +++ b/oss-internship-2020/sapi_lodepng/CMakeLists.txt @@ -19,7 +19,9 @@ project(lodepng_sapi CXX) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED 17) -add_subdirectory(lodepng-master) +add_library(lodepng STATIC lodepng-master/lodepng.cpp lodepng-master/lodepng.h) + +# add_subdirectory(lodepng-master) # unsandboxed main diff --git a/oss-internship-2020/sapi_lodepng/com_google_sandboxed_api b/oss-internship-2020/sapi_lodepng/com_google_sandboxed_api index ebc824a..fe88e13 120000 --- a/oss-internship-2020/sapi_lodepng/com_google_sandboxed_api +++ b/oss-internship-2020/sapi_lodepng/com_google_sandboxed_api @@ -1 +1 @@ -/usr/local/google/home/amedar/internship/sandboxed-api/build \ No newline at end of file +/usr/local/google/home/amedar/internship/sandboxed-api/oss-internship-2020/sapi_lodepng/build/sandboxed-api-build \ No newline at end of file diff --git a/oss-internship-2020/sapi_lodepng/lodepng-master/CMakeLists.txt b/oss-internship-2020/sapi_lodepng/lodepng-master/CMakeLists.txt deleted file mode 100644 index 3891858..0000000 --- a/oss-internship-2020/sapi_lodepng/lodepng-master/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -add_library(lodepng STATIC lodepng.cpp lodepng.h) \ No newline at end of file diff --git a/oss-internship-2020/sapi_lodepng/main_unit_test.cc b/oss-internship-2020/sapi_lodepng/main_unit_test.cc index b0f9555..9b9800a 100644 --- a/oss-internship-2020/sapi_lodepng/main_unit_test.cc +++ b/oss-internship-2020/sapi_lodepng/main_unit_test.cc @@ -52,6 +52,8 @@ TEST(generate_image, encode_decode_compare_one_step) { unsigned int width = 512, height = 512; unsigned char *image = (unsigned char *)malloc(width * height * 4); + ASSERT_TRUE(image); + for (int y = 0; y < height; ++y) { for (int x = 0; x < width; ++x) { image[4 * width * y + 4 * x + 0] = 255 * !(x & y); @@ -126,6 +128,8 @@ TEST(generate_image, encode_decode_compare_two_step) { unsigned int width = 512, height = 512; unsigned char *image = (unsigned char *)malloc(width * height * 4); + ASSERT_TRUE(image); + for (int y = 0; y < height; ++y) { for (int x = 0; x < width; ++x) { image[4 * width * y + 4 * x + 0] = 255 * !(x & y); @@ -153,8 +157,6 @@ TEST(generate_image, encode_decode_compare_two_step) { ASSERT_TRUE(result.ok()); ASSERT_EQ(result.value(), 0); - std::cout << "sapi_pngsize = " << sapi_pngsize.GetValue() << std::endl; - // the new array (pointed to by sapi_png_ptr) is allocated // inside the sandboxed process so we need to transfer it to this // process @@ -172,6 +174,7 @@ TEST(generate_image, encode_decode_compare_two_step) { api.lodepng_save_file(sapi_png_array.PtrBefore(), sapi_pngsize.GetValue(), sapi_filename.PtrBefore()); + ASSERT_TRUE(result.ok()); ASSERT_EQ(result.value(), 0);