Merge "Rename ProcResult stdout and stderr fields"
diff --git a/cmds/idmap2/tests/Idmap2BinaryTests.cpp b/cmds/idmap2/tests/Idmap2BinaryTests.cpp
index e7e9e4c..a1206f9 100644
--- a/cmds/idmap2/tests/Idmap2BinaryTests.cpp
+++ b/cmds/idmap2/tests/Idmap2BinaryTests.cpp
@@ -93,7 +93,7 @@
"--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);
@@ -119,7 +119,7 @@
"--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",
@@ -127,14 +127,14 @@
"--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
@@ -144,8 +144,8 @@
"--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",
@@ -170,7 +170,7 @@
"--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",
@@ -180,9 +180,9 @@
"--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",
@@ -192,9 +192,9 @@
"--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",
@@ -204,8 +204,8 @@
"--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());
}
diff --git a/core/jni/com_android_internal_content_om_OverlayConfig.cpp b/core/jni/com_android_internal_content_om_OverlayConfig.cpp
index 6aa7c10..b37269c 100644
--- a/core/jni/com_android_internal_content_om_OverlayConfig.cpp
+++ b/core/jni/com_android_internal_content_om_OverlayConfig.cpp
@@ -73,13 +73,13 @@
}
if (result->status != 0) {
- LOG(ERROR) << "idmap2: " << result->stderr;
- return nullptr;
+ 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);
diff --git a/libs/androidfw/PosixUtils.cpp b/libs/androidfw/PosixUtils.cpp
index 4ec525a..0269128 100644
--- a/libs/androidfw/PosixUtils.cpp
+++ b/libs/androidfw/PosixUtils.cpp
@@ -114,10 +114,10 @@
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;
}
diff --git a/libs/androidfw/include/androidfw/PosixUtils.h b/libs/androidfw/include/androidfw/PosixUtils.h
index 8fc3ee2..bb20847 100644
--- a/libs/androidfw/include/androidfw/PosixUtils.h
+++ b/libs/androidfw/include/androidfw/PosixUtils.h
@@ -23,8 +23,8 @@
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,
diff --git a/libs/androidfw/tests/PosixUtils_test.cpp b/libs/androidfw/tests/PosixUtils_test.cpp
index cf97f87..c7b3eba 100644
--- a/libs/androidfw/tests/PosixUtils_test.cpp
+++ b/libs/androidfw/tests/PosixUtils_test.cpp
@@ -30,14 +30,14 @@
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) {