diff options
author | Paul Lawrence <paullawrence@google.com> | 2019-06-12 12:05:45 -0700 |
---|---|---|
committer | Paul Lawrence <paullawrence@google.com> | 2019-06-12 14:29:23 -0700 |
commit | 324bd6a5e46670451ebbdd7b02532a5c143691a4 (patch) | |
tree | 85aa6dd7e8e46b464dbcf8292b37e909980bd5eb | |
parent | 3f684a7f76db560eae79bc98f11fdd0edd96f805 (diff) | |
download | kernel-324bd6a5e46670451ebbdd7b02532a5c143691a4.tar.gz |
Add property to prevent commit for Vts test
Old approach (do not start class main) does not work because when
testings userdebug GSI on user system, adb does not start until the
framework starts.
Bug: 134126407
Test: Test passes with userdebug GSI on user Taimen
Change-Id: If6c667125f28fbe6a3765d9184943059acc611bb
-rw-r--r-- | checkpoint/VtsKernelCheckpointTest.py | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/checkpoint/VtsKernelCheckpointTest.py b/checkpoint/VtsKernelCheckpointTest.py index fdbaee62..e199e553 100644 --- a/checkpoint/VtsKernelCheckpointTest.py +++ b/checkpoint/VtsKernelCheckpointTest.py @@ -71,7 +71,7 @@ class VtsKernelCheckpointTest(base_test.BaseTestClass): try: self.dut.adb.wait_for_device(timeout=900) except self.dut.adb.AdbError as e: - fail("Exception thrown waiting for device:" + e.msg()) + asserts.fail("Exception thrown waiting for device:" + e.msg()) # Should not be necessary, but without these retries, test fails # regularly on taimen with Android Q @@ -89,6 +89,18 @@ class VtsKernelCheckpointTest(base_test.BaseTestClass): except: time.sleep(1) + def checkBooted(self): + for i in range(1, 900): + result = self.dut.adb.shell("getprop sys.boot_completed") + try: + boot_completed = int(result) + asserts.assertEqual(boot_completed, 1) + return + except: + time.sleep(1) + + asserts.fail("sys.boot_completed not set") + def testCheckpointEnabled(self): result = self.dut.adb.shell("getprop ro.product.first_api_level") try: @@ -102,10 +114,14 @@ class VtsKernelCheckpointTest(base_test.BaseTestClass): if not self.isCheckpoint_: return - # Create a file and initiate checkpoint self.dut.adb.root() - self.dut.adb.shell("setprop persist.init.dont_start_class.main 1") - self.dut.adb.shell("setprop persist.init.dont_start_class.late_start 1") + + # Make sure that we are fully booted so we don't get entangled in + # someone else's checkpoint + self.checkBooted() + + # Create a file and initiate checkpoint + self.dut.adb.shell("setprop persist.vold.dont_commit_checkpoint 1") self.dut.adb.shell("echo " + self._ORIGINALVALUE + " > " + self._CHECKPOINTTESTFILE) result = self.dut.adb.shell("vdc checkpoint startCheckpoint 1", no_except = True) asserts.assertEqual(result[const.EXIT_CODE], 0) @@ -120,10 +136,9 @@ class VtsKernelCheckpointTest(base_test.BaseTestClass): asserts.assertEqual(result.strip(), self._ORIGINALVALUE) # Clean up + self.dut.adb.shell("setprop persist.vold.dont_commit_checkpoint 0") result = self.dut.adb.shell("vdc checkpoint commitChanges", no_except = True) asserts.assertEqual(result[const.EXIT_CODE], 0) - self.dut.adb.shell("setprop persist.init.dont_start_class.main 0") - self.dut.adb.shell("setprop persist.init.dont_start_class.late_start 0") self.reboot() self.dut.adb.shell("rm " + self._CHECKPOINTTESTFILE) @@ -131,10 +146,14 @@ class VtsKernelCheckpointTest(base_test.BaseTestClass): if not self.isCheckpoint_: return - # Create a file and initiate checkpoint self.dut.adb.root() - self.dut.adb.shell("setprop persist.init.dont_start_class.main 1") - self.dut.adb.shell("setprop persist.init.dont_start_class.late_start 1") + + # Make sure that we are fully booted so we don't get entangled in + # someone else's checkpoint + self.checkBooted() + + # Create a file and initiate checkpoint + self.dut.adb.shell("setprop persist.vold.dont_commit_checkpoint 1") self.dut.adb.shell("echo " + self._ORIGINALVALUE + " > " + self._CHECKPOINTTESTFILE) result = self.dut.adb.shell("vdc checkpoint startCheckpoint 1", no_except = True) asserts.assertEqual(result[const.EXIT_CODE], 0) @@ -142,10 +161,9 @@ class VtsKernelCheckpointTest(base_test.BaseTestClass): # Modify the file and commit the checkpoint self.dut.adb.shell("echo " + self._MODIFIEDVALUE + " > " + self._CHECKPOINTTESTFILE) + self.dut.adb.shell("setprop persist.vold.dont_commit_checkpoint 0") result = self.dut.adb.shell("vdc checkpoint commitChanges", no_except = True) asserts.assertEqual(result[const.EXIT_CODE], 0) - self.dut.adb.shell("setprop persist.init.dont_start_class.main 0") - self.dut.adb.shell("setprop persist.init.dont_start_class.late_start 0") self.reboot() # Check file has changed |