1#!/usr/bin/env python
2#
3# Copyright (C) 2020 The Android Open Source Project
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9#      http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#
17import os
18import sys
19from distutils.util import strtobool
20
21import ltp_test_cases
22from common import filter_utils
23
24def run(android_build_top, arch, n_bit, is_low_mem, is_hwasan, output_file):
25
26    android_build_top = android_build_top
27    ltp_tests = ltp_test_cases.LtpTestCases(
28        android_build_top, None)
29
30    test_filter = filter_utils.Filter()
31    ltp_tests.GenConfig(
32        arch,
33        n_bit,
34        test_filter,
35        output_file=output_file,
36        run_staging=False,
37        is_low_mem=is_low_mem,
38        is_hwasan=is_hwasan)
39
40if __name__ == '__main__':
41    if len(sys.argv) < 4:
42        print("use: %s n_bit output_file" % sys.argv[0])
43        sys.exit(1)
44    arch = sys.argv[1]
45    n_bit = sys.argv[2]
46    is_low_mem = strtobool(sys.argv[3])
47    is_hwasan = strtobool(sys.argv[4])
48    output_path = sys.argv[5]
49    run(os.environ['ANDROID_BUILD_TOP'], arch, n_bit, is_low_mem, is_hwasan, output_path)
50