Print the result of command when test is failed

When ConnectivityManagerTest#testGetMultipathPreference() is
failed, it only prints "Unexpected format from cmd netpolicy" and
it's not helpful.
Print the result of command can help people to know what's the
difference between expected result and actual result.

Bug: 187921745
Test: atest CtsNetTestCases:ConnectivityManagerTest#testGetMultipathPreference
Original-Change: https://android-review.googlesource.com/1749262
Merged-In: I63cd4b043e7c70775156aa5244d25ee2268f9f32
Change-Id: I63cd4b043e7c70775156aa5244d25ee2268f9f32
This commit is contained in:
Lucas Lin
2021-07-01 07:51:03 +00:00
parent bf9cb4dd18
commit a10f2a5f25

View File

@@ -1085,7 +1085,7 @@ public class ConnectivityManagerTest {
final Matcher m = Pattern.compile("^" + ssid + ";(true|false|none)$", final Matcher m = Pattern.compile("^" + ssid + ";(true|false|none)$",
Pattern.MULTILINE | Pattern.UNIX_LINES).matcher(policyString); Pattern.MULTILINE | Pattern.UNIX_LINES).matcher(policyString);
if (!m.find()) { if (!m.find()) {
fail("Unexpected format from cmd netpolicy"); fail("Unexpected format from cmd netpolicy, policyString = " + policyString);
} }
return m.group(1); return m.group(1);
} }