1#
2# Copyright (C) 2016 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the 'License');
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an 'AS IS' BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17import os
18
19from vts.utils.python.os import path_utils
20
21from vts.testcases.kernel.ltp import ltp_enums
22
23VTS_LTP_OUTPUT = os.path.join('DATA', 'nativetest', 'ltp')
24LTP_RUNTEST_DIR = os.path.join(VTS_LTP_OUTPUT, 'runtest')
25LTP_DISABLED_BUILD_TESTS_CONFIG_PATH = os.path.join(VTS_LTP_OUTPUT,
26                                                    'disabled_tests.txt')
27
28# Environment paths for ltp test cases
29# string, ltp build root directory on target
30LTPDIR = '/data/local/tmp/ltp'
31# Directory for environment variable 'TMP' needed by some test cases
32TMP = path_utils.JoinTargetPath(LTPDIR, 'tmp')
33# Directory for environment variable 'TMPBASE' needed by some test cases
34TMPBASE = path_utils.JoinTargetPath(TMP, 'tmpbase')
35# Directory for environment variable 'LTPTMP' needed by some test cases
36LTPTMP = path_utils.JoinTargetPath(TMP, 'ltptemp')
37# Directory for environment variable 'TMPDIR' needed by some test cases
38TMPDIR = path_utils.JoinTargetPath(TMP, 'tmpdir')
39# Path where ltp test binary exists
40LTPBINPATH = path_utils.JoinTargetPath(LTPDIR, 'testcases', 'bin')
41# Add LTP's binary path to PATH
42PATH = '/system/bin:%s' % LTPBINPATH
43
44# Default number of threads to run LTP tests. Zero means matching to number
45# of CPU threads
46DEFAULT_NUMBER_OF_THREADS = 1
47
48# File system type for loop device
49LTP_DEV_FS_TYPE = 'ext4'
50
51# File name suffix for low memory scenario group scripts
52LOW_MEMORY_SCENARIO_GROUP_SUFFIX = '_low_mem'
53
54# Binaries required by LTP test cases that should exist in PATH
55INTERNAL_BINS = [
56    'mktemp',
57    'cp',
58    'chmod',
59    'chown',
60    'ls',
61    'mkfifo',
62    'ldd',
63]
64
65# Internal shell command required by some LTP test cases
66INTERNAL_SHELL_COMMANDS = [
67    'export',
68    'cd',
69]
70
71# Requirement to testcase dictionary.
72REQUIREMENTS_TO_TESTCASE = {
73    ltp_enums.Requirements.LOOP_DEVICE_SUPPORT: [
74        'syscalls.mount01',
75        'syscalls.fchmod06',
76        'syscalls.ftruncate04',
77        'syscalls.ftruncate04_64',
78        'syscalls.inotify03',
79        'syscalls.link08',
80        'syscalls.linkat02',
81        'syscalls.mkdir03',
82        'syscalls.mkdirat02',
83        'syscalls.mknod07',
84        'syscalls.mknodat02',
85        'syscalls.mmap16',
86        'syscalls.mount01',
87        'syscalls.mount02',
88        'syscalls.mount03',
89        'syscalls.mount04',
90        'syscalls.mount06',
91        'syscalls.rename11',
92        'syscalls.renameat01',
93        'syscalls.rmdir02',
94        'syscalls.umount01',
95        'syscalls.umount02',
96        'syscalls.umount03',
97        'syscalls.umount2_01',
98        'syscalls.umount2_02',
99        'syscalls.umount2_03',
100        'syscalls.utime06',
101        'syscalls.utimes01',
102        'syscalls.mkfs01',
103        'fs.quota_remount_test01',
104    ],
105    ltp_enums.Requirements.BIN_IN_PATH_LDD: ['commands.ldd'],
106}
107
108# Requirement for all test cases
109REQUIREMENT_FOR_ALL = [ltp_enums.Requirements.LTP_TMP_DIR]
110
111# Requirement to test suite dictionary
112REQUIREMENT_TO_TESTSUITE = {}
113
114# List of LTP test suites to run
115TEST_SUITES = [
116    'can',
117    'cap_bounds',
118    'commands',
119    'connectors',
120    'containers',
121    'controllers',
122    'cpuhotplug',
123    'cve',
124    'dio',
125    'fcntl-locktests_android',
126    'filecaps',
127    'fs',
128    'fs_bind',
129    'fs_perms_simple',
130    'fsx',
131    'hugetlb',
132    'hyperthreading',
133    'input',
134    'io',
135    'ipc',
136    'kernel_misc',
137    'math',
138    'mm',
139    'nptl',
140    'power_management_tests',
141    'pty',
142    'sched',
143    'securebits',
144    'syscalls',
145    'tracing',
146]
147
148# List of LTP test suites to run
149TEST_SUITES_LOW_MEM = [
150    'can',
151    'cap_bounds',
152    'commands',
153    'connectors',
154    'containers',
155    'cpuhotplug',
156    'cve',
157    'dio',
158    'fcntl-locktests_android',
159    'filecaps',
160    'fs',
161    'fs_bind',
162    'fs_perms_simple',
163    'fsx',
164    'hugetlb',
165    'hyperthreading',
166    'input',
167    'io',
168    'ipc',
169    'kernel_misc',
170    'math',
171    'mm',
172    'nptl',
173    'power_management_tests',
174    'pty',
175    'sched_low_mem',
176    'securebits',
177    'syscalls',
178    'tracing',
179]
180
181# List of LTP test suites that will not run in multi-thread mode
182TEST_SUITES_REQUIRE_SINGLE_THREAD_MODE = [
183    'dio',
184    'io',
185    'mm',
186    'timers',
187]
188