Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1c0d225e authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 7142207 from aa24ad1a to sc-v2-release

Change-Id: I325ea050987fad1548c19b68bde4d816366f106d
parents 2790ee2e aa24ad1a
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -132,11 +132,24 @@ class DnsResolverBinderTest : public ::testing::Test {
        // For each element of testdata, check that the expected output appears in the dump output.
        // If not, fail the test and use hintRegex to print similar lines to assist in debugging.
        for (const auto& td : mExpectedLogData) {
            const std::string toErase = "(null)";
            const bool found =
                    std::any_of(lines.begin(), lines.end(), [&](const std::string& line) {
                        std::smatch match;
                        if (!std::regex_match(line, match, lineRegex)) return false;
                        return (match.size() == 2) && (match[1].str() == td.output);
                        if (match.size() != 2) return false;

                        // The binder_to_string format is changed from S that will add "(null)" to
                        // the log on method's argument if binder object is null. But Q and R don't
                        // have this format in log. So to make register null listener tests are
                        // compatible from all version, just remove the "(null)" argument from
                        // output logs if existed.
                        std::string output = match[1].str();
                        const auto pos = output.find(toErase);
                        if (pos != std::string::npos && pos < output.length()) {
                            output.erase(pos, toErase.length());
                        }
                        return output == td.output;
                    });
            EXPECT_TRUE(found) << "Didn't find line '" << td.output << "' in dumpsys output.";
            if (found) continue;