diff options
author | Andres Celis <celisa@google.com> | 2017-10-21 00:29:08 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-10-21 00:29:08 +0000 |
commit | 4188de907920bed915eb1bdf059220c4f72691c8 (patch) | |
tree | 312097b6ca3739e5db7cb85ece4489b22612efe8 | |
parent | 65b6b2531b4c9acd2ec3140f0c93cc207eef7107 (diff) | |
parent | 2d7a3dca17e1743be43b5f4428cac41ff7e8b5fa (diff) | |
download | cts-4188de907920bed915eb1bdf059220c4f72691c8.tar.gz |
Merge "Fix for b/68051472" into nyc-dev am: 7d4643347f am: 1fe4b4022c am: 89d9036a9d
am: 2d7a3dca17
Change-Id: I2f1b98f1429b8a34e6600f72ab94312ab5b417ef
-rw-r--r-- | hostsidetests/security/src/android/security/cts/SecurityTestCase.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/hostsidetests/security/src/android/security/cts/SecurityTestCase.java b/hostsidetests/security/src/android/security/cts/SecurityTestCase.java index 88f22e9324d..2c11f58fc51 100644 --- a/hostsidetests/security/src/android/security/cts/SecurityTestCase.java +++ b/hostsidetests/security/src/android/security/cts/SecurityTestCase.java @@ -43,8 +43,9 @@ public class SecurityTestCase extends DeviceTestCase { public void setUp() throws Exception { super.setUp(); + String uptime = getDevice().executeShellCommand("cat /proc/uptime"); kernelStartTime = System.currentTimeMillis()/1000 - - Integer.parseInt(getDevice().executeShellCommand("cut -f1 -d. /proc/uptime").trim()); + Integer.parseInt(uptime.substring(0, uptime.indexOf('.'))); //TODO:(badash@): Watch for other things to track. // Specifically time when app framework starts } @@ -90,9 +91,10 @@ public class SecurityTestCase extends DeviceTestCase { @Override public void tearDown() throws Exception { getDevice().waitForDeviceOnline(60 * 1000); + String uptime = getDevice().executeShellCommand("cat /proc/uptime"); assertTrue("Phone has had a hard reset", (System.currentTimeMillis()/1000 - - Integer.parseInt(getDevice().executeShellCommand("cut -f1 -d. /proc/uptime").trim()) + Integer.parseInt(uptime.substring(0, uptime.indexOf('.'))) - kernelStartTime < 2)); //TODO(badash@): add ability to catch runtime restart getDevice().executeAdbCommand("unroot"); |