• Home
Name Date Size #Lines LOC

..--

performance_build.pyD22-Oct-202521.2 KiB495417

performance_config.pyD22-Oct-20259.4 KiB227172

performance_entry.pyD22-Oct-20258.7 KiB224182

readme.mdD22-Oct-20254.9 KiB134111

readme_zh.mdD22-Oct-20254.7 KiB134111

test_error_report.jsonD22-Oct-20252.8 KiB10598

test_report.jsonD22-Oct-20252.4 KiB8983

readme.md

1# Automatic build performance
2
3## Purpose
4build specified projects serveral times and calculate the average value of build time and size of abc
5
6## How to use
7### environmoent
8Windows, pandas, json5, python3.9
9### How to run
10input the command in cmd: python performance_entry.py
11
12### Details of settings
13You need to modify in the performance_config.py
14project_path, node_js_path, jbr_path. These params must be set according your envronment!!! Other params use default.
15If you need to modify others, you can set in application_configs, refer to the 'HelloWorld'
16set run_list to run the projects
17```
18    send_mail = True
19    run_list = ["FTB", "FDY", "FWX"]
20
21    def __init__(self):
22        # Default config settings for all projects, if it's not what you need, config them in application_configs
23        self.cmd_prefix = r"hvigorw.bat"
24```
25
26```
27    def __init__(self):
28        ...
29
30        # Do not build the project,use the test data if you need to debug the scripts
31        self.developing_test_mode = False
32        # set your node_js path
33        self.node_js_path = r"C:/xxx"
34        # Must set according environment
35        self.jbr_path = r'xxx\DevEco Studio\jbr'
36```
37
38```
39application_configs = dict(
40    [
41        (
42            "FTB", dict
43                (
44                    project_path = r"D:\FTB",
45                )
46        ),
47        (
48            "FDY", dict
49                (
50                    project_path = r"D:\FDY",
51                )
52        ),
53        (
54            "FWX", dict
55                (
56                    project_path = r"D:\FWX",
57                )
58        ),
59        (
60            "HelloWorld", dict
61                (
62                    # The following params must be set according you environment
63                    project_path = r"xxx",
64
65                    # The following params is not neccessary to be modified
66                    debug_package_path = r'entry\build\default\outputs\default\entry-default-unsigned.hap',
67                    release_package_path = r'entry\build\default\outputs\default\app\entry-default.hap',
68                    incremental_code_path = r'entry\src\main\ets\pages\Index.ets',
69                    incremental_code_end_pos = 'build() {',
70                    incremental_code_str = "a: number = 5 + 6\n",
71                    incremental_code_start_pos = "a: number = 5 + 6\n",
72                )
73        )
74    ]
75)
76```
77
78More details:
79**path of jbr**
80jbr_path = r'xxx\DevEco Studio\jbr'
81
82**path of the project**
83project_path = r"xxx"
84
85**app name which showed in pictures**
86name = r'FTB'
87
88**AS = 1  DevEco = 2**
89IDE = 2
90
91**command for building**
92cmd_prefix = r"hvigorw.bat"
93**Start with space**
94cmd_debug_suffix = ' --mode module -p product=default assembleHap'
95cmd_release_suffix = ' --mode project -p product=default assembleApp'
96
97**The path of the package you have built**
98debug_package_path = r'entry\build\default\outputs\default\entry-default-unsigned.hap'
99release_package_path = r'entry\build\default\outputs\default\app\entry-default.hap'
100
101**When you test the incremental building, the code will be add into this file**
102incremental_code_path = 'entry\src\main\ets\pages\Index.ets'
103
104**add this code when incremental building test**
105incremental_code_str = "let index = 5 + 6\n"
106
107**the code will be add before the first position of this**
108incremental_code_end_pos = 'this.num = num'
109
110**when the code need to revert, this can help to find where the code you add**
111incremental_code_start_pos = "let index = 5 + 6\n"
112
113**file which controls aotCompileMode in type or not**
114json5_path = 'xxx/build-profile.json5'
115
116**the name of the directory which save the log files**
117log_direct = r"buildTestData"
118
119**filename of output logs, default name is [IDE_filename]_[debug_or_release]_[build_type_of_log]_[logFileName.xslx], for example: DevEco_Debug_Incremental_sizeAve.xlsx**
120output_split = "_"
121IDE_filename = ["AS", "DevEco"]
122debug_or_release = ["Debug", "Release"]
123build_type_of_log = ["Incremental", "fullBuild"]
124**size means this file record the size of abc in the package, time means the build cost time, All means it records all data, avg means it records the value of the data**
125log_filename = ["sizeAll.xlsx", "sizeAve.xlsx","timeAll.xlsx", "timeAve.xlsx"]
126
127**show detailed build cost time in html, delete this setting to hide this info**
128show_time_detail_filter = ["createProgram", "arkTSLinter", "tsProgramEmit",
129                            "generate content and source map information", "write obfuscated source code",
130                            "write source map (async)", "generate merged abc by es2abc (async)", "total build cost"
131                        ]
132
133**Do not build the project,use the test data if you need to debug the scripts,use '' to close this mode,test_report.json will test in build succeed case,test_error_report.json will test in build failed case**
134developing_test_mode = ''  

