1#!/usr/bin/env python 2# -*- coding: utf-8 -*- 3# Copyright (c) 2022 Huawei Device Co., Ltd. 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 16import sys 17import os 18import argparse 19import shutil 20sys.path.append( 21 os.path.dirname(os.path.dirname(os.path.dirname( 22 os.path.abspath(__file__))))) 23 24def copy_file(fuzz_config_file_path, fuzz_config_file_output_path): 25 if not os.path.exists(fuzz_config_file_path): 26 raise Exception("fuzz_config_file_path '{}' doesn't exist.".format(fuzz_config_file_path)) 27 target_file_path = os.path.join(fuzz_config_file_output_path, os.path.basename(fuzz_config_file_path)) 28 if os.path.exists(target_file_path): 29 shutil.rmtree(target_file_path) 30 shutil.copytree(fuzz_config_file_path, target_file_path) 31 32def main(): 33 parser = argparse.ArgumentParser() 34 parser.add_argument('--fuzz-config-file-path', required=True) 35 parser.add_argument('--fuzz-config-file-output-path', required=True) 36 args = parser.parse_args() 37 38 copy_file(args.fuzz_config_file_path, args.fuzz_config_file_output_path) 39 return 0 40 41 42if __name__ == '__main__': 43 sys.exit(main()) 44