Name |
Date |
Size |
#Lines |
LOC |
||
---|---|---|---|---|---|---|
.. | - | - | ||||
performance_build.py | D | 12-May-2024 | 21.3 KiB | 477 | 409 | |
performance_config.py | D | 12-May-2024 | 6.9 KiB | 198 | 144 | |
performance_entry.py | D | 12-May-2024 | 9.1 KiB | 229 | 185 | |
readme.md | D | 12-May-2024 | 4.3 KiB | 125 | 104 | |
readme_zh.md | D | 12-May-2024 | 4.1 KiB | 125 | 104 |
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**AS = 1 DevEco = 2** 86IDE = 2 87 88**command for building** 89cmd_prefix = r"hvigorw.bat" 90**Start with space** 91cmd_debug_suffix = ' --mode module -p product=default assembleHap' 92cmd_release_suffix = ' --mode project -p product=default assembleApp' 93 94**The path of the package you have built** 95debug_package_path = r'entry\build\default\outputs\default\entry-default-unsigned.hap' 96release_package_path = r'entry\build\default\outputs\default\app\entry-default.hap' 97 98**When you test the incremental building, the code will be add into this file** 99incremental_code_path = 'entry\src\main\ets\pages\Index.ets' 100 101**add this code when incremental building test** 102incremental_code_str = "let index = 5 + 6\n" 103 104**the code will be add before the first position of this** 105incremental_code_end_pos = 'this.num = num' 106 107**when the code need to revert, this can help to find where the code you add** 108incremental_code_start_pos = "let index = 5 + 6\n" 109 110**file which controls aotCompileMode in type or not** 111json5_path = 'xxx/build-profile.json5' 112 113**the name of the directory which save the log files** 114log_direct = r"buildTestData" 115 116**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** 117output_split = "_" 118IDE_filename = ["AS", "DevEco"] 119debug_or_release = ["Debug", "Release"] 120build_type_of_log = ["Incremental", "fullBuild"] 121**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** 122log_filename = ["sizeAll.xlsx", "sizeAve.xlsx","timeAll.xlsx", "timeAve.xlsx"] 123 124**Do not build the project,use the test data if you need to debug the scripts** 125developing_test_mode = False
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**AS = 1 DevEco = 2** 86IDE = 2 87 88**构建使用的cmd指令** 89cmd_prefix = r"hvigorw.bat" 90**开头有空格** 91cmd_debug_suffix = ' --mode module -p product=default assembleHap' 92cmd_release_suffix = ' --mode project -p product=default assembleApp' 93 94**生成的安装包路径** 95debug_package_path = r'entry\build\default\outputs\default\entry-default-unsigned.hap' 96release_package_path = r'entry\build\default\outputs\default\app\entry-default.hap' 97 98**增量编译时修改以下文件** 99incremental_code_path = 'entry\src\main\ets\pages\Index.ets' 100 101**增量编译时添加以下代码** 102incremental_code_str = "let index = 5 + 6\n" 103 104**代码将会添加到下面这行代码的前面** 105incremental_code_end_pos = 'this.num = num' 106 107**通过找到下面的代码,来还原代码文件** 108incremental_code_start_pos = "let index = 5 + 6\n" 109 110**file which controls aotCompileMode in type or not** 111json5_path = 'xxx/build-profile.json5' 112 113**存放log文件的目录** 114log_direct = r"buildTestData" 115 116**输出的文件名,默认是[IDE_filename]_[debug_or_release]_[build_type_of_log]_[logFileName.xslx],比如:DevEco_Debug_Incremental_sizeAve.xlsx** 117output_split = "_" 118IDE_filename = ["AS", "DevEco"] 119debug_or_release = ["Debug", "Release"] 120build_type_of_log = ["Incremental", "fullBuild"] 121**size 表示log里记录了hap中abc的大小,time记录了构建耗时,All表示记录全部数据,Avg表示平均值** 122log_filename = ["sizeAll.xlsx", "sizeAve.xlsx","timeAll.xlsx", "timeAve.xlsx"] 123 124**跳过build阶段,使用测试数据,修改脚本时调试使用** 125developing_test_mode = False