Merge "Add CTS support for eBPF" into pi-dev
diff --git a/tests/cts/net/native/qtaguid/Android.mk b/tests/cts/net/native/qtaguid/Android.mk
index 6c92b5c..bf89e5f 100644
--- a/tests/cts/net/native/qtaguid/Android.mk
+++ b/tests/cts/net/native/qtaguid/Android.mk
@@ -29,10 +29,10 @@
LOCAL_SHARED_LIBRARIES := \
libutils \
liblog \
- libcutils \
LOCAL_STATIC_LIBRARIES := \
- libgtest
+ libgtest \
+ libqtaguid \
LOCAL_CTS_TEST_PACKAGE := android.net.native
# Tag this module as a cts test artifact
diff --git a/tests/cts/net/native/qtaguid/src/NativeQtaguidTest.cpp b/tests/cts/net/native/qtaguid/src/NativeQtaguidTest.cpp
index 7f790fb..1892a44 100644
--- a/tests/cts/net/native/qtaguid/src/NativeQtaguidTest.cpp
+++ b/tests/cts/net/native/qtaguid/src/NativeQtaguidTest.cpp
@@ -23,7 +23,7 @@
#include <sys/utsname.h>
#include <gtest/gtest.h>
-#include <cutils/qtaguid.h>
+#include <qtaguid/qtaguid.h>
int hasQtaguidKernelSupport() {
struct utsname buf;
@@ -87,7 +87,7 @@
uint64_t sk_addr;
uint64_t expect_addr = 0;
- EXPECT_EQ(0, qtaguid_tagSocket(sockfd, tag, uid));
+ EXPECT_EQ(0, legacy_tagSocket(sockfd, tag, uid));
EXPECT_EQ(0, getCtrlSkInfo(tag, uid, &sk_addr, &ref_cnt));
EXPECT_EQ(expect_addr, sk_addr);
close(sockfd);
@@ -106,7 +106,7 @@
int tag = arc4random();
int ref_cnt;
uint64_t dummy_sk;
- EXPECT_EQ(0, qtaguid_tagSocket(sockfd, tag, uid));
+ EXPECT_EQ(0, legacy_tagSocket(sockfd, tag, uid));
EXPECT_EQ(0, getCtrlSkInfo(tag, uid, &dummy_sk, &ref_cnt));
EXPECT_EQ(2, ref_cnt);
close(sockfd);
@@ -125,7 +125,7 @@
int tag = arc4random();
int ref_cnt;
uint64_t dummy_sk;
- EXPECT_EQ(0, qtaguid_tagSocket(sockfd, tag, uid));
+ EXPECT_EQ(0, legacy_tagSocket(sockfd, tag, uid));
EXPECT_EQ(0, getCtrlSkInfo(tag, uid, &dummy_sk, &ref_cnt));
EXPECT_EQ(2, ref_cnt);
close(sockfd);
diff --git a/tests/cts/net/src/android/net/wifi/cts/WifiManagerTest.java b/tests/cts/net/src/android/net/wifi/cts/WifiManagerTest.java
index c435a8a..af91fbf 100644
--- a/tests/cts/net/src/android/net/wifi/cts/WifiManagerTest.java
+++ b/tests/cts/net/src/android/net/wifi/cts/WifiManagerTest.java
@@ -70,7 +70,7 @@
private static final int STATE_WIFI_ENABLED = 2;
private static final int STATE_WIFI_DISABLED = 3;
private static final int STATE_SCANNING = 4;
- private static final int STATE_SCAN_RESULTS_AVAILABLE = 5;
+ private static final int STATE_SCAN_DONE = 5;
private static final String TAG = "WifiManagerTest";
private static final String SSID1 = "\"WifiManagerTest\"";
@@ -96,13 +96,15 @@
public void onReceive(Context context, Intent intent) {
final String action = intent.getAction();
if (action.equals(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION)) {
+
synchronized (mMySync) {
- if (mWifiManager.getScanResults() != null) {
+ if (intent.getBooleanExtra(WifiManager.EXTRA_RESULTS_UPDATED, false)) {
mScanResults = mWifiManager.getScanResults();
- mMySync.expectedState = STATE_SCAN_RESULTS_AVAILABLE;
- mScanResults = mWifiManager.getScanResults();
- mMySync.notifyAll();
+ } else {
+ mScanResults = null;
}
+ mMySync.expectedState = STATE_SCAN_DONE;
+ mMySync.notifyAll();
}
} else if (action.equals(WifiManager.WIFI_STATE_CHANGED_ACTION)) {
int newState = intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE,
@@ -872,10 +874,9 @@
TestLocalOnlyHotspotCallback callback = startLocalOnlyHotspot();
- // at this point, wifi should be off
- assertFalse(mWifiManager.isWifiEnabled());
-
stopLocalOnlyHotspot(callback, wifiEnabled);
+
+ // wifi should either stay on, or come back on
assertEquals(wifiEnabled, mWifiManager.isWifiEnabled());
}
@@ -887,7 +888,7 @@
* tethering is started.
* Note: Location mode must be enabled for this test.
*/
- public void testSetWifiEnabledByAppDoesNotStopHotspot() {
+ public void testSetWifiEnabledByAppDoesNotStopHotspot() throws Exception {
if (!WifiFeature.isWifiSupported(getContext())) {
// skip the test if WiFi is not supported
return;
@@ -899,15 +900,18 @@
boolean wifiEnabled = mWifiManager.isWifiEnabled();
+ if (wifiEnabled) {
+ // disable wifi so we have something to turn on (some devices may be able to run
+ // simultaneous modes)
+ setWifiEnabled(false);
+ }
+
TestLocalOnlyHotspotCallback callback = startLocalOnlyHotspot();
- // at this point, wifi should be off
- assertFalse(mWifiManager.isWifiEnabled());
// now we should fail to turn on wifi
assertFalse(mWifiManager.setWifiEnabled(true));
stopLocalOnlyHotspot(callback, wifiEnabled);
- assertEquals(wifiEnabled, mWifiManager.isWifiEnabled());
}
/**
@@ -931,9 +935,6 @@
TestLocalOnlyHotspotCallback callback = startLocalOnlyHotspot();
- // at this point, wifi should be off
- assertFalse(mWifiManager.isWifiEnabled());
-
// now make a second request - this should fail.
TestLocalOnlyHotspotCallback callback2 = new TestLocalOnlyHotspotCallback(mLOHSLock);
try {
@@ -942,9 +943,12 @@
Log.d(TAG, "Caught the IllegalStateException we expected: called startLOHS twice");
caughtException = true;
}
+ if (!caughtException) {
+ // second start did not fail, should clean up the hotspot.
+ stopLocalOnlyHotspot(callback2, wifiEnabled);
+ }
assertTrue(caughtException);
stopLocalOnlyHotspot(callback, wifiEnabled);
- assertEquals(wifiEnabled, mWifiManager.isWifiEnabled());
}
}