Merge "VTS test for xt_qtaguid module"
diff --git a/api/libcutils/Android.mk b/api/libcutils/Android.mk
new file mode 100644
index 0000000..24254d9
--- /dev/null
+++ b/api/libcutils/Android.mk
@@ -0,0 +1,22 @@
+#
+# 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.
+#
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := VtsKernelLibcutilsTest
+include test/vts/tools/build/Android.host_config.mk
diff --git a/api/libcutils/AndroidTest.xml b/api/libcutils/AndroidTest.xml
new file mode 100644
index 0000000..da75eec
--- /dev/null
+++ b/api/libcutils/AndroidTest.xml
@@ -0,0 +1,29 @@
+<?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 VtsKernelLibcutilsTest.">
+ <target_preparer class="com.android.compatibility.common.tradefed.targetprep.VtsFilePusher">
+ <option name="abort-on-push-failure" value="false"/>
+ <option name="push-group" value="HalHidlTargetTest.push"/>
+ </target_preparer>
+ <target_preparer class="com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer"/>
+ <test class="com.android.tradefed.testtype.VtsMultiDeviceTest">
+ <option name="test-module-name" value="VtsKernelLibcutilsTest"/>
+ <option name="binary-test-source" value="_32bit::DATA/nativetest/libcutils_test/libcutils_test32" />
+ <option name="binary-test-source" value="_64bit::DATA/nativetest64/libcutils_test/libcutils_test64" />
+ <option name="binary-test-type" value="gtest"/>
+ <option name="test-timeout" value="10m"/>
+ </test>
+</configuration>
diff --git a/api/proc/AndroidTest.xml b/api/proc/AndroidTest.xml
index 1478713..e7fc357 100644
--- a/api/proc/AndroidTest.xml
+++ b/api/proc/AndroidTest.xml
@@ -15,9 +15,10 @@
-->
<configuration description="Config for VTS KernelApiTest test cases">
<target_preparer class="com.android.compatibility.common.tradefed.targetprep.VtsFilePusher">
- <option name="push-group" value="HidlHalTest.push" />
+ <option name="push-group" value="HostDrivenTest.push" />
</target_preparer>
<target_preparer class="com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer">
+ <option name="dep-module" value="ply" />
</target_preparer>
<test class="com.android.tradefed.testtype.VtsMultiDeviceTest">
<option name="test-module-name" value="KernelProcFileApiTest" />
diff --git a/api/proc/KernelProcFileApiTest.py b/api/proc/KernelProcFileApiTest.py
index ae4a429..660f976 100644
--- a/api/proc/KernelProcFileApiTest.py
+++ b/api/proc/KernelProcFileApiTest.py
@@ -15,23 +15,92 @@
# limitations under the License.
#
+import gzip
import logging
+import os
+import shutil
+import tempfile
from vts.runners.host import asserts
-from vts.runners.host import base_test_with_webdb
+from vts.runners.host import base_test
from vts.runners.host import const
from vts.runners.host import test_runner
+from vts.testcases.kernel.api.proc import required_kernel_configs as configs
from vts.utils.python.controllers import android_device
+from ProcMemInfoTest import ProcMemInfoTest
+from ProcZoneInfoTest import ProcZoneInfoTest
+from ProcShowUidStatTest import ProcShowUidStatTest
+from ProcCpuInfoTest import ProcCpuInfoTest
+from ProcStatTest import ProcStatTest
+from ProcVmallocInfoTest import ProcVmallocInfoTest
+from ProcRemoveUidRangeTest import ProcRemoveUidRangeTest
+from ProcQtaguidCtrlTest import ProcQtaguidCtrlTest
+from ProcMapsTest import ProcMapsTest
+from ProcSimpleFileTests import ProcKptrRestrictTest
+from ProcSimpleFileTests import ProcMmapMinAddrTest
+from ProcSimpleFileTests import ProcMmapRndBitsTest
+from ProcSimpleFileTests import ProcMmapRndCompatBitsTest
+from ProcSimpleFileTests import ProcOverCommitMemoryTest
+from ProcSimpleFileTests import ProcRandomizeVaSpaceTest
-class KernelProcFileApiTest(base_test_with_webdb.BaseTestWithWebDbClass):
- """Test cases which check content of proc files."""
+TEST_OBJECTS = {
+ ProcMemInfoTest(),
+ ProcZoneInfoTest(),
+ ProcShowUidStatTest(),
+ ProcCpuInfoTest(),
+ ProcStatTest(),
+ ProcVmallocInfoTest(),
+ ProcKptrRestrictTest(),
+ ProcRandomizeVaSpaceTest(),
+ ProcMmapMinAddrTest(),
+ ProcMmapRndBitsTest(),
+ ProcMmapRndCompatBitsTest(),
+ ProcOverCommitMemoryTest(),
+ ProcRemoveUidRangeTest(),
+ ProcQtaguidCtrlTest(),
+ ProcMapsTest(),
+}
+
+class KernelProcFileApiTest(base_test.BaseTestClass):
+ """Test cases which check content of proc files.
+
+ Attributes:
+ _temp_dir: The temporary directory to which /proc/config.gz is copied.
+ """
+
+ PROC_FILE_PATH = "/proc/config.gz"
def setUpClass(self):
self.dut = self.registerController(android_device)[0]
self.dut.shell.InvokeTerminal(
"KernelApiTest") # creates a remote shell instance.
self.shell = self.dut.shell.KernelApiTest
+ self._temp_dir = tempfile.mkdtemp()
+
+ def runProcFileTest(self, test_object):
+ """Reads from the file and checks that it parses and the content is valid.
+
+ Args:
+ test_object: inherits KernelProcFileTestBase, contains the test functions
+ """
+ logging.info("Testing format of %s" % (test_object.get_path()))
+ asserts.assertTrue(
+ test_object.prepare_test(self.shell), "Setup failed!")
+
+ file_content = self.ReadFileContent(test_object.get_path())
+ try:
+ parse_result = test_object.parse_contents(file_content)
+ except SyntaxError as e:
+ asserts.fail("Failed to parse! " + str(e))
+ asserts.assertTrue(
+ test_object.result_correct(parse_result), "Results not valid!")
+
+ def generateProcFileTests(self):
+ """Run all proc file tests."""
+ self.runGeneratedTests(test_func=self.runProcFileTest,
+ settings=TEST_OBJECTS,
+ name_func=lambda test_obj: "test" + test_obj.__class__.__name__)
def ReadFileContent(self, filepath):
"""Read the content of a file and perform assertions.
@@ -40,51 +109,57 @@
filepath: string, path to file
Returns:
- string, content of file"""
+ string, content of file
+ """
cmd = "cat %s" % filepath
results = self.shell.Execute(cmd)
logging.info("%s: Shell command '%s' results: %s", filepath, cmd,
results)
# checks the exit code
- asserts.assertEqual(results[const.EXIT_CODE][0], 0,
- "%s: Error happened while reading the file." %
- filepath)
+ asserts.assertEqual(
+ results[const.EXIT_CODE][0], 0,
+ "%s: Error happened while reading the file." % filepath)
return results[const.STDOUT][0]
- def ConvertToInteger(self, text):
- """Check whether a given text is interger.
+ def testCheckConfigs(self):
+ """Ensures all options from android-base.cfg are enabled."""
+ self.dut.adb.pull("%s %s" % (self.PROC_FILE_PATH, self._temp_dir))
+ logging.info("Adb pull %s to %s", self.PROC_FILE_PATH, self._temp_dir)
- Args:
- text, string
+ localpath = os.path.join(self._temp_dir, "config.gz")
+ with gzip.open(localpath, 'rb') as f:
+ device_config_lines = [line.rstrip("\n") for line in f.readlines()]
- Returns:
- bool, True if is integer
- """
- try:
- return int(text)
- except:
- asserts.fail("Content '%s' is not integer" % text)
+ device_configs = dict()
+ for line in device_config_lines:
+ if line == "" or line.startswith("#"):
+ continue
+ config_name, config_state = line.split("=", 1)
+ device_configs[config_name] = config_state
- def testMmapRndBitsAndMmapRndBits(self):
- """Check the value of /proc/sys/vm/mmap_rnd_bits."""
- filepath = "/proc/sys/vm/mmap_rnd_bits"
- content = self.ReadFileContent(filepath)
- value = self.ConvertToInteger(content)
+ should_be_enabled = []
+ should_not_be_set = []
+ for config_name, config_state in configs.CONFIGS.iteritems():
+ if (config_state == "y" and
+ (config_name not in device_configs or
+ device_configs[config_name] not in ("y", "m"))):
+ should_be_enabled.append(config_name)
+ elif config_state == "n" and config_name in device_configs:
+ should_not_be_set.append(config_name + "=" +
+ device_configs[config_name])
+
asserts.assertTrue(
- value >= 8, "%s: bits of mmap_rnd_bits '%s' should be higher than 8"
- % (filepath, value))
+ len(should_be_enabled) == 0 and len(should_not_be_set) == 0,
+ ("The following kernel configs should be enabled: [%s].\n"
+ "The following kernel configs should not be set: [%s]") %
+ (", ".join(should_be_enabled), ", ".join(should_not_be_set)))
- def testMmapRndBitsAndMmapRndCompatBits(self):
- """Check the value of /proc/sys/vm/mmap_rnd_bits."""
- filepath = "/proc/sys/vm/mmap_rnd_compat_bits"
- content = self.ReadFileContent(filepath)
- value = self.ConvertToInteger(content)
- asserts.assertTrue(
- value >= 8,
- "%s: bits of mmap_rnd_compat_bits '%s' should be higher than 8" %
- (filepath, value))
+ def tearDownClass(self):
+ """Deletes the temporary directory."""
+ logging.info("Delete %s", self._temp_dir)
+ shutil.rmtree(self._temp_dir)
if __name__ == "__main__":
diff --git a/api/proc/KernelProcFileTestBase.py b/api/proc/KernelProcFileTestBase.py
new file mode 100644
index 0000000..ce4fe54
--- /dev/null
+++ b/api/proc/KernelProcFileTestBase.py
@@ -0,0 +1,157 @@
+#!/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 os
+import sys
+from ply import lex
+from ply import yacc
+
+
+def repeat_rule(to_repeat, zero_ok=False):
+ '''
+ From a given rule, generates a rule that allows consecutive items
+ of that rule. Instances are collected in a list.
+ '''
+
+ def p_multiple(self, p):
+ if len(p) == 2 and zero_ok:
+ p[0] = []
+ elif len(p) == 2:
+ p[0] = [p[1]]
+ else:
+ p[0] = p[1] + [p[2]]
+
+ func = p_multiple
+ format_tuple = (to_repeat, to_repeat, to_repeat, 'empty'
+ if zero_ok else to_repeat)
+ func.__doc__ = '%ss : %ss %s \n| %s' % format_tuple
+ return func
+
+
+def literal_token(tok):
+ '''
+ A compact function to specify literal string tokens when.
+ they need to take precedence over a generic string,
+ Among these tokens precedence is decided in alphabetic order.
+ '''
+
+ def t_token(self, t):
+ return t
+
+ func = t_token
+ func.__doc__ = tok
+ return func
+
+
+class KernelProcFileTestBase(object):
+ """
+ An abstract test for the formatting of a procfs file. Individual
+ files can inherit from this class.
+
+ New parsing rules can be defined in the form of p_RULENAME, and
+ similarly new tokens can be defined as t_TOKENNAME.
+
+ Child class should also specify a `start` variable to give the starting rule.
+ """
+
+ def t_HEX_LITERAL(self, t):
+ r'0x[a-f0-9]+'
+ t.value = int(t.value, 0)
+ return t
+
+ def t_FLOAT(self, t):
+ r'([0-9]+[.][0-9]*|[0-9]*[.][0-9]+)'
+ t.value = float(t.value)
+ return t
+
+ def t_NUMBER(self, t):
+ r'\d+'
+ t.value = int(t.value)
+ return t
+
+ t_PATH = r'/[^\0]+'
+ t_COLON = r':'
+ t_EQUALS = r'='
+ t_COMMA = r','
+ t_STRING = r'[a-zA-Z\(\)_0-9\-@]+'
+
+ t_TAB = r'\t'
+ t_SPACE = r'[ ]'
+
+ def t_DASH(self, t):
+ r'\-'
+ return t
+
+ def t_NEWLINE(self, t):
+ r'\n'
+ t.lexer.lineno += len(t.value)
+ return t
+
+ t_ignore = ''
+
+ def t_error(self, t):
+ raise SyntaxError("Illegal character '%s' in line %d '%s'" % \
+ (t.value[0], t.lexer.lineno, t.value.split()[0]))
+
+ p_SPACEs = repeat_rule('SPACE', zero_ok=True)
+
+ def p_error(self, p):
+ raise SyntaxError("Parsing error at token %s in line %d" %
+ (p, p.lexer.lineno))
+
+ def p_empty(self, p):
+ 'empty :'
+ pass
+
+ def __init__(self):
+ self.tokens = [
+ t_name[2:] for t_name in dir(self)
+ if len(t_name) > 2 and t_name[:2] == 't_'
+ ]
+ self.tokens.remove('error')
+ self.tokens.remove('ignore')
+ self.lexer = lex.lex(module=self)
+ # (Change logger output stream if debugging)
+ self.parser = yacc.yacc(module=self, write_tables=False, \
+ errorlog=yacc.PlyLogger(sys.stderr)) #open(os.devnull, 'w')))
+
+ def parse_contents(self, file_contents):
+ """
+ Using the internal parser, parse the contents and return a structure
+ constructed according to the parsing rules
+ """
+ return self.parser.parse(file_contents, lexer=self.lexer)
+
+ def get_path(self):
+ """
+ Return the full path of this proc file.
+ """
+ return ""
+
+ def prepare_test(self, shell):
+ """
+ Performs any actions necessary before testing the proc file.
+ Return True if successful.
+ """
+ return True
+
+ def result_correct(self, parse_result):
+ """
+ Return True if the parsed result meets the requirements for the
+ proc file.
+ """
+ return True
diff --git a/api/proc/ProcCpuInfoTest.py b/api/proc/ProcCpuInfoTest.py
new file mode 100644
index 0000000..b18d50c
--- /dev/null
+++ b/api/proc/ProcCpuInfoTest.py
@@ -0,0 +1,76 @@
+#
+# 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 KernelProcFileTestBase
+from KernelProcFileTestBase import repeat_rule, literal_token
+
+
+class ProcCpuInfoTest(KernelProcFileTestBase.KernelProcFileTestBase):
+ '''/proc/cpuinfo displays a collection of cpu and architecture specific items.
+
+ The file consists of multiple lines of 'identifier : values' where
+ 'identifier' is a space separated name that can end in some tabs, and
+ 'values' are space separated items that can also in in a space.
+ Extra newlines are allowed between normal lines.
+ '''
+
+ EXPECTED_FIELDS = [
+ ['Features', ['\t']],
+ ['processor', ['\t']],
+ ['CPU', 'architecture', []],
+ ]
+
+ start = 'lines'
+
+ # Any character except for ':' and whitespace is allowed
+ t_STRING = r'[^:^ ^\t^\n]+'
+
+ # Numbers and literals are tokenized as strings instead
+ t_NUMBER = r'[0-9]+'
+ t_HEX_LITERAL = r'[0-9a-f]+'
+
+ p_lines = repeat_rule('line')
+ p_string_spaces = repeat_rule('string_space', zero_ok=True)
+ p_space_items = repeat_rule('space_item', zero_ok=True)
+ p_TABs = repeat_rule('TAB', zero_ok=True)
+
+ def p_line(self, p):
+ '''line : string_spaces STRING TABs COLON space_items SPACE NEWLINE
+ | string_spaces STRING TABs COLON space_items NEWLINE
+ | NEWLINE'''
+ if len(p) == 2:
+ p[0] = []
+ return
+ p[0] = [p[1] + [p[2], p[3]], p[5], p[6]]
+
+ def p_space_item(self, p):
+ 'space_item : SPACE STRING'
+ p[0] = p[2]
+
+ def p_string_space(self, p):
+ 'string_space : STRING SPACE'
+ p[0] = p[1]
+
+ def result_correct(self, parse_result):
+ expected_fields = self.EXPECTED_FIELDS[:]
+ for line in parse_result:
+ if len(line) > 0:
+ if line[0] in expected_fields:
+ expected_fields.remove(line[0])
+ return len(expected_fields) == 0
+
+ def get_path(self):
+ return "/proc/cpuinfo"
diff --git a/api/proc/ProcMapsTest.py b/api/proc/ProcMapsTest.py
new file mode 100644
index 0000000..7ccfee4
--- /dev/null
+++ b/api/proc/ProcMapsTest.py
@@ -0,0 +1,58 @@
+#
+# 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 KernelProcFileTestBase
+from KernelProcFileTestBase import repeat_rule, literal_token
+
+
+class ProcMapsTest(KernelProcFileTestBase.KernelProcFileTestBase):
+ '''/proc/self/maps provides currently mapped memory regions and permissions.'''
+
+ start = 'lines'
+
+ t_STRING = literal_token(r'[a-zA-Z\(\)_\-0-9@]+')
+ t_PATH = r'/[^\0^\n]*'
+ t_BRACKET_ITEM = r'\[[^\0^\n]*\]'
+ t_DASH = r'-'
+
+ t_ignore = r' '
+
+ p_lines = repeat_rule('line')
+
+ def p_line(self, p):
+ 'line : STRING STRING STRING STRING COLON STRING STRING source NEWLINE'
+ rng = p[1].split('-')
+ try:
+ if len(rng) != 2:
+ print 'Invalid address range format!'
+ raise SyntaxError
+ p[0] = [int(rng[0], 16), int(rng[1], 16), p[2], int(p[3], 16), int(p[4], 16),\
+ int(p[6], 16), int(p[7]), p[8]]
+ except ValueError:
+ print 'Invalid number!'
+ raise SyntaxError
+
+ def p_source(self, p):
+ '''source : PATH
+ | BRACKET_ITEM
+ | empty'''
+ if p[1] is None:
+ p[0] = []
+ else:
+ p[0] = p[1]
+
+ def get_path(self):
+ return "/proc/self/maps"
diff --git a/api/proc/ProcMemInfoTest.py b/api/proc/ProcMemInfoTest.py
new file mode 100644
index 0000000..f0588ad
--- /dev/null
+++ b/api/proc/ProcMemInfoTest.py
@@ -0,0 +1,82 @@
+#
+# 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 KernelProcFileTestBase
+from KernelProcFileTestBase import repeat_rule, literal_token
+
+
+class ProcMemInfoTest(KernelProcFileTestBase.KernelProcFileTestBase):
+ """
+ /proc/meminfo reports statistics about memory usage on the system.
+
+ No new fields should be added to the upstream implementation.
+ """
+
+ ALLOWED_FIELDS = {
+ "MemTotal",
+ "MemFree",
+ "MemAvailable",
+ "Buffers",
+ "Cached",
+ "SwapCached",
+ "Active",
+ "Inactive",
+ "Active(anon)",
+ "Inactive(anon)",
+ "Active(file)",
+ "Inactive(file)",
+ "Unevictable",
+ "Mlocked",
+ "SwapTotal",
+ "SwapFree",
+ "Dirty",
+ "Writeback",
+ "AnonPages",
+ "Mapped",
+ "Shmem",
+ "Slab",
+ "SReclaimable",
+ "SUnreclaim",
+ "KernelStack",
+ "PageTables",
+ "NFS_Unstable",
+ "Bounce",
+ "WritebackTmp",
+ "CommitLimit",
+ "Committed_AS",
+ "VmallocTotal",
+ "VmallocUsed",
+ "VmallocChunk",
+ }
+
+ t_KB = literal_token(r'kB')
+
+ start = 'lines'
+ p_lines = repeat_rule('line')
+
+ def p_line(self, p):
+ 'line : STRING COLON SPACEs NUMBER SPACE KB NEWLINE'
+ p[0] = [p[1], p[4]]
+
+ def result_correct(self, parse_result):
+ for line in parse_result:
+ if line[0] not in self.ALLOWED_FIELDS:
+ print "'%s' is an illegal field" % line[0]
+ return False
+ return True
+
+ def get_path(self):
+ return "/proc/meminfo"
diff --git a/api/proc/ProcQtaguidCtrlTest.py b/api/proc/ProcQtaguidCtrlTest.py
new file mode 100644
index 0000000..28f714f
--- /dev/null
+++ b/api/proc/ProcQtaguidCtrlTest.py
@@ -0,0 +1,54 @@
+#
+# 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 KernelProcFileTestBase
+from KernelProcFileTestBase import repeat_rule, literal_token
+
+
+class ProcQtaguidCtrlTest(KernelProcFileTestBase.KernelProcFileTestBase):
+ '''
+ /proc/net/xt_qtaguid/ctrl provides information about tagged sockets.
+ '''
+
+ start = 'content'
+
+ t_EVENTS = literal_token(r'events')
+ t_TAG = literal_token(r'tag')
+ t_UID = literal_token(r'uid')
+ t_PID = literal_token(r'pid')
+ t_FCOUNT = literal_token(r'f_count')
+ t_LPAREN = literal_token(r'\(')
+ t_RPAREN = literal_token(r'\)')
+
+ p_lines = repeat_rule('line', zero_ok=True)
+ p_attrs = repeat_rule('attr')
+
+ def p_content(self, p):
+ 'content : lines EVENTS COLON attrs NEWLINE'
+ p[0] = p[1:]
+
+ def p_line(self, p):
+ 'line : STRING EQUALS NUMBER SPACE TAG EQUALS HEX_LITERAL SPACE \
+ LPAREN UID EQUALS NUMBER RPAREN SPACE PID EQUALS NUMBER SPACE \
+ FCOUNT EQUALS NUMBER NEWLINE'
+ p[0] = p[1:]
+
+ def p_attr(self, p):
+ 'attr : SPACE STRING EQUALS NUMBER'
+ p[0] = [p[2], p[4]]
+
+ def get_path(self):
+ return "/proc/net/xt_qtaguid/ctrl"
diff --git a/api/proc/ProcRemoveUidRangeTest.py b/api/proc/ProcRemoveUidRangeTest.py
new file mode 100644
index 0000000..0cf345e
--- /dev/null
+++ b/api/proc/ProcRemoveUidRangeTest.py
@@ -0,0 +1,54 @@
+#
+# 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 ProcShowUidStatTest
+from vts.runners.host import const
+
+
+class ProcRemoveUidRangeTest(ProcShowUidStatTest.ProcShowUidStatTest):
+ '''
+ /proc/uid_cputime/remove_uid_range can be written in order to remove uids
+ from being shown when reading show_uid_stat.
+
+ Format is '[start uid]-[end uid]'
+
+ This is an Android specific file.
+
+ Attributes:
+ uid_remove: int, the uid that the test attempts to remove from show_uid_range
+ '''
+
+ def prepare_test(self, shell):
+ # Remove the last uid
+ results = shell.Execute('cat %s' % self.get_path())
+ if results[const.EXIT_CODE][0] != 0:
+ return False
+ parsed = self.parse_contents(results[const.STDOUT][0])
+ self.uid_remove = parsed[-1][0]
+
+ results = shell.Execute('echo "%d-%d" > /proc/uid_cputime/remove_uid_range' % \
+ (self.uid_remove, self.uid_remove))
+ if results[const.EXIT_CODE][0] != 0:
+ print "Failed to remove uid %d" % self.uid_remove
+ return False
+ return True
+
+ def result_correct(self, results):
+ for line in results:
+ if self.uid_remove == line[0]:
+ print line
+ return False
+ return True
diff --git a/api/proc/ProcShowUidStatTest.py b/api/proc/ProcShowUidStatTest.py
new file mode 100644
index 0000000..d55985e
--- /dev/null
+++ b/api/proc/ProcShowUidStatTest.py
@@ -0,0 +1,36 @@
+#
+# 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 KernelProcFileTestBase
+
+
+class ProcShowUidStatTest(KernelProcFileTestBase.KernelProcFileTestBase):
+ '''
+ /proc/uid_cputime/show_uid_stat provides the time a UID's processes spend
+ in user and kernel space.
+
+ This is an Android specific file.
+ '''
+
+ start = 'lines'
+ p_lines = KernelProcFileTestBase.repeat_rule('line')
+
+ def p_line(self, p):
+ 'line : NUMBER COLON SPACE NUMBER SPACE NUMBER SPACE NUMBER NEWLINE'
+ p[0] = [p[1], p[4], p[6], p[8]]
+
+ def get_path(self):
+ return "/proc/uid_cputime/show_uid_stat"
diff --git a/api/proc/ProcSimpleFileTests.py b/api/proc/ProcSimpleFileTests.py
new file mode 100644
index 0000000..c3779bf
--- /dev/null
+++ b/api/proc/ProcSimpleFileTests.py
@@ -0,0 +1,107 @@
+#
+# 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 KernelProcFileTestBase
+
+
+class ProcKptrRestrictTest(KernelProcFileTestBase.KernelProcFileTestBase):
+ '''
+ /proc/sys/kernel/kptr_restrict determines whether kernel pointers are printed
+ in proc files.
+ '''
+ start = 'num'
+
+ def p_num(self, p):
+ 'num : NUMBER NEWLINE'
+ p[0] = p[1]
+
+ def result_correct(self, result):
+ return result >= 0 and result <= 4
+
+ def get_path(self):
+ return "/proc/sys/kernel/kptr_restrict"
+
+
+class ProcRandomizeVaSpaceTest(KernelProcFileTestBase.KernelProcFileTestBase):
+ '''
+ /proc/sys/kernel/randomize_va_space determines the address layout randomization
+ policy for the system.
+ '''
+ start = 'num'
+
+ def p_num(self, p):
+ 'num : NUMBER NEWLINE'
+ p[0] = p[1]
+
+ def result_correct(self, result):
+ return result >= 0 and result <= 2
+
+ def get_path(self):
+ return "/proc/sys/kernel/randomize_va_space"
+
+
+class ProcOverCommitMemoryTest(KernelProcFileTestBase.KernelProcFileTestBase):
+ '''
+ /proc/sys/vm/overcommit_memory determines the kernel virtual memory accounting mode.
+ '''
+ start = 'num'
+
+ def p_num(self, p):
+ 'num : NUMBER NEWLINE'
+ p[0] = p[1]
+
+ def result_correct(self, result):
+ return result >= 0 and result <= 2
+
+ def get_path(self):
+ return "/proc/sys/vm/overcommit_memory"
+
+
+class ProcMmapMinAddrTest(KernelProcFileTestBase.KernelProcFileTestBase):
+ '''
+ /proc/sys/vm/mmap_min_addr specifies the minimum address that can be mmap'd.
+ '''
+ start = 'num'
+
+ def p_num(self, p):
+ 'num : NUMBER NEWLINE'
+ p[0] = p[1]
+
+ def get_path(self):
+ return "/proc/sys/vm/mmap_min_addr"
+
+
+class ProcMmapRndBitsTest(KernelProcFileTestBase.KernelProcFileTestBase):
+ '''
+ /proc/sys/vm/mmap_rnd_(compat_)bits specifies the amount of randomness in mmap'd
+ addresses. Must be >= 8.
+ '''
+ start = 'num'
+
+ def p_num(self, p):
+ 'num : NUMBER NEWLINE'
+ p[0] = p[1]
+
+ def result_correct(self, result):
+ return result >= 8
+
+ def get_path(self):
+ return "/proc/sys/vm/mmap_rnd_bits"
+
+
+class ProcMmapRndCompatBitsTest(ProcMmapRndBitsTest):
+ def get_path(self):
+ return "/proc/sys/vm/mmap_rnd_compat_bits"
diff --git a/api/proc/ProcStatTest.py b/api/proc/ProcStatTest.py
new file mode 100644
index 0000000..b22af0b
--- /dev/null
+++ b/api/proc/ProcStatTest.py
@@ -0,0 +1,38 @@
+#
+# 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 KernelProcFileTestBase
+from KernelProcFileTestBase import repeat_rule
+
+
+class ProcStatTest(KernelProcFileTestBase.KernelProcFileTestBase):
+ '''
+ /proc/stat provides kernel and system statistics.
+ '''
+
+ start = 'lines'
+
+ p_lines = repeat_rule('line')
+ p_numbers = repeat_rule('NUMBER')
+
+ t_ignore = ' '
+
+ def p_line(self, p):
+ 'line : STRING NUMBERs NEWLINE'
+ p[0] = p[1:]
+
+ def get_path(self):
+ return "/proc/stat"
diff --git a/api/proc/ProcVmallocInfoTest.py b/api/proc/ProcVmallocInfoTest.py
new file mode 100644
index 0000000..a88bb45
--- /dev/null
+++ b/api/proc/ProcVmallocInfoTest.py
@@ -0,0 +1,50 @@
+#
+# 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 KernelProcFileTestBase
+from KernelProcFileTestBase import repeat_rule, literal_token
+
+
+class ProcVmallocInfoTest(KernelProcFileTestBase.KernelProcFileTestBase):
+ '''
+ /proc/vmallocinfo provides info on vmalloc'd ranges.
+ '''
+
+ start = 'lines'
+
+ t_PLUS = literal_token(r'\+')
+ t_SLASH = literal_token(r'/')
+ t_STRING = r'[a-zA-Z\(\)_0-9\-@\.]+'
+ t_ignore = ' '
+
+ p_lines = repeat_rule('line')
+
+ def p_line(self, p):
+ '''line : addr_range NUMBER STRING NEWLINE
+ | addr_range NUMBER STRING PLUS HEX_LITERAL SLASH HEX_LITERAL STRING NEWLINE
+ | addr_range NUMBER STRING PLUS HEX_LITERAL SLASH HEX_LITERAL NEWLINE
+ | addr_range NUMBER STRING PLUS HEX_LITERAL SLASH HEX_LITERAL \
+ STRING EQUALS NUMBER STRING NEWLINE
+ | addr_range NUMBER STRING PLUS HEX_LITERAL SLASH HEX_LITERAL \
+ STRING EQUALS NUMBER STRING STRING NEWLINE'''
+ p[0] = p[1:]
+
+ def p_addr_range(self, p):
+ 'addr_range : HEX_LITERAL DASH HEX_LITERAL'
+ p[0] = [p[1], p[3]]
+
+ def get_path(self):
+ return "/proc/vmallocinfo"
diff --git a/api/proc/ProcZoneInfoTest.py b/api/proc/ProcZoneInfoTest.py
new file mode 100644
index 0000000..da98a8e
--- /dev/null
+++ b/api/proc/ProcZoneInfoTest.py
@@ -0,0 +1,79 @@
+#
+# 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 KernelProcFileTestBase
+from KernelProcFileTestBase import repeat_rule, literal_token
+
+
+class ProcZoneInfoTest(KernelProcFileTestBase.KernelProcFileTestBase):
+ '''
+ /proc/zoneinfo displays information about memory zones.
+ '''
+
+ t_APAGES = literal_token(r'pages')
+ t_PAGESETS = literal_token(r'pagesets')
+ t_CPU = literal_token(r'cpu')
+ t_VM = literal_token(r'vm')
+ t_STATS = literal_token(r'stats')
+ t_THRESHOLD = literal_token(r'threshold')
+ t_NODE = literal_token(r'Node')
+ t_ZONE = literal_token(r'zone')
+ t_PROTECTION = literal_token(r'protection')
+ t_LPAREN = literal_token(r'\(')
+ t_RPAREN = literal_token(r'\)')
+
+ t_ignore = ' '
+
+ start = 'nodes'
+
+ p_nodes = repeat_rule('node')
+ p_lines = repeat_rule('line')
+ p_cpus = repeat_rule('cpu')
+ p_colonlines = repeat_rule('colonline')
+ p_numcommas = repeat_rule('numcomma')
+
+ def p_node(self, p):
+ 'node : heading APAGES lines protection PAGESETS NEWLINE cpus colonlines'
+ p[0] = [p[1], p[3], p[4], p[7], p[8]]
+
+ def p_protection(self, p):
+ 'protection : PROTECTION COLON LPAREN numcommas NUMBER RPAREN NEWLINE'
+ p[0] = p[4] + [p[5]]
+
+ def p_numcomma(self, p):
+ 'numcomma : NUMBER COMMA'
+ p[0] = p[1]
+
+ def p_line(self, p):
+ 'line : STRING NUMBER NEWLINE'
+ p[0] = p[1:3]
+
+ def p_cpu(self, p):
+ 'cpu : CPU COLON NUMBER NEWLINE colonline colonline colonline \
+ VM STATS THRESHOLD COLON NUMBER NEWLINE'
+
+ p[0] = [p[3], p[5], p[6], p[7], [p[10], p[12]]]
+
+ def p_colonline(self, p):
+ 'colonline : STRING COLON NUMBER NEWLINE'
+ p[0] = [p[1], p[3]]
+
+ def p_heading(self, p):
+ 'heading : NODE NUMBER COMMA ZONE STRING NEWLINE'
+ p[0] = [p[2], p[5]]
+
+ def get_path(self):
+ return "/proc/zoneinfo"
diff --git a/api/proc/required_kernel_configs.py b/api/proc/required_kernel_configs.py
new file mode 100644
index 0000000..c99e6e7
--- /dev/null
+++ b/api/proc/required_kernel_configs.py
@@ -0,0 +1,264 @@
+#!/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.
+#
+"""Required kernel configuration options for Treble.
+
+ TODO(jaeshin): Uncomment configs that are temporarily commented out
+ (# marlin) to ensure the testCheckConfigs test passes, once the marlin
+ kernel is updated.
+ TODO(jaeshin): Consolidate new config requirements with android-base.cfg
+
+ Kernel configuration requirements are specified in android-base.cfg
+
+ Key: config_name
+ Value: config_state
+ "y": enabled, represents both "y" and "m" options
+ "n": should not be set
+"""
+
+CONFIGS = {
+ # Loadable Kernel Modules
+ # "CONFIG_MODULES": "y", # marlin
+ # "CONFIG_MODULE_UNLOAD": "y", # marlin
+ # "CONFIG_MODVERSIONS": "y", # marlin
+ # "CONFIG_MODULE_SIG": "y", # marlin
+ # "CONFIG_MODULE_SIG_FORCE": "y", # marlin
+
+ # Device Tree Support
+ "CONFIG_OF": "y",
+ # "CONFIG_OF_*": "y",
+ # "CONFIG_PROC_DEVICETREE": "y", # for kernels prior to 3.15
+
+ # procfs
+ "CONFIG_PROC_FS": "y",
+ "CONFIG_PROC_SYSCTL": "y",
+ "CONFIG_PROC_PAGE_MONITOR": "y",
+ "CONFIG_PROC_PID_CPUSET": "y",
+ "CONFIG_IKCONFIG": "y",
+ "CONFIG_IKCONFIG_PROC": "y",
+
+ # sysfs
+ "CONFIG_SYSFS": "y",
+ "CONFIG_SYSFS_DEPRECATED": "n",
+
+ # debugfs
+ # "CONFIG_DEBUG_FS": "n", # marlin
+
+ # selinuxfs
+ # "CONFIG_SECURITY_SELINUX": "y", # duplicated below in android-base.cfg
+
+ # cgroups
+ # "CONFIG_CGROUPS": "y", # duplicated below in android-base.cfg
+ "CONFIG_CGROUP_DEBUG": "n",
+
+ # memory
+ # "CONFIG_MEMCG": "y", # marlin
+
+ # cpu
+ # "CONFIG_CGROUP_SCHED": "y", # duplicated below in android-base.cfg
+ # "CONFIG_RT_GROUP_SCHED": "y", # duplicated below in android-base.cfg
+ # "CONFIG_FAIR_GROUP_SCHED": "y", # optional
+
+ # cpuacct
+ # "CONFIG_CGROUP_CPUACCT": "y", # duplicated below in android-base.cfg
+
+ # cpuset
+ "CONFIG_CPUSETS": "y",
+ # "CONFIG_PROC_PID_CPUSET": "y", # nice to have
+
+ # schedtune
+ "CONFIG_SCHED_TUNE": "y",
+
+ # pstore fs (PENDING confirmation from kernel team)
+ # "CONFIG_PSTORE": "y",
+ # "CONFIG_PSTORE_*": "y", # differs depending on your hardware, enable the ones present
+
+ # functionfs
+ # "CONFIG_USB_FUNCTIONFS": "y", # marlin
+ # "CONFIG_USB_*": "y", # possibly a few more
+
+ # android-base.cfg configs from
+ # https://android.googlesource.com/kernel/common/+/android-4.4/android/configs/android-base.cfg
+ "CONFIG_DEVKMEM": "n",
+ "CONFIG_DEVMEM": "n",
+ "CONFIG_INET_LRO": "n",
+ "CONFIG_OABI_COMPAT": "n",
+ "CONFIG_SYSVIPC": "n",
+ "CONFIG_ANDROID": "y",
+ "CONFIG_ANDROID_BINDER_IPC": "y",
+ "CONFIG_ANDROID_LOW_MEMORY_KILLER": "y",
+ "CONFIG_ARMV8_DEPRECATED": "y",
+ "CONFIG_ASHMEM": "y",
+ "CONFIG_AUDIT": "y",
+ "CONFIG_BLK_DEV_DM": "y",
+ "CONFIG_BLK_DEV_INITRD": "y",
+ "CONFIG_CGROUPS": "y",
+ "CONFIG_CGROUP_CPUACCT": "y",
+ "CONFIG_CGROUP_FREEZER": "y",
+ "CONFIG_CGROUP_SCHED": "y",
+ # "CONFIG_CP15_BARRIER_EMULATION": "y", # marlin
+ "CONFIG_DM_CRYPT": "y",
+ "CONFIG_DM_VERITY": "y",
+ "CONFIG_DM_VERITY_FEC": "y",
+ "CONFIG_EMBEDDED": "y",
+ "CONFIG_FB": "y",
+ "CONFIG_HARDENED_USERCOPY": "y",
+ "CONFIG_HIGH_RES_TIMERS": "y",
+ "CONFIG_INET6_AH": "y",
+ "CONFIG_INET6_ESP": "y",
+ "CONFIG_INET6_IPCOMP": "y",
+ "CONFIG_INET": "y",
+ "CONFIG_INET_DIAG_DESTROY": "y",
+ "CONFIG_INET_ESP": "y",
+ "CONFIG_INET_XFRM_MODE_TUNNEL": "y",
+ "CONFIG_IP6_NF_FILTER": "y",
+ "CONFIG_IP6_NF_IPTABLES": "y",
+ "CONFIG_IP6_NF_MANGLE": "y",
+ "CONFIG_IP6_NF_RAW": "y",
+ "CONFIG_IP6_NF_TARGET_REJECT": "y",
+ "CONFIG_IPV6": "y",
+ "CONFIG_IPV6_MIP6": "y",
+ "CONFIG_IPV6_MULTIPLE_TABLES": "y",
+ "CONFIG_IPV6_OPTIMISTIC_DAD": "y",
+ # "CONFIG_IPV6_PRIVACY": "y", # marlin
+ "CONFIG_IPV6_ROUTER_PREF": "y",
+ "CONFIG_IPV6_ROUTE_INFO": "y",
+ "CONFIG_IP_ADVANCED_ROUTER": "y",
+ # "CONFIG_IP_MULTICAST": "y", # marlin
+ "CONFIG_IP_MULTIPLE_TABLES": "y",
+ "CONFIG_IP_NF_ARPFILTER": "y",
+ "CONFIG_IP_NF_ARPTABLES": "y",
+ "CONFIG_IP_NF_ARP_MANGLE": "y",
+ "CONFIG_IP_NF_FILTER": "y",
+ "CONFIG_IP_NF_IPTABLES": "y",
+ "CONFIG_IP_NF_MANGLE": "y",
+ "CONFIG_IP_NF_MATCH_AH": "y",
+ "CONFIG_IP_NF_MATCH_ECN": "y",
+ "CONFIG_IP_NF_MATCH_TTL": "y",
+ "CONFIG_IP_NF_NAT": "y",
+ "CONFIG_IP_NF_RAW": "y",
+ "CONFIG_IP_NF_SECURITY": "y",
+ "CONFIG_IP_NF_TARGET_MASQUERADE": "y",
+ "CONFIG_IP_NF_TARGET_NETMAP": "y",
+ "CONFIG_IP_NF_TARGET_REDIRECT": "y",
+ "CONFIG_IP_NF_TARGET_REJECT": "y",
+ "CONFIG_NET": "y",
+ "CONFIG_NETDEVICES": "y",
+ "CONFIG_NETFILTER": "y",
+ # "CONFIG_NETFILTER_TPROXY": "y", # marlin
+ "CONFIG_NETFILTER_XT_MATCH_COMMENT": "y",
+ "CONFIG_NETFILTER_XT_MATCH_CONNLIMIT": "y",
+ "CONFIG_NETFILTER_XT_MATCH_CONNMARK": "y",
+ "CONFIG_NETFILTER_XT_MATCH_CONNTRACK": "y",
+ "CONFIG_NETFILTER_XT_MATCH_HASHLIMIT": "y",
+ "CONFIG_NETFILTER_XT_MATCH_HELPER": "y",
+ "CONFIG_NETFILTER_XT_MATCH_IPRANGE": "y",
+ "CONFIG_NETFILTER_XT_MATCH_LENGTH": "y",
+ "CONFIG_NETFILTER_XT_MATCH_LIMIT": "y",
+ "CONFIG_NETFILTER_XT_MATCH_MAC": "y",
+ "CONFIG_NETFILTER_XT_MATCH_MARK": "y",
+ "CONFIG_NETFILTER_XT_MATCH_PKTTYPE": "y",
+ "CONFIG_NETFILTER_XT_MATCH_POLICY": "y",
+ "CONFIG_NETFILTER_XT_MATCH_QTAGUID": "y",
+ "CONFIG_NETFILTER_XT_MATCH_QUOTA2": "y",
+ # "CONFIG_NETFILTER_XT_MATCH_QUOTA2_LOG": "y", # marlin
+ "CONFIG_NETFILTER_XT_MATCH_QUOTA": "y",
+ "CONFIG_NETFILTER_XT_MATCH_SOCKET": "y",
+ "CONFIG_NETFILTER_XT_MATCH_STATE": "y",
+ "CONFIG_NETFILTER_XT_MATCH_STATISTIC": "y",
+ "CONFIG_NETFILTER_XT_MATCH_STRING": "y",
+ "CONFIG_NETFILTER_XT_MATCH_TIME": "y",
+ "CONFIG_NETFILTER_XT_MATCH_U32": "y",
+ "CONFIG_NETFILTER_XT_TARGET_CLASSIFY": "y",
+ "CONFIG_NETFILTER_XT_TARGET_CONNMARK": "y",
+ "CONFIG_NETFILTER_XT_TARGET_CONNSECMARK": "y",
+ "CONFIG_NETFILTER_XT_TARGET_IDLETIMER": "y",
+ "CONFIG_NETFILTER_XT_TARGET_MARK": "y",
+ "CONFIG_NETFILTER_XT_TARGET_NFLOG": "y",
+ "CONFIG_NETFILTER_XT_TARGET_NFQUEUE": "y",
+ "CONFIG_NETFILTER_XT_TARGET_SECMARK": "y",
+ "CONFIG_NETFILTER_XT_TARGET_TCPMSS": "y",
+ "CONFIG_NETFILTER_XT_TARGET_TPROXY": "y",
+ "CONFIG_NETFILTER_XT_TARGET_TRACE": "y",
+ "CONFIG_NET_CLS_ACT": "y",
+ "CONFIG_NET_CLS_U32": "y",
+ "CONFIG_NET_EMATCH": "y",
+ "CONFIG_NET_EMATCH_U32": "y",
+ "CONFIG_NET_KEY": "y",
+ "CONFIG_NET_SCHED": "y",
+ "CONFIG_NET_SCH_HTB": "y",
+ "CONFIG_NF_CONNTRACK": "y",
+ "CONFIG_NF_CONNTRACK_AMANDA": "y",
+ "CONFIG_NF_CONNTRACK_EVENTS": "y",
+ "CONFIG_NF_CONNTRACK_FTP": "y",
+ "CONFIG_NF_CONNTRACK_H323": "y",
+ "CONFIG_NF_CONNTRACK_IPV4": "y",
+ "CONFIG_NF_CONNTRACK_IPV6": "y",
+ "CONFIG_NF_CONNTRACK_IRC": "y",
+ "CONFIG_NF_CONNTRACK_NETBIOS_NS": "y",
+ "CONFIG_NF_CONNTRACK_PPTP": "y",
+ "CONFIG_NF_CONNTRACK_SANE": "y",
+ "CONFIG_NF_CONNTRACK_SECMARK": "y",
+ "CONFIG_NF_CONNTRACK_TFTP": "y",
+ "CONFIG_NF_CT_NETLINK": "y",
+ "CONFIG_NF_CT_PROTO_DCCP": "y",
+ "CONFIG_NF_CT_PROTO_SCTP": "y",
+ "CONFIG_NF_CT_PROTO_UDPLITE": "y",
+ "CONFIG_NF_NAT": "y",
+ "CONFIG_NO_HZ": "y",
+ "CONFIG_PACKET": "y",
+ "CONFIG_PM_AUTOSLEEP": "y",
+ "CONFIG_PM_WAKELOCKS": "y",
+ "CONFIG_PPP": "y",
+ "CONFIG_PPPOLAC": "y",
+ "CONFIG_PPPOPNS": "y",
+ "CONFIG_PPP_BSDCOMP": "y",
+ "CONFIG_PPP_DEFLATE": "y",
+ "CONFIG_PPP_MPPE": "y",
+ "CONFIG_PREEMPT": "y",
+ "CONFIG_PROFILING": "y",
+ "CONFIG_QFMT_V2": "y",
+ "CONFIG_QUOTA": "y",
+ "CONFIG_QUOTA_NETLINK_INTERFACE": "y",
+ "CONFIG_QUOTA_TREE": "y",
+ "CONFIG_QUOTACTL": "y",
+ # "CONFIG_RANDOMIZE_BASE": "y", # marlin
+ "CONFIG_RTC_CLASS": "y",
+ "CONFIG_RT_GROUP_SCHED": "y",
+ "CONFIG_SECCOMP": "y",
+ "CONFIG_SECURITY": "y",
+ "CONFIG_SECURITY_NETWORK": "y",
+ "CONFIG_SECURITY_PERF_EVENTS_RESTRICT": "y",
+ "CONFIG_SECURITY_SELINUX": "y",
+ # "CONFIG_SETEND_EMULATION": "y", # marlin
+ "CONFIG_STAGING": "y",
+ "CONFIG_SWP_EMULATION": "y",
+ "CONFIG_SYNC": "y",
+ "CONFIG_TUN": "y",
+ # "CONFIG_UID_CPUTIME": "y", # marlin
+ "CONFIG_UNIX": "y",
+ "CONFIG_USB_GADGET": "y",
+ # "CONFIG_USB_CONFIGFS": "y", # marlin
+ # "CONFIG_USB_CONFIGFS_F_FS": "y", # marlin
+ # "CONFIG_USB_CONFIGFS_F_MTP": "y", # marlin
+ # "CONFIG_USB_CONFIGFS_F_PTP": "y", # marlin
+ # "CONFIG_USB_CONFIGFS_F_ACC": "y", # marlin
+ # "CONFIG_USB_CONFIGFS_F_AUDIO_SRC": "y", # marlin
+ # "CONFIG_USB_CONFIGFS_UEVENT": "y", # marlin
+ # "CONFIG_USB_CONFIGFS_F_MIDI": "y", # marlin
+ # "CONFIG_USB_OTG_WAKELOCK": "y", # marlin
+ "CONFIG_XFRM_USER": "y",
+}
diff --git a/cpu_profiling/AndroidTest.xml b/cpu_profiling/AndroidTest.xml
index 2845c90..c058de3 100644
--- a/cpu_profiling/AndroidTest.xml
+++ b/cpu_profiling/AndroidTest.xml
@@ -22,9 +22,8 @@
<test class="com.android.tradefed.testtype.VtsMultiDeviceTest">
<option name="test-module-name" value="CpuProfilingTest" />
<option name="test-case-path" value="vts/testcases/kernel/cpu_profiling/CpuProfilingTest" />
- <option name="binary-test-sources" value="
- _32bit::DATA/nativetest/simpleperf_cpu_hotplug_test/simpleperf_cpu_hotplug_test,
- _64bit::DATA/nativetest64/simpleperf_cpu_hotplug_test/simpleperf_cpu_hotplug_test" />
+ <option name="binary-test-source" value="_32bit::DATA/nativetest/simpleperf_cpu_hotplug_test/simpleperf_cpu_hotplug_test" />
+ <option name="binary-test-source" value="_64bit::DATA/nativetest64/simpleperf_cpu_hotplug_test/simpleperf_cpu_hotplug_test" />
<option name="binary-test-type" value="gtest" />
<option name="exclude-filter" value="cpu_offline.offline_while_ioctl_enable" />
</test>
diff --git a/cpu_profiling/CpuProfilingTest.py b/cpu_profiling/CpuProfilingTest.py
index 2025777..3a3cb6b 100644
--- a/cpu_profiling/CpuProfilingTest.py
+++ b/cpu_profiling/CpuProfilingTest.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3.4
+#!/usr/bin/env python
#
# Copyright (C) 2016 The Android Open Source Project
#
diff --git a/cpu_profiling/cpu_profiling_test_config.py b/cpu_profiling/cpu_profiling_test_config.py
index 0ff9847..a54c295 100644
--- a/cpu_profiling/cpu_profiling_test_config.py
+++ b/cpu_profiling/cpu_profiling_test_config.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python3.4
#
# Copyright (C) 2016 The Android Open Source Project
#
diff --git a/linux_kselftest/LinuxKselftestTest.py b/linux_kselftest/LinuxKselftestTest.py
index c34d43c..ea7f9ec 100644
--- a/linux_kselftest/LinuxKselftestTest.py
+++ b/linux_kselftest/LinuxKselftestTest.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3.4
+#!/usr/bin/env python
#
# Copyright (C) 2016 The Android Open Source Project
#
@@ -16,18 +16,18 @@
#
import logging
-import os
from vts.runners.host import asserts
-from vts.runners.host import base_test_with_webdb
+from vts.runners.host import base_test
from vts.runners.host import const
from vts.runners.host import keys
from vts.runners.host import test_runner
from vts.utils.python.controllers import android_device
+from vts.utils.python.os import path_utils
from vts.testcases.kernel.linux_kselftest import kselftest_config as config
-class LinuxKselftestTest(base_test_with_webdb.BaseTestWithWebDbClass):
+class LinuxKselftestTest(base_test.BaseTestClass):
"""Runs Linux Kselftest test cases against Android OS kernel.
Attributes:
@@ -74,8 +74,11 @@
_64BIT or 64 for 64-bit tests;
"""
self._shell.Execute("mkdir %s -p" % config.KSFT_DIR)
- self._dut.adb.push("%s/%s/linux-kselftest/. %s" %
- (self.data_file_path, n_bit, config.KSFT_DIR))
+ test_bit = 'nativetest'
+ if n_bit == self._64BIT:
+ test_bit += '64'
+ self._dut.adb.push("%s/DATA/%s/linux-kselftest/. %s" %
+ (self.data_file_path, test_bit, config.KSFT_DIR))
def PreTestSetup(self):
"""Sets up test before running."""
@@ -115,9 +118,10 @@
if not testcase:
asserts.skip("Test is not supported on this abi.")
- chmod_cmd = "chmod -R 755 %s" % os.path.join(
+ chmod_cmd = "chmod -R 755 %s" % path_utils.JoinTargetPath(
config.KSFT_DIR, testcase.testsuite)
- cd_cmd = "cd %s" % os.path.join(config.KSFT_DIR, testcase.testsuite)
+ cd_cmd = "cd %s" % path_utils.JoinTargetPath(
+ config.KSFT_DIR, testcase.testsuite)
cmd = [
chmod_cmd,
diff --git a/linux_kselftest/kselftest_config.py b/linux_kselftest/kselftest_config.py
index 570c1ff..f28048b 100644
--- a/linux_kselftest/kselftest_config.py
+++ b/linux_kselftest/kselftest_config.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python3.4
#
# Copyright (C) 2016 The Android Open Source Project
#
diff --git a/linux_kselftest/test_case.py b/linux_kselftest/test_case.py
index c0994c7..1393cfe 100644
--- a/linux_kselftest/test_case.py
+++ b/linux_kselftest/test_case.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python3.4
#
# Copyright (C) 2016 The Android Open Source Project
#
diff --git a/ltp/KernelLtpTest.py b/ltp/KernelLtpTest.py
index 29cd995..a6cc835 100644
--- a/ltp/KernelLtpTest.py
+++ b/ltp/KernelLtpTest.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3.4
+#!/usr/bin/env python
#
# Copyright (C) 2016 The Android Open Source Project
#
@@ -23,7 +23,7 @@
import os
from vts.runners.host import asserts
-from vts.runners.host import base_test_with_webdb
+from vts.runners.host import base_test
from vts.runners.host import const
from vts.runners.host import keys
from vts.runners.host import test_runner
@@ -37,7 +37,7 @@
from vts.testcases.kernel.ltp import ltp_configs
-class KernelLtpTest(base_test_with_webdb.BaseTestWithWebDbClass):
+class KernelLtpTest(base_test.BaseTestClass):
"""Runs the LTP (Linux Test Project) test cases against Android OS kernel.
Attributes:
@@ -141,34 +141,42 @@
result.append("%s_%s" % (item, const.SUFFIX_64BIT))
return result
- def PreTestSetup(self, n_bit):
+ def PreTestSetup(self, test_bit):
"""Setups that needs to be done before any tests."""
- replacements = {'#\\!/bin/sh': '#\\!/system/bin/sh',
- '#\\! /bin/sh': '#\\!/system/bin/sh',
- '#\\!/bin/bash': '#\\!/system/bin/sh',
- '#\\! /bin/bash': '#\\!/system/bin/sh',
+ replacements = {'#!/bin/sh': '#!/system/bin/sh',
+ '#! /bin/sh': '#!/system/bin/sh',
+ '#!/bin/bash': '#!/system/bin/sh',
+ '#! /bin/bash': '#!/system/bin/sh',
'bs=1M': 'bs=1m',
'/var/run': ltp_configs.TMP}
- src_host = os.path.join(self.data_file_path, str(n_bit), 'ltp')
- sed_command = self._shell_env.CreateSedCommand(src_host, replacements)
- logging.info('Executing sed commands on host: %s', sed_command)
- results = cmd_utils.ExecuteShellCommand(sed_command)
- logging.info('Finished sed commands on host. Results: %s', results)
- asserts.assertFalse(
- any(results[cmd_utils.EXIT_CODE]),
- "Error: pre-test setup failed. "
- "Commands: {commands}. Results: {results}".format(
- commands=sed_command, results=results))
+ src_host = os.path.join(self.data_file_path, 'DATA', test_bit, 'ltp')
+
+ count = 0
+ for (dirpath, dirnames, filenames) in os.walk(src_host):
+ for filename in filenames:
+ filepath = os.path.join(dirpath, filename)
+ content = ''
+ with open(filepath, 'r') as f:
+ content = f.read()
+ content_replaced = content
+ for key in replacements:
+ content_replaced = content_replaced.replace(
+ key, replacements[key])
+ if content_replaced != content:
+ with open(filepath, 'w') as f:
+ f.write(content_replaced)
+ count += 1
+ logging.info('Finished replacing script contents from %s files', count)
self._report_thread_lock = threading.Lock()
- def PushFiles(self, n_bit):
+ def PushFiles(self, test_bit):
"""Push the related files to target.
Args:
- n_bit: int, bitness
+ test_bit: nativetest or nativetest64
"""
- src = os.path.join(self.data_file_path, str(n_bit), 'ltp', '.')
+ src = os.path.join(self.data_file_path, 'DATA', test_bit, 'ltp', '.')
logging.info('Pushing files from %s to %s', src, ltp_configs.LTPDIR)
self.shell.Execute("mkdir %s -p" % ltp_configs.LTPDIR)
self._dut.adb.push(src, ltp_configs.LTPDIR)
@@ -243,8 +251,11 @@
Args:
n_bit: int, bitness
"""
- self.PreTestSetup(n_bit)
- self.PushFiles(n_bit)
+ test_bit = 'nativetest'
+ if n_bit == 64:
+ test_bit += '64'
+ self.PreTestSetup(test_bit)
+ self.PushFiles(test_bit)
test_cases = list(
self._testcases.Load(
@@ -252,7 +263,7 @@
logging.info("Checking binary exists for all test cases.")
self._requirement.ltp_bin_host_path = os.path.join(
- self.data_file_path, str(n_bit), 'ltp', 'testcases', 'bin')
+ self.data_file_path, 'DATA', test_bit, 'ltp', 'testcases', 'bin')
self._requirement.CheckAllTestCaseExecutables(test_cases)
logging.info("Start running %i individual tests." % len(test_cases))
diff --git a/ltp/environment_requirement_checker.py b/ltp/environment_requirement_checker.py
index dccae1f..2c25eb9 100644
--- a/ltp/environment_requirement_checker.py
+++ b/ltp/environment_requirement_checker.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python3.4
#
# Copyright (C) 2016 The Android Open Source Project
#
@@ -15,7 +14,6 @@
# limitations under the License.
#
-import os
import copy
import logging
import itertools
@@ -23,6 +21,7 @@
from vts.runners.host import const
from vts.utils.python.common import cmd_utils
+from vts.utils.python.os import path_utils
from vts.testcases.kernel.ltp.shell_environment import shell_environment
from vts.testcases.kernel.ltp import ltp_enums
@@ -147,7 +146,7 @@
# Set all executables executable permission using chmod.
logging.info("Setting permissions on device")
- permission_command = "chmod 775 %s" % os.path.join(
+ permission_command = "chmod 775 %s" % path_utils.JoinTargetPath(
ltp_configs.LTPBINPATH, '*')
permission_result = self.shell.Execute(permission_command)
if permission_result[const.EXIT_CODE][0]:
diff --git a/ltp/ltp_configs.py b/ltp/ltp_configs.py
index 65099a4..8413553 100644
--- a/ltp/ltp_configs.py
+++ b/ltp/ltp_configs.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python3.4
#
# Copyright (C) 2016 The Android Open Source Project
#
@@ -17,26 +16,27 @@
import os
+from vts.utils.python.os import path_utils
+
from vts.testcases.kernel.ltp import ltp_enums
-VTS_LTP_OUTPUT = 'ltp'
+VTS_LTP_OUTPUT = os.path.join('DATA', 'nativetest', 'ltp')
LTP_RUNTEST_DIR = os.path.join(VTS_LTP_OUTPUT, 'runtest')
LTP_DISABLED_BUILD_TESTS_CONFIG_PATH = os.path.join(VTS_LTP_OUTPUT, 'disabled_tests.txt')
-
# Environment paths for ltp test cases
# string, ltp build root directory on target
LTPDIR = '/data/local/tmp/ltp'
# Directory for environment variable 'TMP' needed by some test cases
-TMP = os.path.join(LTPDIR, 'tmp')
+TMP = path_utils.JoinTargetPath(LTPDIR, 'tmp')
# Directory for environment variable 'TMPBASE' needed by some test cases
-TMPBASE = os.path.join(TMP, 'tmpbase')
+TMPBASE = path_utils.JoinTargetPath(TMP, 'tmpbase')
# Directory for environment variable 'LTPTMP' needed by some test cases
-LTPTMP = os.path.join(TMP, 'ltptemp')
+LTPTMP = path_utils.JoinTargetPath(TMP, 'ltptemp')
# Directory for environment variable 'TMPDIR' needed by some test cases
-TMPDIR = os.path.join(TMP, 'tmpdir')
+TMPDIR = path_utils.JoinTargetPath(TMP, 'tmpdir')
# Path where ltp test binary exists
-LTPBINPATH = os.path.join(LTPDIR, 'testcases/bin')
+LTPBINPATH = path_utils.JoinTargetPath(LTPDIR, 'testcases', 'bin')
# Add LTP's binary path to PATH
PATH = '/system/bin:%s' % LTPBINPATH
@@ -165,6 +165,16 @@
'syscalls.openat03',
# Fail on local device but pass on lab devices
'fs.proc01',
+ # Failing for missing libcap
+ 'containers.userns01_64bit',
+ 'securebits.check_keepcaps03_64bit',
+ 'securebits.check_keepcaps02_64bit',
+ 'containers.userns05_64bit',
+ 'containers.userns07_64bit',
+ 'containers.userns06_64bit',
+ 'containers.userns03_64bit',
+ 'securebits.check_keepcaps01_64bit',
+ 'containers.userns02_64bit',
]
# Tests disabled
diff --git a/ltp/ltp_enums.py b/ltp/ltp_enums.py
index 34b6d9d..a1789c1 100644
--- a/ltp/ltp_enums.py
+++ b/ltp/ltp_enums.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python3.4
#
# Copyright (C) 2016 The Android Open Source Project
#
diff --git a/ltp/requirements.py b/ltp/requirements.py
index 5ad2dfc..8a54dda 100644
--- a/ltp/requirements.py
+++ b/ltp/requirements.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python3.4
#
# Copyright (C) 2016 The Android Open Source Project
#
diff --git a/ltp/shell_environment/definitions/base_definitions/check_setup_cleanup.py b/ltp/shell_environment/definitions/base_definitions/check_setup_cleanup.py
index 04dd868..2104f01 100644
--- a/ltp/shell_environment/definitions/base_definitions/check_setup_cleanup.py
+++ b/ltp/shell_environment/definitions/base_definitions/check_setup_cleanup.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python3.4
#
# Copyright (C) 2016 The Android Open Source Project
#
diff --git a/ltp/shell_environment/definitions/bin_in_path.py b/ltp/shell_environment/definitions/bin_in_path.py
index 28f0449..f54aae8 100644
--- a/ltp/shell_environment/definitions/bin_in_path.py
+++ b/ltp/shell_environment/definitions/bin_in_path.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python3.4
#
# Copyright (C) 2016 The Android Open Source Project
#
diff --git a/ltp/shell_environment/definitions/directory_exists.py b/ltp/shell_environment/definitions/directory_exists.py
index 64cc03b..09b1ec7 100644
--- a/ltp/shell_environment/definitions/directory_exists.py
+++ b/ltp/shell_environment/definitions/directory_exists.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python3.4
#
# Copyright (C) 2016 The Android Open Source Project
#
diff --git a/ltp/shell_environment/definitions/loop_device_support.py b/ltp/shell_environment/definitions/loop_device_support.py
index 70de57e..b0d0a20 100644
--- a/ltp/shell_environment/definitions/loop_device_support.py
+++ b/ltp/shell_environment/definitions/loop_device_support.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python3.4
#
# Copyright (C) 2016 The Android Open Source Project
#
diff --git a/ltp/shell_environment/definitions/path_permission.py b/ltp/shell_environment/definitions/path_permission.py
index c390650..bb4c46a 100644
--- a/ltp/shell_environment/definitions/path_permission.py
+++ b/ltp/shell_environment/definitions/path_permission.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python3.4
#
# Copyright (C) 2016 The Android Open Source Project
#
diff --git a/ltp/shell_environment/shell_commands.py b/ltp/shell_environment/shell_commands.py
index b874fa8..68c5fbc 100644
--- a/ltp/shell_environment/shell_commands.py
+++ b/ltp/shell_environment/shell_commands.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python3.4
#
# Copyright (C) 2016 The Android Open Source Project
#
diff --git a/ltp/shell_environment/shell_environment.py b/ltp/shell_environment/shell_environment.py
index 698ee5f..a18f0c1 100644
--- a/ltp/shell_environment/shell_environment.py
+++ b/ltp/shell_environment/shell_environment.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python3.4
#
# Copyright (C) 2016 The Android Open Source Project
#
@@ -95,52 +94,3 @@
"\n CPU info: '{}'".format(cpu_info))
return 1
- def CreateSedCommand(self, path, patterns):
- '''Create a shell command that uses sed to replace strings.
-
- Args:
- path: string, the path to execude sed command
- patterns: dict of {string: string}, a map from source string to
- replacement string
-
- Returns:
- String, a shell command to replace each string pattern.
- '''
- sed_patterns = [self.CreateSedPattern(*pattern)
- for pattern in patterns.iteritems()]
- sed_cmd = 'sed %s' % ' '.join(['-i -e "%s"' % p for p in sed_patterns])
-
- # This applies sed_cmd to every shell script.
- return 'find %s -type f | xargs %s' % (path, sed_cmd)
-
- def CreateSedPattern(self, replace_from, replace_to):
- '''Create a sed pattern to replace strings in given file list
-
- Args:
- replace_from: string, the string to search using sed
- replace_to: string, the replacement string for sed
-
- Returns:
- String, a sed pattern starting with 's' and ending with 'g',
- with a unique separator
- '''
- separators = '/=+-:#\\'
- separator_avalibility = [c not in replace_from and c not in replace_to
- for c in separators]
-
- available_separator = [
- ch for ch, available in zip(separators, separator_avalibility)
- if available
- ]
-
- if not available_separator:
- logging.error('no pre-defined separator available for the given'
- ' strings')
- return None
-
- separator = available_separator[0]
- return ("s{separator}{replace_from}{separator}"
- "{replace_to}{separator}g").format(
- separator=separator,
- replace_from=replace_from,
- replace_to=replace_to)
diff --git a/ltp/test_case.py b/ltp/test_case.py
index 26aafe8..10bf659 100644
--- a/ltp/test_case.py
+++ b/ltp/test_case.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python3.4
#
# Copyright (C) 2016 The Android Open Source Project
#
@@ -16,9 +15,10 @@
#
import re
-import os
import logging
+from vts.utils.python.os import path_utils
+
from vts.testcases.kernel.ltp import ltp_enums
from vts.testcases.kernel.ltp import ltp_configs
@@ -101,7 +101,8 @@
tokens[0].find('=') > 0):
return command
else: # Is Ltp executable
- tokens[0] = os.path.join(ltp_configs.LTPBINPATH, tokens[0])
+ tokens[0] = path_utils.JoinTargetPath(ltp_configs.LTPBINPATH,
+ tokens[0])
return ' '.join(tokens)
def GetCommand(self):
@@ -134,7 +135,7 @@
returned. For binaries in system's PATH, only the name will be
returned.
"""
- return [os.path.join(ltp_bin_path, executable)
+ return [path_utils.JoinTargetPath(ltp_bin_path, executable)
if executable not in ltp_configs.INTERNAL_BINS else executable
for executable in self.InternalGetExecutableNames()
if executable not in ltp_configs.INTERNAL_SHELL_COMMANDS]
diff --git a/ltp/test_cases_parser.py b/ltp/test_cases_parser.py
index e17b1b7..23c680b 100644
--- a/ltp/test_cases_parser.py
+++ b/ltp/test_cases_parser.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python3.4
#
# Copyright (C) 2016 The Android Open Source Project
#
@@ -98,21 +97,24 @@
testcase.is_filtered = True
testcase.note = "filtered"
- # For skipping tests that are not designed for Android
+ # For skipping tests that are not designed or ready for Android
if test_display_name in self._disabled_tests:
logging.info("[Parser] Skipping test case %s. Reason: "
"disabled" % testcase.fullname)
continue
- # For failing tests that are being inspected
+ # For separating staging tests from stable tests
if test_display_name in self._staging_tests:
if not run_staging:
- logging.info("[Parser] Skipping test case %s. Reason: "
- "staging" % testcase.fullname)
+ # Skip staging tests in stable run
continue
else:
testcase.is_staging = True
testcase.note = "staging"
+ else:
+ if run_staging:
+ # Skip stable tests in staging run
+ continue
logging.info("[Parser] Adding test case %s." % testcase.fullname)
yield testcase
diff --git a/memory/AndroidTest.xml b/memory/AndroidTest.xml
index 9fdeebb..a3b55dd 100644
--- a/memory/AndroidTest.xml
+++ b/memory/AndroidTest.xml
@@ -15,7 +15,9 @@
-->
<configuration description="Config for VTS MemorySystemStressTest test cases">
<target_preparer class="com.android.compatibility.common.tradefed.targetprep.VtsFilePusher">
- <option name="push-group" value="HidlHalTest.push" />
+ <option name="push-group" value="HostDrivenTest.push" />
+ <option name="push" value="DATA/bin/stressapptest->/data/local/tmp/32/stressapptest" />
+ <option name="cleanup" value="true" />
</target_preparer>
<target_preparer class="com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer">
</target_preparer>
diff --git a/memory/MemorySystemStressTest.py b/memory/MemorySystemStressTest.py
index 85aab5b..468703f 100644
--- a/memory/MemorySystemStressTest.py
+++ b/memory/MemorySystemStressTest.py
@@ -18,14 +18,14 @@
import logging
from vts.runners.host import asserts
-from vts.runners.host import base_test_with_webdb
+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
import re
-class MemorySystemStressTest(base_test_with_webdb.BaseTestWithWebDbClass):
+class MemorySystemStressTest(base_test.BaseTestClass):
"""Userspace Memory Stress Test."""
_mem = 64
_DURATION_SEC = 300
diff --git a/syscall/SyscallExistenceTest.py b/syscall/SyscallExistenceTest.py
index 9a13f91..f13c2cb 100644
--- a/syscall/SyscallExistenceTest.py
+++ b/syscall/SyscallExistenceTest.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3.4
+#!/usr/bin/env python
#
# Copyright (C) 2016 The Android Open Source Project
#
@@ -19,12 +19,12 @@
from vts.runners.host import const
from vts.runners.host import asserts
-from vts.runners.host import base_test_with_webdb
+from vts.runners.host import base_test
from vts.runners.host import test_runner
from vts.utils.python.controllers import android_device
-class SyscallExistenceTest(base_test_with_webdb.BaseTestWithWebDbClass):
+class SyscallExistenceTest(base_test.BaseTestClass):
"""Tests to verify kernel syscall interface."""
TEST_SHELL_NAME = "my_shell1"
AARCH64__NR_name_to_handle_at = 264
@@ -35,7 +35,7 @@
self.dut = self.registerController(android_device)[0]
self.dut.shell.InvokeTerminal(self.TEST_SHELL_NAME)
- def tearDownTest(self):
+ def tearDown(self):
self.dut.shell.InvokeTerminal(self.TEST_SHELL_NAME)
results = getattr(self.dut.shell, self.TEST_SHELL_NAME).Execute("which ls")
logging.info(str(results[const.STDOUT]))