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
17from vts.testcases.kernel.ltp import ltp_enums
18from vts.testcases.kernel.ltp import ltp_configs
19from vts.testcases.kernel.ltp.shell_environment.definitions import directory_exists
20from vts.testcases.kernel.ltp.shell_environment.definitions import loop_device_support
21from vts.testcases.kernel.ltp.shell_environment.definitions import path_permission
22from vts.testcases.kernel.ltp.shell_environment.definitions import bin_in_path
23
24
25def GetRequrementDefinitions():
26    """Get requirement definition objects.
27
28    Get a dictionary in which keys are requirement names and
29    values are corresponding definition class object or a list
30    of such objects.
31    """
32    return {
33        ltp_enums.Requirements.LOOP_DEVICE_SUPPORT:
34            loop_device_support.LoopDeviceSupport(),
35        ltp_enums.Requirements.LTP_TMP_DIR: [
36            directory_exists.DirectoryExists(
37                paths=[ltp_configs.TMP, ltp_configs.TMPBASE,
38                       ltp_configs.LTPTMP, ltp_configs.TMPDIR],
39                to_check=False,
40                to_setup=True,
41                to_cleanup=True), path_permission.PathPermission(
42                    paths=[ltp_configs.TMP, ltp_configs.TMPBASE,
43                           ltp_configs.LTPTMP, ltp_configs.TMPDIR],
44                    permissions=777,
45                    to_check=False,
46                    to_setup=True,
47                    to_cleanup=False)
48        ],
49        ltp_enums.Requirements.BIN_IN_PATH_LDD:
50            bin_in_path.BinInPath(paths='ldd'),
51    }
52