1#!/usr/bin/env python3 2# -*- coding: utf-8 -*- 3 4# 5# Copyright (c) 2024 Huawei Device Co., Ltd. 6# Licensed under the Apache License, Version 2.0 (the "License"); 7# you may not use this file except in compliance with the License. 8# You may obtain a copy of the License at 9# 10# http://www.apache.org/licenses/LICENSE-2.0 11# 12# Unless required by applicable law or agreed to in writing, software 13# distributed under the License is distributed on an "AS IS" BASIS, 14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15# See the License for the specific language governing permissions and 16# limitations under the License. 17# 18 19import os 20 21from test_base import Test 22 23 24class CmdSaveMetadata(Test): 25 def get_file_name(self): 26 return __file__ 27 28 def run_cmd_save(self): 29 metadata_path = os.path.join(self.working_dir, "metadata.file") 30 self.set_command_attr(f" -s {metadata_path}") 31 self.set_cmd_test_env() 32 return self.run_choose(True, True) 33 34 def run_cmd_gen(self): 35 metadata_path = os.path.join(self.working_dir, "metadata.file") 36 self.command = f"{self._idl} --intf-type sa -s {metadata_path} -d {self.output_dir} --gen-cpp" 37 flag = self.run_choose(True) 38 os.remove(metadata_path) 39 return flag 40 41 def run(self): 42 return self.run_cmd_save() and self.run_cmd_gen() 43 44if __name__ == "__main__": 45 CmdSaveMetadata().test() 46 47