diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /testing/mozbase/mozdevice/adb_tests/test_device_running_adb_as_root.py | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/mozbase/mozdevice/adb_tests/test_device_running_adb_as_root.py')
-rw-r--r-- | testing/mozbase/mozdevice/adb_tests/test_device_running_adb_as_root.py | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/testing/mozbase/mozdevice/adb_tests/test_device_running_adb_as_root.py b/testing/mozbase/mozdevice/adb_tests/test_device_running_adb_as_root.py new file mode 100644 index 000000000..2b223bb04 --- /dev/null +++ b/testing/mozbase/mozdevice/adb_tests/test_device_running_adb_as_root.py @@ -0,0 +1,48 @@ +""" + This test is to test devices that adbd does not get started as root. + Specifically devices that have ro.secure == 1 and ro.debuggable == 1 + + Running this test case requires various reboots which makes it a + very slow test case to run. +""" +import unittest +import sys + +from mozdevice import DeviceManagerADB + + +class TestFileOperations(unittest.TestCase): + + def setUp(self): + dm = DeviceManagerADB() + dm.reboot(wait=True) + + def test_run_adb_as_root_parameter(self): + dm = DeviceManagerADB() + self.assertTrue(dm.processInfo("adbd")[2] != "root") + dm = DeviceManagerADB(runAdbAsRoot=True) + self.assertTrue(dm.processInfo("adbd")[2] == "root") + + def test_after_reboot_adb_runs_as_root(self): + dm = DeviceManagerADB(runAdbAsRoot=True) + self.assertTrue(dm.processInfo("adbd")[2] == "root") + dm.reboot(wait=True) + self.assertTrue(dm.processInfo("adbd")[2] == "root") + + def tearDown(self): + dm = DeviceManagerADB() + dm.reboot() + +if __name__ == "__main__": + dm = DeviceManagerADB() + if not dm.devices(): + print "There are no connected adb devices" + sys.exit(1) + else: + if not (int(dm._runCmd(["shell", "getprop", "ro.secure"]).output[0]) and + int(dm._runCmd(["shell", "getprop", "ro.debuggable"]).output[0])): + print "This test case is meant for devices with devices that start " \ + "adbd as non-root and allows for adbd to be restarted as root." + sys.exit(1) + + unittest.main() |