diff --git a/.jenkins/check/config/filter_pylint.txt b/.jenkins/check/config/filter_pylint.txt index 8fc5a9052c1f31eac360b6e275d1e15e3cec107d..941cc5d01b6727cf7db77bc4e51d423bfc0e2f2e 100644 --- a/.jenkins/check/config/filter_pylint.txt +++ b/.jenkins/check/config/filter_pylint.txt @@ -14,6 +14,7 @@ "mindspore-lite/mindspore-lite/test/st/python/test_large_model_inference.py" "redefined-outer-name" "mindspore-lite/mindspore-lite/tools/kernel_builder/ascend/ascendc/cmake/util/insert_simplified_keys.py" "duplicate-key" "mindspore-lite/mindspore-lite/tools/kernel_builder/ascend/ascendc/cmake/util/replay_codegen.py" "bad-continuation" +"mindspore-lite/mindspore-lite/test/st/ops/frame/optest.py" "invalid-name" # ascend samples "mindspore-lite/mindspore-lite/tools/kernel_builder/ascend/tbe_dsl/sample/" "wrong-import-order" diff --git a/mindspore-lite/test/st/ops/frame/optest.py b/mindspore-lite/test/st/ops/frame/optest.py index 280a566a3eba846d126b4204181450c03855443d..414f22c218f2e520e1dd3ffde15cb949af633e0f 100644 --- a/mindspore-lite/test/st/ops/frame/optest.py +++ b/mindspore-lite/test/st/ops/frame/optest.py @@ -10,7 +10,7 @@ from onnx import helper import numpy as np class OpTest: - def __init__(self, config_file, output_path): + def __init__(self, config_file, output_path, package_path): self.config_file = config_file self.model_configs = conf.OnnxModelConfig(self.config_file) self.golden_confis = conf.GenGoldConfig(self.config_file) @@ -21,7 +21,7 @@ class OpTest: self.failed_test_name = [] self.failed_gold_in = [] self.ms_onnx_convert_reverse_dict = {} - mslite_package_path = os.getenv("MSLITE_PACKAGE_PATH") + mslite_package_path = package_path if mslite_package_path is None: raise Exception( diff --git a/mindspore-lite/test/st/ops/op/run.py b/mindspore-lite/test/st/ops/op/run.py index 36903b32745abc4d98c576b6525e7079cc7b5a13..9579cb863955f393bb4c44a10aa110a2fec7d484 100644 --- a/mindspore-lite/test/st/ops/op/run.py +++ b/mindspore-lite/test/st/ops/op/run.py @@ -6,7 +6,7 @@ import configs as conf -def run_all(output_path): +def run_all(output_path, package): current_directory = os.getcwd() current_directory = current_directory+"/ops/op" op_directories = [ @@ -29,7 +29,7 @@ def run_all(output_path): total_onnx_op_num += len(yaml_files) for yaml_file in yaml_files: yaml_path = current_directory + "/" + op_ + "/" + yaml_file - conv_test_suit = optest.OpTest(yaml_path, output_path) + conv_test_suit = optest.OpTest(yaml_path, output_path, package) conv_test_suit.exec_st() total_test_num += conv_test_suit.test_nums total_success_num += conv_test_suit.num_success @@ -49,7 +49,7 @@ def run_all(output_path): file.write("\n") -def run_one(output_path, op_name): +def run_one(output_path, op_name, package): current_directory = os.getcwd() op_dir = os.path.join(current_directory+"/ops/op", op_name) yaml_files = [f for f in os.listdir(op_dir) if f.endswith(".yaml")] @@ -59,7 +59,7 @@ def run_one(output_path, op_name): total_failed_gold_in = [] for yaml_file in yaml_files: yaml_path = op_dir + "/" + yaml_file - conv_test_suit = optest.OpTest(yaml_path, output_path) + conv_test_suit = optest.OpTest(yaml_path, output_path, package) conv_test_suit.exec_st() total_test_num += conv_test_suit.test_nums total_success_num += conv_test_suit.num_success @@ -76,15 +76,16 @@ if __name__ == "__main__": parser.add_argument("-a", "--all", action="store_true", help="是否测试全部算子") parser.add_argument("-o", "--output", type=str, help="输出路径", required=True) parser.add_argument("-n", "--name", type=str, help="测试算子名称") + parser.add_argument("-p", "--package", type=str, help="二进制包路径") args = parser.parse_args() if args.all and (args.name is not None): print("Can't set -a and -n same time!") start_time = time.time() if args.all: - run_all(args.output) + run_all(args.output, args.package) else: - run_one(args.output, args.name) + run_one(args.output, args.name, args.package) end_time = time.time() execution_time = end_time - start_time print(f"cost time: {execution_time:.6f} s") diff --git a/mindspore-lite/test/st/scripts/experimental/context.py b/mindspore-lite/test/st/scripts/experimental/context.py index 03ee19817b7fcda8428f21104fc7f3ef061a3a05..e1e0bcd054f3e6ca321a5ab9de6292725818865f 100644 --- a/mindspore-lite/test/st/scripts/experimental/context.py +++ b/mindspore-lite/test/st/scripts/experimental/context.py @@ -206,6 +206,7 @@ class Context: if not self.work_dir: self.work_dir = os.path.join(self.data_dir, "test_workspace") self.package_path = os.path.join(args.pkg_dir) + self.package_path = os.path.realpath(self.package_path) self.config_file = os.path.join(args.config_file) self.mode = TestMode.from_str(args.test_mode) self.exit_on_failed = args.exit_on_failed diff --git a/mindspore-lite/test/st/scripts/run_benchmark_arm64.sh b/mindspore-lite/test/st/scripts/run_benchmark_arm64.sh index 2b1b85739aa8fee6b55a6ac7a0f3ed4d17383065..9cf4e47ba211c4914b256d7a21149ed1212f8f32 100644 --- a/mindspore-lite/test/st/scripts/run_benchmark_arm64.sh +++ b/mindspore-lite/test/st/scripts/run_benchmark_arm64.sh @@ -249,7 +249,7 @@ adb -s ${device_id} shell "rm -rf /data/local/tmp/benchmark_test/*" echo "Run_arm64_fp32 and Run_arm64_fp16 single op st" cd ${MSLITE_OPST_PATH} || exit 1 cur_path=$(pwd) -PYTHONPATH=$cur_path/ops/frame python3 $cur_path/ops/op/run.py -o $cur_path/ops/output -a +PYTHONPATH=$cur_path/ops/frame python3 $cur_path/ops/op/run.py -o $cur_path/ops/output -p ${x86_path}/mindspore-lite-${version}-linux-x64/ -a op_st_output=$cur_path/ops/failed_tmp.txt line=$(cat "$op_st_output") echo $line