1#
2# Copyright (C) 2017 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"""Updates .bp, .mk, .xml files under test/vts-testcase/fuzz.
17
18Among files affected are:
19Config Files:
201. files matching: test/vts-testcase/fuzz/<hal_name>/<hal_version>/func_fuzzer/Android.mk
212. files matching: test/vts-testcase/fuzz/<hal_name>/<hal_version>/func_fuzzer/AndroidTest.xml
223. files matching: test/vts-testcase/fuzz/<hal_name>/<hal_version>/iface_fuzzer/Android.mk
234. files matching: test/vts-testcase/fuzz/<hal_name>/<hal_version>/iface_fuzzer/AndroidTest.xml
24
25
26Usage:
27    python test/vts-testcase/fuzz/script/update_configs.py
28"""
29
30import os
31import sys
32
33from config.config_gen import ConfigGen
34
35ANDROID_BUILD_TOP = os.environ.get('ANDROID_BUILD_TOP')
36if not ANDROID_BUILD_TOP:
37    print 'Run "lunch" command first.'
38    sys.exit(1)
39
40if __name__ == '__main__':
41    print 'Updating config files.'
42    HAL_SCRIPT_DIR = os.path.join(ANDROID_BUILD_TOP, 'test', 'vts-testcase',
43                                  'hal', 'script')
44    sys.path.append(HAL_SCRIPT_DIR)
45    config_gen = ConfigGen()
46    config_gen.UpdateFuzzerConfigs()
47