From 3c07e5377af9ad30eedd5d7bdc4b1ca4e27353f9 Mon Sep 17 00:00:00 2001 From: mayuehit Date: Mon, 10 Nov 2025 12:44:15 +0000 Subject: [PATCH 1/6] update test/st/test.sh. Signed-off-by: mayuehit --- test/st/test.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/test/st/test.sh b/test/st/test.sh index 52af16a..cc729be 100644 --- a/test/st/test.sh +++ b/test/st/test.sh @@ -86,6 +86,7 @@ function generate_test_dir() { function install_python_pkg() { pip3.9 install pytest pip3.9 install requests + pip3.9 install numpy pip3.9 uninstall -y yr pip3.9 install $YUANRONG_DIR/runtime/sdk/python/yr_sdk-*cp39-cp39-linux_x86_64.whl } -- Gitee From e63506d7fa49281f655aaa93f1c673aad38c8dc0 Mon Sep 17 00:00:00 2001 From: mayuehit Date: Mon, 10 Nov 2025 12:46:00 +0000 Subject: [PATCH 2/6] update test/st/cpp/src/base/actor_test.cpp. Signed-off-by: mayuehit --- test/st/cpp/src/base/actor_test.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/st/cpp/src/base/actor_test.cpp b/test/st/cpp/src/base/actor_test.cpp index 0ff7f7e..00792a4 100644 --- a/test/st/cpp/src/base/actor_test.cpp +++ b/test/st/cpp/src/base/actor_test.cpp @@ -347,7 +347,7 @@ TEST_F(ActorTest, InvalidResource) } catch (YR::Exception &e) { printf("Exception:%s,\n", e.what()); std::string errorCode = "ErrCode: 1006"; - std::string errorMsg = "Required CPU resource size 299 millicores is invalid. Valid value range is [300,16000] millicores"; + std::string errorMsg = "Required CPU resource size 299 millicores is invalid. Valid value range is [0,16000] millicores"; std::string excepMsg = e.what(); ErrorMsgCheck(errorCode, errorMsg, excepMsg); } @@ -361,7 +361,7 @@ TEST_F(ActorTest, InvalidResource) } catch (YR::Exception &e) { printf("Exception:%s,\n", e.what()); std::string errorCode = "ErrCode: 1006"; - std::string errorMsg = "Required CPU resource size 16001 millicores is invalid. Valid value range is [300,16000] millicores"; + std::string errorMsg = "Required CPU resource size 16001 millicores is invalid. Valid value range is [0,16000] millicores"; std::string excepMsg = e.what(); ErrorMsgCheck(errorCode, errorMsg, excepMsg); } -- Gitee From 6d17413d7580e934910a6d53d8c8682020a67ebb Mon Sep 17 00:00:00 2001 From: mayuehit Date: Mon, 10 Nov 2025 12:48:12 +0000 Subject: [PATCH 3/6] update test/st/cpp/src/base/task_test.cpp. Signed-off-by: mayuehit --- test/st/cpp/src/base/task_test.cpp | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/test/st/cpp/src/base/task_test.cpp b/test/st/cpp/src/base/task_test.cpp index 7f53332..37b0013 100644 --- a/test/st/cpp/src/base/task_test.cpp +++ b/test/st/cpp/src/base/task_test.cpp @@ -83,38 +83,30 @@ TEST_F(TaskTest, InvokeSuccessfullyWithDifferentResource) /*case * @title: 非法的资源请求进行task调用 * @precondition: - * @step: 1. 以非法资源请求cpu=1,进行task函数调用 - * @step: 2. 以非法资源请求memory=1,进行task函数调用 - * @expect: 1.预期异常抛出,且错误码为1001,错误信息匹配 - * @expect: 2.预期异常抛出,且错误码为1001,错误信息匹配 + * @step: 1. 请求资源cpu=1,进行task函数调用 + * @step: 2. 请求资源memory=1,进行task函数调用 + * @expect: 1.预期成功 + * @expect: 2.预期成功 */ -TEST_F(TaskTest, InvalidResource) +TEST_F(TaskTest, TestResource) { - // invalid cpu + // cpu YR::InvokeOptions option; option.cpu = 1.0; try { auto r1 = YR::Function(&AddOne).Options(std::move(option)).Invoke(2); auto res = *YR::Get(r1); } catch (YR::Exception &e) { - std::string errorCode = "ErrCode: 1006"; - std::string errorMsg = "Required CPU resource size 1 millicores is invalid. Valid value range is [300,16000] millicores"; - std::string excepMsg = e.what(); - std::cout << "exception: " << excepMsg << std::endl; - ErrorMsgCheck(errorCode, errorMsg, excepMsg); + ASSERT_EQ(0, 1); } - // invalid memory + // memory YR::InvokeOptions optionMem; optionMem.memory = 1.0; try { auto r1 = YR::Function(&AddOne).Options(std::move(optionMem)).Invoke(2); auto res = *YR::Get(r1); } catch (YR::Exception &e) { - std::string errorCode = "ErrCode: 1006"; - std::string errorMsg = "Required memory resource size 1 MB is invalid. Valid value range is [128,1073741824] MB"; - std::string excepMsg = e.what(); - std::cout << "exception: " << excepMsg << std::endl; - ErrorMsgCheck(errorCode, errorMsg, excepMsg); + ASSERT_EQ(0, 1); } } -- Gitee From 8abfac2015fb295048cba5c6d18372a9d50c0ccc Mon Sep 17 00:00:00 2001 From: mayuehit Date: Tue, 11 Nov 2025 01:22:15 +0000 Subject: [PATCH 4/6] update test/st/cpp/src/base/actor_test.cpp. Signed-off-by: mayuehit --- test/st/cpp/src/base/actor_test.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/st/cpp/src/base/actor_test.cpp b/test/st/cpp/src/base/actor_test.cpp index 00792a4..79abc1b 100644 --- a/test/st/cpp/src/base/actor_test.cpp +++ b/test/st/cpp/src/base/actor_test.cpp @@ -361,7 +361,8 @@ TEST_F(ActorTest, InvalidResource) } catch (YR::Exception &e) { printf("Exception:%s,\n", e.what()); std::string errorCode = "ErrCode: 1006"; - std::string errorMsg = "Required CPU resource size 16001 millicores is invalid. Valid value range is [0,16000] millicores"; + std::string errorMsg = + "Required CPU resource size 16001 millicores is invalid. Valid value range is [0,16000] millicores"; std::string excepMsg = e.what(); ErrorMsgCheck(errorCode, errorMsg, excepMsg); } -- Gitee From 32df5c43abd6d608a20042ee6f00c41ec9387e60 Mon Sep 17 00:00:00 2001 From: mayuehit Date: Tue, 11 Nov 2025 01:23:41 +0000 Subject: [PATCH 5/6] update test/st/cpp/src/base/actor_test.cpp. Signed-off-by: mayuehit --- test/st/cpp/src/base/actor_test.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/st/cpp/src/base/actor_test.cpp b/test/st/cpp/src/base/actor_test.cpp index 79abc1b..8b49390 100644 --- a/test/st/cpp/src/base/actor_test.cpp +++ b/test/st/cpp/src/base/actor_test.cpp @@ -347,7 +347,8 @@ TEST_F(ActorTest, InvalidResource) } catch (YR::Exception &e) { printf("Exception:%s,\n", e.what()); std::string errorCode = "ErrCode: 1006"; - std::string errorMsg = "Required CPU resource size 299 millicores is invalid. Valid value range is [0,16000] millicores"; + std::string errorMsg = + "Required CPU resource size 299 millicores is invalid. Valid value range is [0,16000] millicores"; std::string excepMsg = e.what(); ErrorMsgCheck(errorCode, errorMsg, excepMsg); } -- Gitee From 5720c339ac682b4a1e23edbd48f3f5a46461c8e7 Mon Sep 17 00:00:00 2001 From: mayuehit Date: Tue, 11 Nov 2025 01:24:33 +0000 Subject: [PATCH 6/6] update test/st/test.sh. Signed-off-by: mayuehit --- test/st/test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/st/test.sh b/test/st/test.sh index cc729be..ef2e859 100644 --- a/test/st/test.sh +++ b/test/st/test.sh @@ -88,7 +88,7 @@ function install_python_pkg() { pip3.9 install requests pip3.9 install numpy pip3.9 uninstall -y yr - pip3.9 install $YUANRONG_DIR/runtime/sdk/python/yr_sdk-*cp39-cp39-linux_x86_64.whl + pip3.9 install $YUANRONG_DIR/runtime/sdk/python/yr_sdk-*cp39-cp39-linux*.whl } function common_check_st_result() { -- Gitee