OSDN Git Service

[WIFI] Restore initialization code
authorEtan Cohen <etancohen@google.com>
Thu, 23 Mar 2017 15:11:47 +0000 (08:11 -0700)
committerEtan Cohen <etancohen@google.com>
Fri, 24 Mar 2017 00:37:42 +0000 (17:37 -0700)
Restore the usage of WIFI-specific main function. The main
function was inadvertantly disabled by moving it into a static
library - which caused the default main to be used.

Need a custom main since need to stop WIFI before tests start
to enforce a clean starting point.

Bug: 35276551
Test: confirms custom main routine is called
Change-Id: I978827bc0f0f16d9ca4f159fbf42d0bc53f5df99

wifi/1.0/vts/functional/Android.bp
wifi/1.0/vts/functional/VtsHalWifiV1_0TargetTest.cpp
wifi/1.0/vts/functional/wifi_hidl_test_utils.cpp
wifi/1.0/vts/functional/wifi_hidl_test_utils.h

index 9403e98..b454a06 100644 (file)
@@ -17,7 +17,7 @@
 cc_library_static {
     name: "VtsHalWifiV1_0TargetTestUtil",
     srcs: [
-        "VtsHalWifiV1_0TargetTest.cpp",
+
         "wifi_hidl_call_util_selftest.cpp",
         "wifi_hidl_test.cpp",
         "wifi_hidl_test_utils.cpp"],
@@ -38,6 +38,7 @@ cc_test {
     name: "VtsHalWifiV1_0TargetTest",
     defaults: ["hidl_defaults"],
     srcs: [
+        "VtsHalWifiV1_0TargetTest.cpp",
         "wifi_ap_iface_hidl_test.cpp",
         "wifi_chip_hidl_test.cpp",
         "wifi_p2p_iface_hidl_test.cpp",
@@ -63,7 +64,9 @@ cc_test {
 cc_test {
     name: "VtsHalWifiNanV1_0TargetTest",
     defaults: ["hidl_defaults"],
-    srcs: ["wifi_nan_iface_hidl_test.cpp"],
+    srcs: [
+        "VtsHalWifiV1_0TargetTest.cpp",
+        "wifi_nan_iface_hidl_test.cpp"],
     shared_libs: [
         "libbase",
         "liblog",
index b56ed2b..160fcd2 100644 (file)
 
 #include "wifi_hidl_test_utils.h"
 
-class WifiHidlEnvironment : public ::testing::Environment {
-   public:
-    virtual void SetUp() override { stopFramework(); }
-    virtual void TearDown() override { startFramework(); }
-
-   private:
-};
-
 int main(int argc, char** argv) {
     ::testing::AddGlobalTestEnvironment(new WifiHidlEnvironment);
     ::testing::InitGoogleTest(&argc, argv);
index 2d0b081..fefbd79 100644 (file)
@@ -82,14 +82,6 @@ bool configureChipToSupportIfaceTypeInternal(const sp<IWifiChip>& wifi_chip,
 }
 }  // namespace
 
-void stopFramework() {
-    ASSERT_EQ(std::system("stop"), 0);
-    stopWifi();
-    sleep(5);
-}
-
-void startFramework() { ASSERT_EQ(std::system("start"), 0); }
-
 sp<IWifi> getWifi() {
     sp<IWifi> wifi = ::testing::VtsHalHidlTargetTestBase::getService<IWifi>();
     return wifi;
index a723b2a..39a0eba 100644 (file)
 #include <android/hardware/wifi/1.0/IWifiRttController.h>
 #include <android/hardware/wifi/1.0/IWifiStaIface.h>
 
-// Used to stop the android framework (wifi service) before every
-// test.
-void stopFramework();
-void startFramework();
-
 // Helper functions to obtain references to the various HIDL interface objects.
 // Note: We only have a single instance of each of these objects currently.
 // These helper functions should be modified to return vectors if we support
@@ -49,3 +44,12 @@ bool configureChipToSupportIfaceType(
     android::hardware::wifi::V1_0::ChipModeId* configured_mode_id);
 // Used to trigger IWifi.stop() at the end of every test.
 void stopWifi();
+
+class WifiHidlEnvironment : public ::testing::Environment {
+ public:
+  virtual void SetUp() override {
+      stopWifi();
+      sleep(5);
+  }
+  virtual void TearDown() override {}
+};
\ No newline at end of file