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 re
20
21from test_base import Test
22
23
24class CmdDumpMetadata(Test):
25    def get_file_name(self):
26        return __file__
27
28    def run_cmd(self):
29        self.set_command_attr("--dump-metadata")
30        self.set_cmd_test_env()
31        return self.run_choose(True)
32
33    def run(self):
34        return self.run_cmd()
35
36    def deal_result(self, result):
37        # 处理size_以屏蔽不同操作系统的差异
38        output_string = re.sub(r'"size_" : "\d+"', '"size_" : "0"', result)
39        output_string = re.sub(r'"stringPoolSize_" : "\d+"', '"stringPoolSize_" : "0"', output_string)
40        return output_string
41
42
43if __name__ == "__main__":
44    CmdDumpMetadata().test()
45