readme_zh.md

1# 自动构建性能测试脚本
2
3## 脚本目的
4自动构建指定的工程,构建多次后取平均值输出构建的时间以及abc的大小
5
6## 脚本使用
7### 运行环境
8测试自动化脚本运行环境为windows,pandas, json5, python3.9
9### 脚本运行
10输入命令 python performance_entry.py
11
12### 详细设置内容
13需要在performance_config.py中修改以下内容
14project_path,node_js_path,jbr_path 这三个必须根据环境配置,其他的可以用默认的
15如果不使用默认的,则可以像HelloWorld中那样配置
16修改run_list 以指定需要运行的工程
17```
18    send_mail = True
19    run_list = ["FTB", "FDY", "FWX"]
20
21    def __init__(self):
22        # Default config settings for all projects, if it's not what you need, config them in application_configs
23        self.cmd_prefix = r"hvigorw.bat"
24```
25
26```
27    def __init__(self):
28        ...
29
30        # Do not build the project,use the test data if you need to debug the scripts
31        self.developing_test_mode = False
32        # set your node_js path
33        self.node_js_path = r"C:/xxx"
34        # Must set according environment
35        self.jbr_path = r'xxx\DevEco Studio\jbr'
36```
37
38```
39application_configs = dict(
40    [
41        (
42            "FTB", dict
43                (
44                    project_path = r"D:\FTB",
45                )
46        ),
47        (
48            "FDY", dict
49                (
50                    project_path = r"D:\FDY",
51                )
52        ),
53        (
54            "FWX", dict
55                (
56                    project_path = r"D:\FWX",
57                )
58        ),
59        (
60            "HelloWorld", dict
61                (
62                    # The following params must be set according you environment
63                    project_path = r"xxx",
64
65                    # The following params is not neccessary to be modified
66                    debug_package_path = r'entry\build\default\outputs\default\entry-default-unsigned.hap',
67                    release_package_path = r'entry\build\default\outputs\default\app\entry-default.hap',
68                    incremental_code_path = r'entry\src\main\ets\pages\Index.ets',
69                    incremental_code_end_pos = 'build() {',
70                    incremental_code_str = "a: number = 5 + 6\n",
71                    incremental_code_start_pos = "a: number = 5 + 6\n",
72                )
73        )
74    ]
75)
76```
77
78更多细节:
79**jbr路径**
80jbr_path = r'xxx\DevEco Studio\jbr'
81
82**目标工程的路径**
83project_path = r"D"\xxx"
84
85**图片所示app的名字**
86name = r'FTB'
87
88**AS = 1  DevEco = 2**
89IDE = 2
90
91**构建使用的cmd指令**
92cmd_prefix = r"hvigorw.bat"
93**开头有空格**
94cmd_debug_suffix = ' --mode module -p product=default assembleHap'
95cmd_release_suffix = ' --mode project -p product=default assembleApp'
96
97**生成的安装包路径**
98debug_package_path = r'entry\build\default\outputs\default\entry-default-unsigned.hap'
99release_package_path = r'entry\build\default\outputs\default\app\entry-default.hap'
100
101**增量编译时修改以下文件**
102incremental_code_path = 'entry\src\main\ets\pages\Index.ets'
103
104**增量编译时添加以下代码**
105incremental_code_str = "let index = 5 + 6\n"
106
107**代码将会添加到下面这行代码的前面**
108incremental_code_end_pos = 'this.num = num'
109
110**通过找到下面的代码,来还原代码文件**
111incremental_code_start_pos = "let index = 5 + 6\n"
112
113**file which controls aotCompileMode in type or not**
114json5_path = 'xxx/build-profile.json5'
115
116**存放log文件的目录**
117log_direct = r"buildTestData"
118
119**输出的文件名,默认是[IDE_filename]_[debug_or_release]_[build_type_of_log]_[logFileName.xslx],比如:DevEco_Debug_Incremental_sizeAve.xlsx**
120output_split = "_"
121IDE_filename = ["AS", "DevEco"]
122debug_or_release = ["Debug", "Release"]
123build_type_of_log = ["Incremental", "fullBuild"]
124**size 表示log里记录了hap中abc的大小,time记录了构建耗时,All表示记录全部数据,Avg表示平均值**
125log_filename = ["sizeAll.xlsx", "sizeAve.xlsx","timeAll.xlsx", "timeAve.xlsx"]
126
127**配置的APP会显示更精细的构建耗时,不配置则不显示**
128show_time_detail_filter = ["createProgram", "arkTSLinter", "tsProgramEmit",
129                            "generate content and source map information", "write obfuscated source code",
130                            "write source map (async)", "generate merged abc by es2abc (async)", "total build cost"
131                        ]
132
133**跳过build阶段,使用测试数据,修改脚本时调试使用. ''为不使用测试模式,test_report.json测试构建成功的模式,test_error_report.json测试构建失败报错的场景**
134developing_test_data_path = ''