ListeningPortsTest: Make error message more useful.
- Add UID of listener to error message. - Convert hex port number to decimal for easier reading by humans. Change-Id: I0b8edcf14ebd0c039b936055a265f4706558f9fe
This commit is contained in:
@@ -118,13 +118,18 @@ public class ListeningPortsTest extends TestCase {
|
|||||||
|
|
||||||
String localAddress = fields[1];
|
String localAddress = fields[1];
|
||||||
String state = fields[3];
|
String state = fields[3];
|
||||||
|
String uid = fields[7];
|
||||||
|
|
||||||
assertTrue(procFilePath + " should have an IP address in the second column",
|
assertTrue(procFilePath + " should have an IP address in the second column",
|
||||||
isAddress(localAddress));
|
isAddress(localAddress));
|
||||||
|
|
||||||
|
String localIp = localAddress.split(":")[0];
|
||||||
|
int localPort = Integer.parseInt(localAddress.split(":")[1], 16);
|
||||||
|
|
||||||
if (!isException(localAddress) && isPortListening(state, isTcp)) {
|
if (!isException(localAddress) && isPortListening(state, isTcp)) {
|
||||||
throw new ListeningPortsAssertionError(
|
throw new ListeningPortsAssertionError(
|
||||||
"Found port listening on " + localAddress + " in " + procFilePath);
|
"Found port listening on addr=" + localIp + ", port="
|
||||||
|
+ localPort + ", UID=" + uid + " in " + procFilePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (FileNotFoundException notFound) {
|
} catch (FileNotFoundException notFound) {
|
||||||
|
|||||||
Reference in New Issue
Block a user