Loading cmds/idmap2/tests/Idmap2BinaryTests.cpp +18 −18 Original line number Diff line number Diff line Loading @@ -93,7 +93,7 @@ TEST_F(Idmap2BinaryTests, Create) { "--idmap-path", GetIdmapPath()}); // clang-format on ASSERT_THAT(result, NotNull()); ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr; ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr_str; struct stat st; ASSERT_EQ(stat(GetIdmapPath().c_str(), &st), 0); Loading @@ -119,7 +119,7 @@ TEST_F(Idmap2BinaryTests, Dump) { "--idmap-path", GetIdmapPath()}); // clang-format on ASSERT_THAT(result, NotNull()); ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr; ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr_str; // clang-format off result = ExecuteBinary({"idmap2", Loading @@ -127,14 +127,14 @@ TEST_F(Idmap2BinaryTests, Dump) { "--idmap-path", GetIdmapPath()}); // clang-format on ASSERT_THAT(result, NotNull()); ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr; ASSERT_NE(result->stdout.find(R::target::integer::literal::int1 + " -> 0x7f010000"), ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr_str; ASSERT_NE(result->stdout_str.find(R::target::integer::literal::int1 + " -> 0x7f010000"), std::string::npos); ASSERT_NE(result->stdout.find(R::target::string::literal::str1 + " -> 0x7f020000"), ASSERT_NE(result->stdout_str.find(R::target::string::literal::str1 + " -> 0x7f020000"), std::string::npos); ASSERT_NE(result->stdout.find(R::target::string::literal::str3 + " -> 0x7f020001"), ASSERT_NE(result->stdout_str.find(R::target::string::literal::str3 + " -> 0x7f020001"), std::string::npos); ASSERT_NE(result->stdout.find(R::target::string::literal::str4 + " -> 0x7f020002"), ASSERT_NE(result->stdout_str.find(R::target::string::literal::str4 + " -> 0x7f020002"), std::string::npos); // clang-format off Loading @@ -144,8 +144,8 @@ TEST_F(Idmap2BinaryTests, Dump) { "--idmap-path", GetIdmapPath()}); // clang-format on ASSERT_THAT(result, NotNull()); ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr; ASSERT_NE(result->stdout.find("00000000: 504d4449 magic"), std::string::npos); ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr_str; ASSERT_NE(result->stdout_str.find("00000000: 504d4449 magic"), std::string::npos); // clang-format off result = ExecuteBinary({"idmap2", Loading @@ -170,7 +170,7 @@ TEST_F(Idmap2BinaryTests, Lookup) { "--idmap-path", GetIdmapPath()}); // clang-format on ASSERT_THAT(result, NotNull()); ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr; ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr_str; // clang-format off result = ExecuteBinary({"idmap2", Loading @@ -180,9 +180,9 @@ TEST_F(Idmap2BinaryTests, Lookup) { "--resid", R::target::string::literal::str1}); // clang-format on ASSERT_THAT(result, NotNull()); ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr; ASSERT_NE(result->stdout.find("overlay-1"), std::string::npos); ASSERT_EQ(result->stdout.find("overlay-1-sv"), std::string::npos); ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr_str; ASSERT_NE(result->stdout_str.find("overlay-1"), std::string::npos); ASSERT_EQ(result->stdout_str.find("overlay-1-sv"), std::string::npos); // clang-format off result = ExecuteBinary({"idmap2", Loading @@ -192,9 +192,9 @@ TEST_F(Idmap2BinaryTests, Lookup) { "--resid", "test.target:string/str1"}); // clang-format on ASSERT_THAT(result, NotNull()); ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr; ASSERT_NE(result->stdout.find("overlay-1"), std::string::npos); ASSERT_EQ(result->stdout.find("overlay-1-sv"), std::string::npos); ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr_str; ASSERT_NE(result->stdout_str.find("overlay-1"), std::string::npos); ASSERT_EQ(result->stdout_str.find("overlay-1-sv"), std::string::npos); // clang-format off result = ExecuteBinary({"idmap2", Loading @@ -204,8 +204,8 @@ TEST_F(Idmap2BinaryTests, Lookup) { "--resid", "test.target:string/str1"}); // clang-format on ASSERT_THAT(result, NotNull()); ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr; ASSERT_NE(result->stdout.find("overlay-1-sv"), std::string::npos); ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr_str; ASSERT_NE(result->stdout_str.find("overlay-1-sv"), std::string::npos); unlink(GetIdmapPath().c_str()); } Loading core/jni/com_android_internal_content_om_OverlayConfig.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -73,13 +73,13 @@ static jobjectArray createIdmap(JNIEnv* env, jclass /*clazz*/, jstring targetPat } if (result->status != 0) { LOG(ERROR) << "idmap2: " << result->stderr; LOG(ERROR) << "idmap2: " << result->stderr_str; return nullptr; } // Return the paths of the idmaps created or updated during the idmap invocation. std::vector<std::string> idmap_paths; std::istringstream input(result->stdout); std::istringstream input(result->stdout_str); std::string path; while (std::getline(input, path)) { idmap_paths.push_back(path); Loading libs/androidfw/PosixUtils.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -114,10 +114,10 @@ std::unique_ptr<ProcResult> ExecuteBinary(const std::vector<std::string>& argv) std::unique_ptr<ProcResult> result(new ProcResult()); result->status = status; const auto out = ReadFile(stdout[0]); result->stdout = out ? *out : ""; result->stdout_str = out ? *out : ""; close(stdout[0]); const auto err = ReadFile(stderr[0]); result->stderr = err ? *err : ""; result->stderr_str = err ? *err : ""; close(stderr[0]); return result; } Loading libs/androidfw/include/androidfw/PosixUtils.h +2 −2 Original line number Diff line number Diff line Loading @@ -23,8 +23,8 @@ namespace util { struct ProcResult { int status; std::string stdout; std::string stderr; std::string stdout_str; std::string stderr_str; }; // Fork, exec and wait for an external process. Return nullptr if the process could not be launched, Loading libs/androidfw/tests/PosixUtils_test.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -30,14 +30,14 @@ TEST(PosixUtilsTest, AbsolutePathToBinary) { const auto result = ExecuteBinary({"/bin/date", "--help"}); ASSERT_THAT(result, NotNull()); ASSERT_EQ(result->status, 0); ASSERT_EQ(result->stdout.find("usage: date "), 0); ASSERT_EQ(result->stdout_str.find("usage: date "), 0); } TEST(PosixUtilsTest, RelativePathToBinary) { const auto result = ExecuteBinary({"date", "--help"}); ASSERT_THAT(result, NotNull()); ASSERT_EQ(result->status, 0); ASSERT_EQ(result->stdout.find("usage: date "), 0); ASSERT_EQ(result->stdout_str.find("usage: date "), 0); } TEST(PosixUtilsTest, BadParameters) { Loading Loading
cmds/idmap2/tests/Idmap2BinaryTests.cpp +18 −18 Original line number Diff line number Diff line Loading @@ -93,7 +93,7 @@ TEST_F(Idmap2BinaryTests, Create) { "--idmap-path", GetIdmapPath()}); // clang-format on ASSERT_THAT(result, NotNull()); ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr; ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr_str; struct stat st; ASSERT_EQ(stat(GetIdmapPath().c_str(), &st), 0); Loading @@ -119,7 +119,7 @@ TEST_F(Idmap2BinaryTests, Dump) { "--idmap-path", GetIdmapPath()}); // clang-format on ASSERT_THAT(result, NotNull()); ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr; ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr_str; // clang-format off result = ExecuteBinary({"idmap2", Loading @@ -127,14 +127,14 @@ TEST_F(Idmap2BinaryTests, Dump) { "--idmap-path", GetIdmapPath()}); // clang-format on ASSERT_THAT(result, NotNull()); ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr; ASSERT_NE(result->stdout.find(R::target::integer::literal::int1 + " -> 0x7f010000"), ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr_str; ASSERT_NE(result->stdout_str.find(R::target::integer::literal::int1 + " -> 0x7f010000"), std::string::npos); ASSERT_NE(result->stdout.find(R::target::string::literal::str1 + " -> 0x7f020000"), ASSERT_NE(result->stdout_str.find(R::target::string::literal::str1 + " -> 0x7f020000"), std::string::npos); ASSERT_NE(result->stdout.find(R::target::string::literal::str3 + " -> 0x7f020001"), ASSERT_NE(result->stdout_str.find(R::target::string::literal::str3 + " -> 0x7f020001"), std::string::npos); ASSERT_NE(result->stdout.find(R::target::string::literal::str4 + " -> 0x7f020002"), ASSERT_NE(result->stdout_str.find(R::target::string::literal::str4 + " -> 0x7f020002"), std::string::npos); // clang-format off Loading @@ -144,8 +144,8 @@ TEST_F(Idmap2BinaryTests, Dump) { "--idmap-path", GetIdmapPath()}); // clang-format on ASSERT_THAT(result, NotNull()); ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr; ASSERT_NE(result->stdout.find("00000000: 504d4449 magic"), std::string::npos); ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr_str; ASSERT_NE(result->stdout_str.find("00000000: 504d4449 magic"), std::string::npos); // clang-format off result = ExecuteBinary({"idmap2", Loading @@ -170,7 +170,7 @@ TEST_F(Idmap2BinaryTests, Lookup) { "--idmap-path", GetIdmapPath()}); // clang-format on ASSERT_THAT(result, NotNull()); ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr; ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr_str; // clang-format off result = ExecuteBinary({"idmap2", Loading @@ -180,9 +180,9 @@ TEST_F(Idmap2BinaryTests, Lookup) { "--resid", R::target::string::literal::str1}); // clang-format on ASSERT_THAT(result, NotNull()); ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr; ASSERT_NE(result->stdout.find("overlay-1"), std::string::npos); ASSERT_EQ(result->stdout.find("overlay-1-sv"), std::string::npos); ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr_str; ASSERT_NE(result->stdout_str.find("overlay-1"), std::string::npos); ASSERT_EQ(result->stdout_str.find("overlay-1-sv"), std::string::npos); // clang-format off result = ExecuteBinary({"idmap2", Loading @@ -192,9 +192,9 @@ TEST_F(Idmap2BinaryTests, Lookup) { "--resid", "test.target:string/str1"}); // clang-format on ASSERT_THAT(result, NotNull()); ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr; ASSERT_NE(result->stdout.find("overlay-1"), std::string::npos); ASSERT_EQ(result->stdout.find("overlay-1-sv"), std::string::npos); ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr_str; ASSERT_NE(result->stdout_str.find("overlay-1"), std::string::npos); ASSERT_EQ(result->stdout_str.find("overlay-1-sv"), std::string::npos); // clang-format off result = ExecuteBinary({"idmap2", Loading @@ -204,8 +204,8 @@ TEST_F(Idmap2BinaryTests, Lookup) { "--resid", "test.target:string/str1"}); // clang-format on ASSERT_THAT(result, NotNull()); ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr; ASSERT_NE(result->stdout.find("overlay-1-sv"), std::string::npos); ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr_str; ASSERT_NE(result->stdout_str.find("overlay-1-sv"), std::string::npos); unlink(GetIdmapPath().c_str()); } Loading
core/jni/com_android_internal_content_om_OverlayConfig.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -73,13 +73,13 @@ static jobjectArray createIdmap(JNIEnv* env, jclass /*clazz*/, jstring targetPat } if (result->status != 0) { LOG(ERROR) << "idmap2: " << result->stderr; LOG(ERROR) << "idmap2: " << result->stderr_str; return nullptr; } // Return the paths of the idmaps created or updated during the idmap invocation. std::vector<std::string> idmap_paths; std::istringstream input(result->stdout); std::istringstream input(result->stdout_str); std::string path; while (std::getline(input, path)) { idmap_paths.push_back(path); Loading
libs/androidfw/PosixUtils.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -114,10 +114,10 @@ std::unique_ptr<ProcResult> ExecuteBinary(const std::vector<std::string>& argv) std::unique_ptr<ProcResult> result(new ProcResult()); result->status = status; const auto out = ReadFile(stdout[0]); result->stdout = out ? *out : ""; result->stdout_str = out ? *out : ""; close(stdout[0]); const auto err = ReadFile(stderr[0]); result->stderr = err ? *err : ""; result->stderr_str = err ? *err : ""; close(stderr[0]); return result; } Loading
libs/androidfw/include/androidfw/PosixUtils.h +2 −2 Original line number Diff line number Diff line Loading @@ -23,8 +23,8 @@ namespace util { struct ProcResult { int status; std::string stdout; std::string stderr; std::string stdout_str; std::string stderr_str; }; // Fork, exec and wait for an external process. Return nullptr if the process could not be launched, Loading
libs/androidfw/tests/PosixUtils_test.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -30,14 +30,14 @@ TEST(PosixUtilsTest, AbsolutePathToBinary) { const auto result = ExecuteBinary({"/bin/date", "--help"}); ASSERT_THAT(result, NotNull()); ASSERT_EQ(result->status, 0); ASSERT_EQ(result->stdout.find("usage: date "), 0); ASSERT_EQ(result->stdout_str.find("usage: date "), 0); } TEST(PosixUtilsTest, RelativePathToBinary) { const auto result = ExecuteBinary({"date", "--help"}); ASSERT_THAT(result, NotNull()); ASSERT_EQ(result->status, 0); ASSERT_EQ(result->stdout.find("usage: date "), 0); ASSERT_EQ(result->stdout_str.find("usage: date "), 0); } TEST(PosixUtilsTest, BadParameters) { Loading