Snap for 7077657 from cf96cd8864323de5fca6ddaca7dedc179072d076 to r-keystone-qcom-release

Change-Id: I8bebb8298b5e526c56f80a3e82eb51b2dc1b91b0
diff --git a/api/proc/ProcMemInfoTest.py b/api/proc/ProcMemInfoTest.py
index 1b4652f..b1068b2 100644
--- a/api/proc/ProcMemInfoTest.py
+++ b/api/proc/ProcMemInfoTest.py
@@ -28,7 +28,7 @@
 def token_lu(text):
     return int(text)
 
-@with_pattern(r'(kB)?')
+@with_pattern(r'[ ]*(kB)?')
 def token_kb(text):
     return text
 
@@ -79,7 +79,7 @@
         lines = contents.split('\n')
         if lines[-1] != '':
             raise SyntaxError("missing final newline")
-        return [self.parse_line("{:name}: {:lu}{:^kb}", line,
+        return [self.parse_line("{:name}: {:lu}{:kb}", line,
             dict(name=token_name, lu=token_lu, kb=token_kb)) for line in lines[:-1]]
 
     def result_correct(self, parse_result):
diff --git a/api/sysfs/KernelApiSysfsTest.py b/api/sysfs/KernelApiSysfsTest.py
index a6b9949..2daa8e8 100644
--- a/api/sysfs/KernelApiSysfsTest.py
+++ b/api/sysfs/KernelApiSysfsTest.py
@@ -221,7 +221,12 @@
             self.ConvertToInteger(content)
 
     def testRtcHctosys(self):
-        '''Check that at least one rtc exists with hctosys = 1.'''
+        '''If RTC is present, check that at least one rtc exists with hctosys = 1.'''
+        rtcs = target_file_utils.FindFiles(self.shell, '/dev',
+                'rtc*', '-maxdepth 1')
+        if not rtcs:
+            return
+
         rtclist = target_file_utils.FindFiles(self.shell, '/sys/class/rtc',
                 'rtc*', '-maxdepth 1 -type l')
         for entry in rtclist:
diff --git a/checkpoint/Android.bp b/checkpoint/Android.bp
index c24ad1c..509ae8d 100644
--- a/checkpoint/Android.bp
+++ b/checkpoint/Android.bp
@@ -32,7 +32,7 @@
     test_suites: [
         "vts",
     ],
-    auto_gen_config: true,
+    test_config: "vts_kernel_checkpoint_test.xml",
     version: {
         py2: {
             enabled: false,
diff --git a/checkpoint/vts_kernel_checkpoint_test.xml b/checkpoint/vts_kernel_checkpoint_test.xml
new file mode 100644
index 0000000..55831c1
--- /dev/null
+++ b/checkpoint/vts_kernel_checkpoint_test.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<configuration description="Config to run vts_kernel_checkpoint_test unittests">
+    <test class="com.android.tradefed.testtype.python.PythonBinaryHostTest" >
+        <option name="par-file-name" value="vts_kernel_checkpoint_test" />
+        <option name="test-timeout" value="10m" />
+    </test>
+</configuration>
diff --git a/kheaders/vts_kernel_kheaders.cpp b/kheaders/vts_kernel_kheaders.cpp
index 3e902df..8b48e41 100644
--- a/kheaders/vts_kernel_kheaders.cpp
+++ b/kheaders/vts_kernel_kheaders.cpp
@@ -62,15 +62,15 @@
   ASSERT_EQ(0, uname(&buf));
 }
 
-TEST_F(KernelHeadersTest, ModuleExist) {
+TEST_F(KernelHeadersTest, KheadersExist) {
   struct stat st;
   struct utsname buf;
-  std::string path = "/vendor/lib/modules/kheaders.ko";
+  std::string path = "/sys/kernel/kheaders.tar.xz";
 
   uname(&buf);
   if (!should_run(buf)) return;
 
-  // Make sure the module exists
+  // Make sure the kheaders are available
   errno = 0;
   stat(path.c_str(), &st);
   ASSERT_EQ(0, (errno == ENOENT));