Completely remove log_energy_info from tests
Bug: 31966929
Change-Id: I21faad2879e6b1f6ae99cfaa291514d89e98a76d
(cherry picked from commit 6f0ee6f177ed82e609bb5556e0495507d5e2f5f7)
diff --git a/acts/framework/acts/test_utils/bt/BluetoothBaseTest.py b/acts/framework/acts/test_utils/bt/BluetoothBaseTest.py
index 11abd07..f9b654e 100644
--- a/acts/framework/acts/test_utils/bt/BluetoothBaseTest.py
+++ b/acts/framework/acts/test_utils/bt/BluetoothBaseTest.py
@@ -26,8 +26,7 @@
from acts.utils import set_location_service
from acts.controllers import android_device
from acts.test_utils.bt.bt_test_utils import (
- log_energy_info, reset_bluetooth, setup_multiple_devices_for_bt_test,
- take_btsnoop_logs)
+ reset_bluetooth, setup_multiple_devices_for_bt_test, take_btsnoop_logs)
from acts.utils import sync_device_time
import threading
@@ -94,7 +93,8 @@
if "reboot_between_test_class" in self.user_params:
threads = []
for a in self.android_devices:
- thread = threading.Thread(target=self._reboot_device, args=([a]))
+ thread = threading.Thread(
+ target=self._reboot_device, args=([a]))
threads.append(thread)
thread.start()
for t in threads:
@@ -106,13 +106,11 @@
def setup_test(self):
self.timer_list = []
- self.log.debug(log_energy_info(self.android_devices, "Start"))
for a in self.android_devices:
a.ed.clear_all_events()
return True
def teardown_test(self):
- self.log.debug(log_energy_info(self.android_devices, "End"))
return True
def on_fail(self, test_name, begin_time):
@@ -138,13 +136,14 @@
try:
ad.adb.wait_for_device()
ad.take_bug_report(test_name, begin_time)
- tombstone_path = os.path.join(ad.log_path, "BugReports",
- "{},{}".format(begin_time, ad.serial).replace(' ','_'))
+ tombstone_path = os.path.join(
+ ad.log_path, "BugReports",
+ "{},{}".format(begin_time, ad.serial).replace(' ', '_'))
utils.create_dir(tombstone_path)
ad.adb.pull('/data/tombstones/', tombstone_path)
except:
- ad.log.error("Failed to take a bug report for {}, {}"
- .format(ad.serial, test_name))
+ self.log.error("Failed to take a bug report for {}, {}"
+ .format(ad.serial, test_name))
def _get_time_in_milliseconds(self):
return int(round(time.time() * 1000))
diff --git a/acts/framework/acts/test_utils/bt/bt_test_utils.py b/acts/framework/acts/test_utils/bt/bt_test_utils.py
index 5d535bd..5cc6634 100644
--- a/acts/framework/acts/test_utils/bt/bt_test_utils.py
+++ b/acts/framework/acts/test_utils/bt/bt_test_utils.py
@@ -582,29 +582,6 @@
return profile_dict
-def log_energy_info(android_devices, state):
- """Logs energy info of input Android devices.
-
- Args:
- android_devices: input Android device list to log energy info from.
- state: the input state to log. Usually 'Start' or 'Stop' for logging.
-
- Returns:
- A logging string of the Bluetooth energy info reported.
- """
- return_string = "{} Energy info collection:\n".format(state)
- # Bug: b/31966929
- return return_string
- for d in android_devices:
- if (d.droid.getBuildModel() != "Nexus 5" or d.droid.getBuildModel() != "Nexus 4"):
-
- description = ("Device: {}\tEnergyStatus: {}\n".format(
- d.droid.getBuildSerial(),
- d.droid.bluetoothGetControllerActivityEnergyInfo(1)))
- return_string = return_string + description
- return return_string
-
-
def pair_pri_to_sec(pri_droid, sec_droid):
"""Pairs pri droid to sec droid.
diff --git a/acts/tests/google/ble/api/GattApiTest.py b/acts/tests/google/ble/api/GattApiTest.py
index 4edee1e..9955c67 100644
--- a/acts/tests/google/ble/api/GattApiTest.py
+++ b/acts/tests/google/ble/api/GattApiTest.py
@@ -19,7 +19,6 @@
from acts.controllers.android import SL4AAPIError
from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest
-from acts.test_utils.bt.bt_test_utils import log_energy_info
from acts.test_utils.bt.bt_test_utils import setup_multiple_devices_for_bt_test
@@ -33,13 +32,11 @@
return setup_multiple_devices_for_bt_test(self.android_devices)
def setup_test(self):
- self.log.debug(log_energy_info(self.android_devices, "Start"))
for a in self.android_devices:
a.ed.clear_all_events()
return True
def teardown_test(self):
- self.log.debug(log_energy_info(self.android_devices, "End"))
return True
@BluetoothBaseTest.bt_test_wrap
diff --git a/acts/tests/google/ble/beacon_tests/BeaconSwarmTest.py b/acts/tests/google/ble/beacon_tests/BeaconSwarmTest.py
index fa51d82..7055ed3 100644
--- a/acts/tests/google/ble/beacon_tests/BeaconSwarmTest.py
+++ b/acts/tests/google/ble/beacon_tests/BeaconSwarmTest.py
@@ -30,7 +30,6 @@
from acts.test_utils.bt.bt_test_utils import scan_result
from acts.test_utils.bt.bt_test_utils import generate_ble_advertise_objects
from acts.test_utils.bt.bt_test_utils import generate_ble_scan_objects
-from acts.test_utils.bt.bt_test_utils import log_energy_info
from acts.test_utils.bt.bt_test_utils import reset_bluetooth
from acts.test_utils.bt.bt_test_utils import setup_multiple_devices_for_bt_test
from acts.test_utils.bt.bt_test_utils import take_btsnoop_logs
@@ -47,14 +46,12 @@
self.scn_ad = self.android_devices[0]
def setup_test(self):
- self.log.debug(log_energy_info(self.android_devices, "Start"))
self.discovered_mac_address_list = []
for a in self.android_devices:
a.ed.clear_all_events()
return True
def teardown_test(self):
- self.log.debug(log_energy_info(self.android_devices, "End"))
reset_bluetooth([self.android_devices[0]])
return True
diff --git a/acts/tests/google/ble/gatt/GattConnectTest.py b/acts/tests/google/ble/gatt/GattConnectTest.py
index 3a53e8c..bc5606b 100644
--- a/acts/tests/google/ble/gatt/GattConnectTest.py
+++ b/acts/tests/google/ble/gatt/GattConnectTest.py
@@ -39,7 +39,6 @@
from acts.test_utils.bt.bt_gatt_utils import setup_gatt_descriptors
from acts.test_utils.bt.bt_gatt_utils import setup_multiple_services
from acts.test_utils.bt.bt_test_utils import get_mac_address_of_generic_advertisement
-from acts.test_utils.bt.bt_test_utils import log_energy_info
class GattConnectTest(BluetoothBaseTest):
@@ -61,7 +60,6 @@
self.adv_instances = []
def teardown_test(self):
- self.log.debug(log_energy_info(self.android_devices, "End"))
for bluetooth_gatt in self.bluetooth_gatt_list:
self.cen_ad.droid.gattClientClose(bluetooth_gatt)
for gatt_server in self.gatt_server_list:
diff --git a/acts/tests/google/ble/scan/BleBackgroundScanTest.py b/acts/tests/google/ble/scan/BleBackgroundScanTest.py
index 0f9cf76..4114239 100644
--- a/acts/tests/google/ble/scan/BleBackgroundScanTest.py
+++ b/acts/tests/google/ble/scan/BleBackgroundScanTest.py
@@ -24,7 +24,6 @@
from acts.test_utils.bt.bt_test_utils import bluetooth_off
from acts.test_utils.bt.bt_test_utils import bluetooth_on
from acts.test_utils.bt.bt_test_utils import cleanup_scanners_and_advertisers
-from acts.test_utils.bt.bt_test_utils import log_energy_info
from acts.test_utils.bt.bt_test_utils import generate_ble_advertise_objects
from acts.test_utils.bt.bt_test_utils import generate_ble_scan_objects
from acts.test_utils.bt.bt_test_utils import scan_result
@@ -45,7 +44,6 @@
self.adv_ad = self.android_devices[1]
def setup_test(self):
- self.log.debug(log_energy_info(self.android_devices, "Start"))
if (self.scn_ad.droid.bluetoothGetLeState() ==
BluetoothAdapterState.STATE_OFF.value):
self.scn_ad.droid.bluetoothEnableBLE()
@@ -55,7 +53,6 @@
return True
def teardown_test(self):
- self.log.debug(log_energy_info(self.android_devices, "End"))
cleanup_scanners_and_advertisers(
self.scn_ad, self.active_adv_callback_list, self.adv_ad,
self.active_adv_callback_list)
diff --git a/acts/tests/google/ble/scan/BleOnLostOnFoundTest.py b/acts/tests/google/ble/scan/BleOnLostOnFoundTest.py
index a9c95de..e65d266 100644
--- a/acts/tests/google/ble/scan/BleOnLostOnFoundTest.py
+++ b/acts/tests/google/ble/scan/BleOnLostOnFoundTest.py
@@ -26,7 +26,6 @@
from acts.test_utils.bt.BleEnum import ScanSettingsScanMode
from acts.test_utils.bt.bt_test_utils import adv_succ
from acts.test_utils.bt.bt_test_utils import cleanup_scanners_and_advertisers
-from acts.test_utils.bt.bt_test_utils import log_energy_info
from acts.test_utils.bt.bt_test_utils import reset_bluetooth
from acts.test_utils.bt.bt_test_utils import scan_result
@@ -43,7 +42,6 @@
self.adv_ad = self.android_devices[1]
def teardown_test(self):
- self.log.info(log_energy_info(self.android_devices, "End"))
cleanup_scanners_and_advertisers(
self.scn_ad, self.active_adv_callback_list, self.adv_ad,
self.active_adv_callback_list)
diff --git a/acts/tests/google/bt/RfcommTest.py b/acts/tests/google/bt/RfcommTest.py
index 47ec598..a61be5a 100644
--- a/acts/tests/google/bt/RfcommTest.py
+++ b/acts/tests/google/bt/RfcommTest.py
@@ -24,7 +24,6 @@
from queue import Empty
from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest
from acts.test_utils.bt.bt_test_utils import clear_bonded_devices
-from acts.test_utils.bt.bt_test_utils import log_energy_info
from acts.test_utils.bt.bt_test_utils import kill_bluetooth_process
from acts.test_utils.bt.bt_test_utils import orchestrate_rfcomm_connection
from acts.test_utils.bt.bt_test_utils import reset_bluetooth
@@ -58,7 +57,6 @@
for a in self.android_devices:
if not clear_bonded_devices(a):
return False
- self.log.debug(log_energy_info(self.android_devices, "Start"))
for a in self.android_devices:
a.ed.clear_all_events()
return True
@@ -66,7 +64,6 @@
def teardown_test(self):
self.client_ad.droid.bluetoothRfcommCloseClientSocket()
self.server_ad.droid.bluetoothRfcommCloseServerSocket()
- self.log.debug(log_energy_info(self.android_devices, "End"))
return True
def on_fail(self, test_name, begin_time):
diff --git a/acts/tests/google/bt/car_bt/BtCarHfpTest.py b/acts/tests/google/bt/car_bt/BtCarHfpTest.py
index 00fb14d..32726ad 100644
--- a/acts/tests/google/bt/car_bt/BtCarHfpTest.py
+++ b/acts/tests/google/bt/car_bt/BtCarHfpTest.py
@@ -65,18 +65,12 @@
def setup_test(self):
# Reset the devices.
- self.log.debug(
- bt_test_utils.log_energy_info(self.android_devices, "Start"))
for d in self.android_devices:
d.ed.clear_all_events()
def on_fail(self, test_name, begin_time):
self.log.debug("Test {} failed.".format(test_name))
- def teardown_test(self):
- self.log.debug(
- bt_test_utils.log_energy_info(self.android_devices, "End"))
-
@BluetoothBaseTest.bt_test_wrap
def test_default_calling_account(self):
"""
diff --git a/acts/tests/google/bt/car_bt/BtCarToggleTest.py b/acts/tests/google/bt/car_bt/BtCarToggleTest.py
index 12c3680..e284916 100644
--- a/acts/tests/google/bt/car_bt/BtCarToggleTest.py
+++ b/acts/tests/google/bt/car_bt/BtCarToggleTest.py
@@ -26,12 +26,8 @@
self.droid_ad = self.android_devices[0]
def setup_test(self):
- self.log.debug(log_energy_info(self.android_devices, "Start"))
self.droid_ad.ed.clear_all_events()
- def teardown_test(self):
- self.log.debug(log_energy_info(self.android_devices, "End"))
-
def on_fail(self, test_name, begin_time):
bt_test_utils.take_btsnoop_logs(self.android_devices, self, test_name)
diff --git a/acts/tests/google/bt/gatt/GattOverBrEdrTest.py b/acts/tests/google/bt/gatt/GattOverBrEdrTest.py
index aba2635..da558cc 100644
--- a/acts/tests/google/bt/gatt/GattOverBrEdrTest.py
+++ b/acts/tests/google/bt/gatt/GattOverBrEdrTest.py
@@ -34,7 +34,6 @@
from acts.test_utils.bt.bt_gatt_utils import setup_gatt_connection
from acts.test_utils.bt.bt_gatt_utils import setup_gatt_descriptors
from acts.test_utils.bt.bt_gatt_utils import setup_multiple_services
-from acts.test_utils.bt.bt_test_utils import log_energy_info
from acts.test_utils.bt.bt_test_utils import setup_multiple_devices_for_bt_test
from acts.test_utils.bt.bt_test_utils import take_btsnoop_logs
@@ -67,7 +66,6 @@
self.adv_instances = []
def teardown_test(self):
- self.log.debug(log_energy_info(self.android_devices, "End"))
for bluetooth_gatt in self.bluetooth_gatt_list:
self.cen_ad.droid.gattClientClose(bluetooth_gatt)
for gatt_server in self.gatt_server_list:
diff --git a/acts/tests/google/bt/system_tests/BtStressTest.py b/acts/tests/google/bt/system_tests/BtStressTest.py
index 791b6a1..0dd42dc 100644
--- a/acts/tests/google/bt/system_tests/BtStressTest.py
+++ b/acts/tests/google/bt/system_tests/BtStressTest.py
@@ -21,7 +21,6 @@
from acts.base_test import BaseTestClass
from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest
from acts.test_utils.bt.bt_test_utils import clear_bonded_devices
-from acts.test_utils.bt.bt_test_utils import log_energy_info
from acts.test_utils.bt.bt_test_utils import pair_pri_to_sec
from acts.test_utils.bt.bt_test_utils import reset_bluetooth
from acts.test_utils.bt.bt_test_utils import setup_multiple_devices_for_bt_test
diff --git a/acts/tests/google/bt/test_tools/BtReconnectTest.py b/acts/tests/google/bt/test_tools/BtReconnectTest.py
index 37bbbf6..01f6da5 100644
--- a/acts/tests/google/bt/test_tools/BtReconnectTest.py
+++ b/acts/tests/google/bt/test_tools/BtReconnectTest.py
@@ -36,13 +36,8 @@
def setup_test(self):
setup_result = reset_bluetooth(self.android_devices)
- self.log.debug(log_energy_info(self.android_devices, "Start"))
return setup_result
- def teardown_test(self):
- self.log.debug(log_energy_info(self.android_devices, "End"))
- return True
-
@BluetoothBaseTest.bt_test_wrap
def test_tool_reconnect(self):
droid, ed = self.android_devices[0].droid, self.android_devices[0].ed
diff --git a/acts/tests/google/bt/test_tools/ToolsTest.py b/acts/tests/google/bt/test_tools/ToolsTest.py
index d1a0aeb..345d44c 100644
--- a/acts/tests/google/bt/test_tools/ToolsTest.py
+++ b/acts/tests/google/bt/test_tools/ToolsTest.py
@@ -111,12 +111,3 @@
phone_number, generate_id_by_size(int(message_size)), False)
time.sleep(3)
return True
-
- @BluetoothBaseTest.bt_test_wrap
- def test_continuously_log_battery_stats(self):
- interval = input("Enter time interval to collect stats: ")
- while True:
- self.log.info(log_energy_info(
- [self.android_devices[0]], "Log_time: {}".format(time.time())))
- time.sleep(int(interval))
- return True