2012-07-06 57 views
0

當我運行CTS情況:android.net.cts.ListeningPortsTest:: testNoListeningUdp6Ports,它失敗了,痕跡如下:爲什麼斷言:android.net.cts.ListeningPortsTest :: testNoListeningUdp6Ports

android.net.cts.ListeningPortsTest$ListeningPortsAssertionError: Found port listening on addr=00000000000000000000000000000000, port=43012, UID=1000 in /proc/net/udp6 at android.net.cts.ListeningPortsTest.assertNoListeningPorts(ListeningPortsTest.java:130)

這種情況從文件/ proc/net/udp6獲得udp6端口信息,但是如果udp6端口的狀態爲「07」,表示CLOSED(如include/net/tcp_states.h已定義),爲什麼isPortListening()返回「真實「都是一樣的。然後,案件認爲udp6端口正在偵聽,並拋出異常。

所以,我覺得在這種情況下可能有什麼問題,有人可以解釋嗎?謝謝。

附錄:

private static boolean isPortListening(String state, boolean isTcp) { 
    // 0A = TCP_LISTEN from include/net/tcp_states.h 
    String listeningState = isTcp ? "0A" : "07"; 
    return listeningState.equals(state); 
} 

回答

1

isTcp參數設定爲false在該方法中testNoListeningUdp6Ports,但在testNoListeningTcp6Ports它是true

相關問題