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 argparse 18import os 19import sys 20from distutils.util import strtobool 21 22import ltp_test_cases 23from common import filter_utils 24 25def run(android_build_top, arch, n_bit, is_low_mem, is_hwasan, run_staging, output_file): 26 27 android_build_top = android_build_top 28 ltp_tests = ltp_test_cases.LtpTestCases( 29 android_build_top, None) 30 31 test_filter = filter_utils.Filter() 32 ltp_tests.GenConfig( 33 arch, 34 n_bit, 35 test_filter, 36 output_file=output_file, 37 run_staging=run_staging, 38 is_low_mem=is_low_mem, 39 is_hwasan=is_hwasan) 40 41if __name__ == '__main__': 42 arg_parser = argparse.ArgumentParser( 43 description='Generate LTP configuration files for VTS') 44 arg_parser.add_argument('--arch', 45 dest='arch', 46 type=str, 47 choices=['arm', 'x86'], 48 required=True, 49 help="Target device architecture") 50 arg_parser.add_argument('--bitness', 51 dest='bitness', 52 type=int, 53 choices=[32, 64], 54 required=True, 55 help="Target device architecture bitness") 56 arg_parser.add_argument('--low-mem', 57 dest='is_low_mem', 58 type=str, 59 choices=['True', 'False'], 60 required=True, 61 help="Target device is low memory device") 62 arg_parser.add_argument('--hwasan', 63 dest='is_hwasan', 64 type=str, 65 choices=['True', 'False'], 66 required=True, 67 help="Target device is hwasan") 68 arg_parser.add_argument('--staging', 69 dest='run_staging', 70 type=str, 71 choices=['True', 'False'], 72 default="False", 73 help="Run all the tests, except from the disabled ones") 74 arg_parser.add_argument('output_file_path', 75 nargs=1, 76 help="Path for the output file") 77 args = arg_parser.parse_args() 78 79 run(android_build_top=os.environ['ANDROID_BUILD_TOP'], 80 arch=args.arch, 81 n_bit=str(args.bitness), 82 is_low_mem=strtobool(args.is_low_mem), 83 is_hwasan=strtobool(args.is_hwasan), 84 run_staging=strtobool(args.run_staging), 85 output_file=args.output_file_path[0]) 86