summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandroid-build-prod (mdb) <android-build-team-robot@google.com>2020-10-01 20:28:29 +0000
committerandroid-build-prod (mdb) <android-build-team-robot@google.com>2020-10-01 20:28:29 +0000
commit8854f186c3690ed2a1a0b284ae4e5eb444fe2c28 (patch)
treea7211e0d02fa3f40afb593dd471341f361997182
parent0daf8f5bbc66a3d1b92747cd0689a5d698046327 (diff)
parent2831e549a90cb8aca4f94e297273c2e3fba5650e (diff)
downloadplatform_test_vts-testcase_kernel-sdk-release.tar.gz
platform_test_vts-testcase_kernel-sdk-release.tar.bz2
platform_test_vts-testcase_kernel-sdk-release.zip
Snap for 6877830 from 2831e549a90cb8aca4f94e297273c2e3fba5650e to sdk-releasesdk-release
Change-Id: I18b41412a98a7ca027f7c8e1759d6e2ad2fc2434
-rw-r--r--api/binder/AndroidTest.xml38
-rw-r--r--api/binder/VtsKernelBinderTest.py81
-rw-r--r--api/binder/__init__.py0
-rw-r--r--api/bpf_native_test/BpfTest.cpp6
-rw-r--r--api/hwbinder/Android.bp19
-rw-r--r--api/hwbinder/VtsKernelHwBinderTest.py58
-rw-r--r--api/hwbinder/__init__.py0
-rw-r--r--api/proc/OWNERS2
-rw-r--r--api/proc/ProcMemInfoTest.py4
-rw-r--r--api/qtaguid/OWNERS3
-rw-r--r--api/selinux/OWNERS2
-rw-r--r--api/sysfs/KernelApiSysfsTest.py7
-rw-r--r--api/sysfs/OWNERS2
-rw-r--r--bow/Android.bp5
-rw-r--r--bow/BowTest.cpp2
-rw-r--r--bow/OWNERS2
-rw-r--r--checkpoint/Android.bp2
-rw-r--r--checkpoint/OWNERS2
-rw-r--r--checkpoint/vts_kernel_checkpoint_test.xml21
-rw-r--r--dynamic_partitions/OWNERS3
-rw-r--r--encryption/Android.bp1
-rw-r--r--encryption/Keymaster.h2
-rw-r--r--encryption/file_based_encryption_tests.cpp37
-rw-r--r--kheaders/vts_kernel_kheaders.cpp6
-rw-r--r--linux_kselftest/OWNERS2
-rw-r--r--ltp/OWNERS2
-rw-r--r--sdcardfs/Android.bp (renamed from api/binder/Android.bp)20
-rw-r--r--sdcardfs/AndroidTest.xml27
-rw-r--r--sdcardfs/src/com/android/sdcardfs/vts/SdcardfsTest.java62
-rw-r--r--toolchain/OWNERS2
-rw-r--r--virtual_ab/Android.bp5
-rw-r--r--virtual_ab/metadata_test.cpp26
-rw-r--r--zram/Android.bp47
-rw-r--r--zram/ZramTest.cpp68
-rw-r--r--zram/zram_module_test.xml (renamed from api/hwbinder/AndroidTest.xml)18
35 files changed, 349 insertions, 235 deletions
diff --git a/api/binder/AndroidTest.xml b/api/binder/AndroidTest.xml
deleted file mode 100644
index 7e49de3e..00000000
--- a/api/binder/AndroidTest.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2017 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 for VTS VtsKernelBinderTest.">
- <option name="config-descriptor:metadata" key="plan" value="vts-kernel" />
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.VtsFilePusher">
- <option name="abort-on-push-failure" value="false"/>
- <option name="push-group" value="HostDrivenTest.push"/>
- </target_preparer>
- <test class="com.android.tradefed.testtype.VtsMultiDeviceTest">
- <option name="test-module-name" value="VtsKernelBinderTest"/>
- <option name="test-case-path" value="vts/testcases/kernel/api/binder/VtsKernelBinderTest" />
- <option name="binary-test-source" value="_32bit::DATA/nativetest/binderSafeInterfaceTest/binderSafeInterfaceTest" />
- <option name="binary-test-source" value="_64bit::DATA/nativetest64/binderSafeInterfaceTest/binderSafeInterfaceTest" />
- <option name="binary-test-source" value="_IPC32_32bit::DATA/nativetest/binderLibTest_IPC_32/binderLibTest_IPC_32" />
- <option name="binary-test-source" value="_IPC64_32bit::DATA/nativetest/binderLibTest/binderLibTest" />
- <option name="binary-test-source" value="_IPC64_64bit::DATA/nativetest64/binderLibTest/binderLibTest" />
- <option name="binary-test-source" value="_IPC32_32bit::DATA/nativetest/binderDriverInterfaceTest_IPC_32/binderDriverInterfaceTest_IPC_32" />
- <option name="binary-test-source" value="_IPC64_32bit::DATA/nativetest/binderDriverInterfaceTest/binderDriverInterfaceTest" />
- <option name="binary-test-source" value="_IPC64_64bit::DATA/nativetest64/binderDriverInterfaceTest/binderDriverInterfaceTest" />
- <option name="binary-test-source" value="_32bit::DATA/nativetest/memunreachable_binder_test/memunreachable_binder_test" />
- <option name="binary-test-source" value="_64bit::DATA/nativetest64/memunreachable_binder_test/memunreachable_binder_test" />
- <option name="binary-test-type" value="gtest"/>
- <option name="test-timeout" value="10m"/>
- </test>
-</configuration>
diff --git a/api/binder/VtsKernelBinderTest.py b/api/binder/VtsKernelBinderTest.py
deleted file mode 100644
index 195f7dcd..00000000
--- a/api/binder/VtsKernelBinderTest.py
+++ /dev/null
@@ -1,81 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright (C) 2017 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.
-#
-
-# TODO(hsinyichen): delete this file when BINDER_IPC_32BIT is unsupported
-import gzip
-import logging
-import os
-import tempfile
-
-from vts.runners.host import asserts
-from vts.runners.host import test_runner
-from vts.testcases.template.gtest_binary_test import gtest_binary_test
-from vts.utils.python.controllers import adb
-from vts.utils.python.os import path_utils
-
-
-class VtsKernelBinderTest(gtest_binary_test.GtestBinaryTest):
- """Tests to verify kernel binder.
-
- Attributes:
- _dut: AndroidDevice, the device under test.
- _is_32: boolean, whether CONFIG_ANDROID_BINDER_IPC_32BIT=y.
- _BINDER_IPC_32BIT_LINE: the line enabling 32-bit binder interface in
- kernel config.
- _TAG_IPC32: the tag on 32-bit binder interface tests.
- _TAG_IPC64: the tag on 64-bit binder interface tests.
- """
- _BINDER_IPC_32BIT_LINE = "CONFIG_ANDROID_BINDER_IPC_32BIT=y\n"
- _TAG_IPC32 = "_IPC32_"
- _TAG_IPC64 = "_IPC64_"
-
- # @Override
- def setUpClass(self):
- """Checks if binder interface is 32-bit."""
- super(VtsKernelBinderTest, self).setUpClass()
- self._is_32 = None
- with tempfile.NamedTemporaryFile(delete=False) as temp_file:
- config_path = temp_file.name
- try:
- logging.info("Pull config.gz to %s", config_path)
- self._dut.adb.pull("/proc/config.gz", config_path)
- with gzip.GzipFile(config_path) as config_file:
- self._is_32 = (self._BINDER_IPC_32BIT_LINE in config_file)
- except (adb.AdbError, IOError) as e:
- logging.exception("Cannot read kernel config. Both 32 and 64-bit "
- "binder interface tests will be executed: %s", e)
- finally:
- os.remove(config_path)
- logging.info("BINDER_IPC_32BIT = %s", self._is_32)
-
- # @Override
- def RunTestCase(self, test_case):
- """Runs the test case corresponding to binder bitness.
-
- Args:
- test_case: GtestTestCase object
- """
- asserts.skipIf((self._TAG_IPC32 in test_case.tag and
- self._is_32 == False),
- "Skip tests for 32-bit binder interface.")
- asserts.skipIf(self._TAG_IPC64 in test_case.tag and self._is_32,
- "Skip tests for 64-bit binder interface.")
- super(VtsKernelBinderTest, self).RunTestCase(test_case)
-
-
-if __name__ == "__main__":
- test_runner.main()
diff --git a/api/binder/__init__.py b/api/binder/__init__.py
deleted file mode 100644
index e69de29b..00000000
--- a/api/binder/__init__.py
+++ /dev/null
diff --git a/api/bpf_native_test/BpfTest.cpp b/api/bpf_native_test/BpfTest.cpp
index 7e104a38..959322bd 100644
--- a/api/bpf_native_test/BpfTest.cpp
+++ b/api/bpf_native_test/BpfTest.cpp
@@ -222,15 +222,17 @@ class BpfRaceTest : public ::testing::Test {
TEST_F(BpfRaceTest, testRaceWithBarrier) {
SKIP_IF_BPF_NOT_SUPPORTED;
- swapAndCleanStatsMap(true, 60);
+ swapAndCleanStatsMap(true, 30);
}
// Confirm the race problem exists when the kernel doesn't call synchronize_rcu
// after changing the active map.
+// This test is flaky. Race not triggering isn't really a bug per say...
+// Maybe we should just outright delete this test...
TEST_F(BpfRaceTest, testRaceWithoutBarrier) {
SKIP_IF_BPF_NOT_SUPPORTED;
- swapAndCleanStatsMap(false, 60);
+ swapAndCleanStatsMap(false, 240);
}
} // namespace android
diff --git a/api/hwbinder/Android.bp b/api/hwbinder/Android.bp
deleted file mode 100644
index 443bfb9b..00000000
--- a/api/hwbinder/Android.bp
+++ /dev/null
@@ -1,19 +0,0 @@
-//
-// Copyright (C) 2017 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.
-//
-
-vts_config {
- name: "VtsKernelHwBinder",
-}
diff --git a/api/hwbinder/VtsKernelHwBinderTest.py b/api/hwbinder/VtsKernelHwBinderTest.py
deleted file mode 100644
index d5bc7cbf..00000000
--- a/api/hwbinder/VtsKernelHwBinderTest.py
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright (C) 2017 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.
-#
-
-import logging
-
-from vts.runners.host import asserts
-from vts.runners.host import base_test
-from vts.runners.host import const
-from vts.runners.host import test_runner
-from vts.utils.python.controllers import android_device
-from vts.utils.python.file import target_file_utils
-
-HWBINDER_PATH = "/dev/hwbinder"
-
-
-class VtsKernelHwBinderTest(base_test.BaseTestClass):
- """Test case to validate existence of hwbinder node.
- """
-
- def setUpClass(self):
- self.dut = self.android_devices[0]
- self.shell = self.dut.shell
-
- def testHwbinderExistence(self):
- """Checks that hwbinder node exists.
- """
- logging.info("Testing existence of %s", HWBINDER_PATH)
- asserts.assertTrue(
- target_file_utils.Exists(HWBINDER_PATH, self.shell),
- "%s: File does not exist." % HWBINDER_PATH)
-
- try:
- permissions = target_file_utils.GetPermission(
- HWBINDER_PATH, self.shell)
- asserts.assertTrue(
- target_file_utils.IsReadWrite(permissions),
- "%s: File has invalid permissions (%s)" % (HWBINDER_PATH,
- permissions))
- except (ValueError, IOError) as e:
- asserts.fail("Failed to assert permissions: %s" % str(e))
-
-
-if __name__ == "__main__":
- test_runner.main()
diff --git a/api/hwbinder/__init__.py b/api/hwbinder/__init__.py
deleted file mode 100644
index e69de29b..00000000
--- a/api/hwbinder/__init__.py
+++ /dev/null
diff --git a/api/proc/OWNERS b/api/proc/OWNERS
new file mode 100644
index 00000000..e4b9e91a
--- /dev/null
+++ b/api/proc/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 391836
+smuckle@google.com
diff --git a/api/proc/ProcMemInfoTest.py b/api/proc/ProcMemInfoTest.py
index 1b4652f9..b1068b20 100644
--- a/api/proc/ProcMemInfoTest.py
+++ b/api/proc/ProcMemInfoTest.py
@@ -28,7 +28,7 @@ def token_name(text):
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 @@ class ProcMemInfoTest(KernelProcFileTestBase.KernelProcFileTestBase):
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/qtaguid/OWNERS b/api/qtaguid/OWNERS
new file mode 100644
index 00000000..5b96ac27
--- /dev/null
+++ b/api/qtaguid/OWNERS
@@ -0,0 +1,3 @@
+# Bug component: 391836
+maze@google.com
+lorenzo@google.com
diff --git a/api/selinux/OWNERS b/api/selinux/OWNERS
new file mode 100644
index 00000000..e4b9e91a
--- /dev/null
+++ b/api/selinux/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 391836
+smuckle@google.com
diff --git a/api/sysfs/KernelApiSysfsTest.py b/api/sysfs/KernelApiSysfsTest.py
index a6b99492..2daa8e82 100644
--- a/api/sysfs/KernelApiSysfsTest.py
+++ b/api/sysfs/KernelApiSysfsTest.py
@@ -221,7 +221,12 @@ class KernelApiSysfsTest(base_test.BaseTestClass):
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/api/sysfs/OWNERS b/api/sysfs/OWNERS
new file mode 100644
index 00000000..e4b9e91a
--- /dev/null
+++ b/api/sysfs/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 391836
+smuckle@google.com
diff --git a/bow/Android.bp b/bow/Android.bp
index b9180502..4e1fb52f 100644
--- a/bow/Android.bp
+++ b/bow/Android.bp
@@ -34,4 +34,9 @@ cc_test {
"-Werror",
"-Wno-unused-variable",
],
+ test_suites: [
+ "vts",
+ ],
+ require_root: true,
+ auto_gen_config: true,
}
diff --git a/bow/BowTest.cpp b/bow/BowTest.cpp
index d358649a..5c7df88c 100644
--- a/bow/BowTest.cpp
+++ b/bow/BowTest.cpp
@@ -53,7 +53,7 @@ bool blockCheckpointsSupported() {
if (pid == 0) {
static const char* args[] = {"/system/bin/vdc", "checkpoint",
- "supportsBlockCheckpoint"};
+ "supportsBlockCheckpoint", 0};
EXPECT_NE(execv(args[0], const_cast<char* const*>(args)), -1);
}
diff --git a/bow/OWNERS b/bow/OWNERS
new file mode 100644
index 00000000..44b5b34e
--- /dev/null
+++ b/bow/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 391836
+paullawrence@google.com
diff --git a/checkpoint/Android.bp b/checkpoint/Android.bp
index c24ad1c1..509ae8d1 100644
--- a/checkpoint/Android.bp
+++ b/checkpoint/Android.bp
@@ -32,7 +32,7 @@ python_test_host {
test_suites: [
"vts",
],
- auto_gen_config: true,
+ test_config: "vts_kernel_checkpoint_test.xml",
version: {
py2: {
enabled: false,
diff --git a/checkpoint/OWNERS b/checkpoint/OWNERS
new file mode 100644
index 00000000..09595992
--- /dev/null
+++ b/checkpoint/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 391836
+howardsoc@google.com
diff --git a/checkpoint/vts_kernel_checkpoint_test.xml b/checkpoint/vts_kernel_checkpoint_test.xml
new file mode 100644
index 00000000..55831c13
--- /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/dynamic_partitions/OWNERS b/dynamic_partitions/OWNERS
new file mode 100644
index 00000000..999b1a89
--- /dev/null
+++ b/dynamic_partitions/OWNERS
@@ -0,0 +1,3 @@
+# Bug component: 391836
+elsk@google.com
+dvander@google.com
diff --git a/encryption/Android.bp b/encryption/Android.bp
index a67c9285..09e54ad3 100644
--- a/encryption/Android.bp
+++ b/encryption/Android.bp
@@ -36,6 +36,7 @@ cc_test {
"libkeymaster4_1support",
"libkeymaster4support",
"liblog",
+ "libutils",
],
static_libs: [
"libdm",
diff --git a/encryption/Keymaster.h b/encryption/Keymaster.h
index b3412621..6f86721e 100644
--- a/encryption/Keymaster.h
+++ b/encryption/Keymaster.h
@@ -68,7 +68,7 @@ class Keymaster {
const km::AuthorizationSet& inParams, std::string* newKey);
private:
- std::unique_ptr<KmDevice> mDevice;
+ android::sp<KmDevice> mDevice;
DISALLOW_COPY_AND_ASSIGN(Keymaster);
};
diff --git a/encryption/file_based_encryption_tests.cpp b/encryption/file_based_encryption_tests.cpp
index e3ee8f2f..528469e8 100644
--- a/encryption/file_based_encryption_tests.cpp
+++ b/encryption/file_based_encryption_tests.cpp
@@ -80,14 +80,6 @@
#define F2FS_IOC_SET_PIN_FILE _IOW(F2FS_IOCTL_MAGIC, 13, __u32)
#endif
-#ifndef FS_IOC_GET_ENCRYPTION_NONCE
-#define FS_IOC_GET_ENCRYPTION_NONCE _IOR('f', 27, __u8[16])
-#endif
-
-#ifndef FSCRYPT_POLICY_FLAG_IV_INO_LBLK_32
-#define FSCRYPT_POLICY_FLAG_IV_INO_LBLK_32 0x10
-#endif
-
namespace android {
namespace kernel {
@@ -1023,7 +1015,8 @@ TEST_F(FBEPolicyTest, TestHwWrappedKeyCorruption) {
// it applies regardless of the encryption format and key. Thus it runs even on
// old devices, including ones that used a vendor-specific encryption format.
TEST(FBETest, TestFileContentsRandomness) {
- constexpr const char *path = "/data/local/tmp/vts-test-file";
+ constexpr const char *path_1 = "/data/local/tmp/vts-test-file-1";
+ constexpr const char *path_2 = "/data/local/tmp/vts-test-file-2";
if (android::base::GetProperty("ro.crypto.type", "") != "file") {
// FBE has been required since Android Q.
@@ -1039,14 +1032,30 @@ TEST(FBETest, TestFileContentsRandomness) {
ASSERT_TRUE(GetFilesystemInfo("/data", &fs_info));
std::vector<uint8_t> zeroes(kTestFileBytes, 0);
- std::vector<uint8_t> ciphertext;
- ASSERT_TRUE(WriteTestFile(zeroes, path, fs_info.raw_blk_device, &ciphertext));
+ std::vector<uint8_t> ciphertext_1;
+ std::vector<uint8_t> ciphertext_2;
+ ASSERT_TRUE(
+ WriteTestFile(zeroes, path_1, fs_info.raw_blk_device, &ciphertext_1));
+ ASSERT_TRUE(
+ WriteTestFile(zeroes, path_2, fs_info.raw_blk_device, &ciphertext_2));
GTEST_LOG_(INFO) << "Verifying randomness of ciphertext";
- ASSERT_TRUE(VerifyDataRandomness(ciphertext));
-
- ASSERT_EQ(unlink(path), 0);
+ // Each individual file's ciphertext should be random.
+ ASSERT_TRUE(VerifyDataRandomness(ciphertext_1));
+ ASSERT_TRUE(VerifyDataRandomness(ciphertext_2));
+
+ // The files' ciphertext concatenated should also be random.
+ // I.e., each file should be encrypted differently.
+ std::vector<uint8_t> concatenated_ciphertext;
+ concatenated_ciphertext.insert(concatenated_ciphertext.end(),
+ ciphertext_1.begin(), ciphertext_1.end());
+ concatenated_ciphertext.insert(concatenated_ciphertext.end(),
+ ciphertext_2.begin(), ciphertext_2.end());
+ ASSERT_TRUE(VerifyDataRandomness(concatenated_ciphertext));
+
+ ASSERT_EQ(unlink(path_1), 0);
+ ASSERT_EQ(unlink(path_2), 0);
}
} // namespace kernel
diff --git a/kheaders/vts_kernel_kheaders.cpp b/kheaders/vts_kernel_kheaders.cpp
index 3e902df2..8b48e41f 100644
--- a/kheaders/vts_kernel_kheaders.cpp
+++ b/kheaders/vts_kernel_kheaders.cpp
@@ -62,15 +62,15 @@ TEST_F(KernelHeadersTest, UnameWorks) {
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));
diff --git a/linux_kselftest/OWNERS b/linux_kselftest/OWNERS
new file mode 100644
index 00000000..e4b9e91a
--- /dev/null
+++ b/linux_kselftest/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 391836
+smuckle@google.com
diff --git a/ltp/OWNERS b/ltp/OWNERS
new file mode 100644
index 00000000..e4b9e91a
--- /dev/null
+++ b/ltp/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 391836
+smuckle@google.com
diff --git a/api/binder/Android.bp b/sdcardfs/Android.bp
index 677aeb78..69e07d61 100644
--- a/api/binder/Android.bp
+++ b/sdcardfs/Android.bp
@@ -1,5 +1,4 @@
-//
-// Copyright (C) 2017 The Android Open Source Project
+// 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.
@@ -14,6 +13,19 @@
// limitations under the License.
//
-vts_config {
- name: "VtsKernelBinderTest",
+java_test_host {
+ name: "SdcardfsTest",
+ libs: [
+ "compatibility-host-util",
+ "tradefed",
+ ],
+
+ static_libs: [
+ "platform-test-annotations-host",
+ ],
+
+ srcs: ["src/**/*.java"],
+ test_suites: [
+ "vts",
+ ],
}
diff --git a/sdcardfs/AndroidTest.xml b/sdcardfs/AndroidTest.xml
new file mode 100644
index 00000000..cb78f02d
--- /dev/null
+++ b/sdcardfs/AndroidTest.xml
@@ -0,0 +1,27 @@
+<?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="Runs SdcardfsTest to verify sdcardfs not mounted">
+ <option name="test-suite-tag" value="apct" />
+ <option name="test-suite-tag" value="apct-junit" />
+ <object type="module_controller" class="com.android.tradefed.testtype.suite.module.MinApiLevelModuleController">
+ <option name="min-api-level" value="30" />
+ <option name="api-level-prop" value="ro.product.first_api_level" />
+ </object>
+ <test class="com.android.tradefed.testtype.HostTest" >
+ <option name="jar" value="SdcardfsTest.jar" />
+ </test>
+</configuration>
diff --git a/sdcardfs/src/com/android/sdcardfs/vts/SdcardfsTest.java b/sdcardfs/src/com/android/sdcardfs/vts/SdcardfsTest.java
new file mode 100644
index 00000000..9834be11
--- /dev/null
+++ b/sdcardfs/src/com/android/sdcardfs/vts/SdcardfsTest.java
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ */
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import com.android.tradefed.log.LogUtil.CLog;
+import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
+import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
+import com.android.tradefed.util.CommandResult;
+import com.android.tradefed.util.CommandStatus;
+import java.util.Scanner;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(DeviceJUnit4ClassRunner.class)
+public final class SdcardfsTest extends BaseHostJUnit4Test {
+ public static final String TAG = SdcardfsTest.class.getSimpleName();
+
+ private static final int MIN_KERNEL_MAJOR = 5;
+ private static final int MIN_KERNEL_MINOR = 4;
+
+ private boolean should_run(String str) {
+ Scanner versionScanner = new Scanner(str).useDelimiter("\\.");
+ int major = versionScanner.nextInt();
+ int minor = versionScanner.nextInt();
+ if (major > MIN_KERNEL_MAJOR)
+ return true;
+ if (major < MIN_KERNEL_MAJOR)
+ return false;
+ return minor >= MIN_KERNEL_MINOR;
+ }
+
+ @Test
+ public void testSdcardfsNotPresent() throws Exception {
+ CommandResult result = getDevice().executeShellV2Command("uname -r");
+ assertEquals(result.getStatus(), CommandStatus.SUCCESS);
+ if (!should_run(result.getStdout()))
+ return;
+ String cmd = "mount | grep \"type sdcardfs\"";
+ CLog.i("Invoke shell command [" + cmd + "]");
+ try {
+ String output = getDevice().executeShellCommand(cmd);
+ assertEquals("Found sdcardfs entries:" + output, output, "");
+ } catch (Exception e) {
+ fail("Could not run command [" + cmd + "] (" + e.getMessage() + ")");
+ }
+ }
+}
diff --git a/toolchain/OWNERS b/toolchain/OWNERS
new file mode 100644
index 00000000..fdac2a8a
--- /dev/null
+++ b/toolchain/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 391836
+ndesaulniers@google.com
diff --git a/virtual_ab/Android.bp b/virtual_ab/Android.bp
index d8fe7ac4..91a1f89c 100644
--- a/virtual_ab/Android.bp
+++ b/virtual_ab/Android.bp
@@ -31,6 +31,11 @@ cc_test {
],
static_libs: [
"libbase",
+ "libfstab",
+ "liblog",
+ ],
+ header_libs: [
+ "libstorage_literals_headers",
],
}
diff --git a/virtual_ab/metadata_test.cpp b/virtual_ab/metadata_test.cpp
index 7a4576cf..993f9d76 100644
--- a/virtual_ab/metadata_test.cpp
+++ b/virtual_ab/metadata_test.cpp
@@ -14,9 +14,12 @@
* limitations under the License.
*/
-#include <gtest/gtest.h>
#include <sys/statfs.h>
+#include <android-base/stringprintf.h>
+#include <fstab/fstab.h>
+#include <gtest/gtest.h>
+
static constexpr const char kMetadata[] = "/metadata";
TEST(Metadata, IsExt4) {
@@ -25,3 +28,24 @@ TEST(Metadata, IsExt4) {
<< "Cannot statfs " << kMetadata << ": " << strerror(errno);
ASSERT_EQ(EXT4_SUPER_MAGIC, buf.f_type);
}
+
+TEST(Metadata, FstabEntryFlagsAreSet) {
+ android::fs_mgr::Fstab fstab;
+ ASSERT_TRUE(android::fs_mgr::ReadDefaultFstab(&fstab));
+
+ auto metadata_entry =
+ android::fs_mgr::GetEntryForMountPoint(&fstab, kMetadata);
+ ASSERT_NE(metadata_entry, nullptr)
+ << "Cannot find fstab entry for " << kMetadata;
+
+ const char* message_fmt = "Fstab entry for /metadata must have %s flag set.";
+
+ EXPECT_TRUE(metadata_entry->fs_mgr_flags.check)
+ << android::base::StringPrintf(message_fmt, "check");
+ EXPECT_TRUE(metadata_entry->fs_mgr_flags.formattable)
+ << android::base::StringPrintf(message_fmt, "formattable");
+ EXPECT_TRUE(metadata_entry->fs_mgr_flags.first_stage_mount)
+ << android::base::StringPrintf(message_fmt, "first_stage_mount");
+ EXPECT_TRUE(metadata_entry->fs_mgr_flags.wait)
+ << android::base::StringPrintf(message_fmt, "wait");
+}
diff --git a/zram/Android.bp b/zram/Android.bp
new file mode 100644
index 00000000..7e062faf
--- /dev/null
+++ b/zram/Android.bp
@@ -0,0 +1,47 @@
+//
+// 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.
+//
+
+cc_defaults {
+ name: "binary_zram_defaults",
+ srcs: ["ZramTest.cpp"],
+ shared_libs: [
+ "libbase",
+ ],
+ cflags: [
+ "-fno-strict-aliasing",
+ "-Wall",
+ "-Werror",
+ "-Wno-unused-variable",
+ ],
+}
+
+cc_test {
+ name: "zram_module_test",
+ defaults: ["binary_zram_defaults"],
+ test_config: "zram_module_test.xml",
+ test_suites: [
+ "vts",
+ ],
+}
+
+cc_test {
+ name: "vts_test_binary_zram_module",
+ defaults: ["binary_zram_defaults"],
+}
+
+vts_config {
+ name: "VtsKernelZramTest",
+}
diff --git a/zram/ZramTest.cpp b/zram/ZramTest.cpp
new file mode 100644
index 00000000..317d7333
--- /dev/null
+++ b/zram/ZramTest.cpp
@@ -0,0 +1,68 @@
+/*
+ * 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 requied 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.
+ *
+ */
+
+#include <android-base/parseint.h>
+#include <android-base/strings.h>
+#include <gtest/gtest.h>
+
+#include <algorithm>
+#include <fstream>
+
+using android::base::ParseInt;
+using android::base::Split;
+
+namespace android {
+
+enum swap_fields {
+ SWAP_FILENAME = 0,
+ SWAP_TYPE = 1,
+ SWAP_SIZE = 2,
+ SWAP_USED = 3,
+ SWAP_PRIORITY = 4,
+ SWAP_NUM = 5,
+};
+
+TEST(ZramTest, hasZramSwap) {
+ const char* procSwapsPath = "/proc/swaps";
+ const char* swapFilename = "/dev/block/zram0";
+ int64_t swapSize;
+ std::string delimiters = "\t ";
+ std::ifstream ifs(procSwapsPath);
+ std::string line;
+
+ // Discard the header (first line)
+ if (!std::getline(ifs, line)) {
+ FAIL() << "Failed to read /proc/swaps.";
+ }
+
+ if (!std::getline(ifs, line)) {
+ FAIL() << "No swaps found.";
+ }
+
+ std::vector<std::string> data = Split(line, delimiters);
+ // Remove empty strings
+ data.erase(std::remove_if(data.begin(), data.end(),
+ [](const std::string& x) { return x.empty(); }),
+ data.end());
+
+ ASSERT_EQ(SWAP_NUM, data.size()) << "Unexpected format in /proc/swaps.";
+ ASSERT_STREQ(swapFilename, data[SWAP_FILENAME].c_str())
+ << "No zram device found.";
+ ParseInt(data[SWAP_SIZE], &swapSize);
+ ASSERT_GE(swapSize, 0) << "No swap space on zram0.";
+}
+} // namespace android
diff --git a/api/hwbinder/AndroidTest.xml b/zram/zram_module_test.xml
index 40b876b7..711a6687 100644
--- a/api/hwbinder/AndroidTest.xml
+++ b/zram/zram_module_test.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2017 The Android Open Source Project
+<!-- 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.
@@ -13,14 +13,14 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<configuration description="Config for VTS VtsKernelBinderTest.">
- <option name="config-descriptor:metadata" key="plan" value="vts-kernel" />
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.VtsFilePusher">
- <option name="push-group" value="HostDrivenTest.push"/>
+<configuration description="Config for zram_module_test">
+ <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer"/>
+ <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
+ <option name="cleanup" value="true" />
+ <option name="push" value="zram_module_test->/data/local/tmp/zram_module_test" />
</target_preparer>
- <test class="com.android.tradefed.testtype.VtsMultiDeviceTest">
- <option name="test-module-name" value="VtsKernelHwBinder"/>
- <option name="test-case-path" value="vts/testcases/kernel/api/hwbinder/VtsKernelHwBinderTest" />
- <option name="test-timeout" value="1m"/>
+ <test class="com.android.tradefed.testtype.GTest" >
+ <option name="native-test-device-path" value="/data/local/tmp" />
+ <option name="module-name" value="zram_module_test" />
</test>
</configuration>