Skip to content

Commit 3e5de11

Browse files
authored
feat: add graph error handling tests and update build configurations (#712)
1 parent 15e369d commit 3e5de11

File tree

10 files changed

+35
-6
lines changed

10 files changed

+35
-6
lines changed

.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@
137137
"request": "launch",
138138
"program": "${workspaceFolder}/out/linux/x64/tests/standalone/ten_runtime_smoke_test",
139139
"args": [
140-
"--gtest_filter=PropertyTest.InGraphUseEnv3"
140+
"--gtest_filter=GraphTest.FailedToCreateExtension"
141141
],
142142
"cwd": "${workspaceFolder}/out/linux/x64/tests/standalone/",
143143
"env": {

core/src/ten_runtime/extension/ten_env/on_xxx.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,8 @@ bool ten_extension_on_init_done(ten_env_t *self) {
209209
"Should not happen.");
210210

211211
if (extension_thread->is_close_triggered) {
212+
// Do not proceed with the subsequent start flow, as the extension thread is
213+
// about to shut down.
212214
TEN_LOGD(
213215
"[%s] Since the close process has already been triggered, no further "
214216
"steps will be carried out after `on_init_done`. Enter `on_stop`"

core/src/ten_runtime/extension_thread/extension_thread.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,8 @@ static void ten_extension_thread_start_life_cycle_of_all_extensions_task(
441441
TEN_ASSERT(ten_extension_thread_check_integrity(self, true),
442442
"Should not happen.");
443443

444+
// The extension system is about to be shut down, so do not proceed with
445+
// initialization anymore.
444446
if (self->is_close_triggered) {
445447
return;
446448
}

tests/ten_runtime/smoke/BUILD.gn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ ten_executable("ten_runtime_smoke_test") {
4747
"extension_group",
4848
"failed_to_transfer_msg",
4949
"graph",
50+
"graph_error",
5051
"graph_name",
5152
"graph_test",
5253
"lock",
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#
2+
# Copyright © 2025 Agora
3+
# This file is part of TEN Framework, an open source project.
4+
# Licensed under the Apache License, Version 2.0, with certain conditions.
5+
# Refer to the "LICENSE" file in the root directory for more information.
6+
#
7+
import("//build/ten_runtime/glob.gni")
8+
import("//build/ten_runtime/ten.gni")
9+
10+
ten_runtime_glob("graph_error") {
11+
file_list = all_native_files
12+
deps = [
13+
"//third_party/msgpack:msgpackc",
14+
"//third_party/nlohmann_json",
15+
]
16+
include_dirs = [
17+
"//packages",
18+
"//tests/ten_runtime",
19+
]
20+
public_deps = [
21+
"//third_party/googlemock",
22+
"//third_party/googletest",
23+
]
24+
}

tests/ten_runtime/smoke/graph_test/failed_to_create_extension.cc renamed to tests/ten_runtime/smoke/graph_error/failed_to_create_extension.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ TEN_CONSTRUCTOR(
100100

101101
} // namespace
102102

103-
TEST(GraphTest, FailedToCreateExtension) { // NOLINT
103+
TEST(GraphErrorTest, FailedToCreateExtension) { // NOLINT
104104
auto *app_thread =
105105
ten_thread_create("app thread", test_app_thread_main, nullptr);
106106

tests/ten_runtime/smoke/predefined_graph/predefined_graph_incorrect_1.cc renamed to tests/ten_runtime/smoke/graph_error/predefined_graph_incorrect_1.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ TEN_CPP_REGISTER_ADDON_AS_EXTENSION(
7979

8080
} // namespace
8181

82-
TEST(PredefinedGraphTest, PredefinedGraphIncorrect1) { // NOLINT
82+
TEST(GraphErrorTest, PredefinedGraphIncorrect1) { // NOLINT
8383
auto *app_thread = ten_thread_create("app thread", app_thread_main, nullptr);
8484

8585
ten_thread_join(app_thread, -1);

tests/ten_runtime/smoke/predefined_graph/predefined_graph_incorrect_2.cc renamed to tests/ten_runtime/smoke/graph_error/predefined_graph_incorrect_2.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ TEN_CPP_REGISTER_ADDON_AS_EXTENSION(
8484

8585
} // namespace
8686

87-
TEST(PredefinedGraphTest, PredefinedGraphIncorrect2) { // NOLINT
87+
TEST(GraphErrorTest, PredefinedGraphIncorrect2) { // NOLINT
8888
auto *app_thread = ten_thread_create("app thread", app_thread_main, nullptr);
8989

9090
ten_thread_join(app_thread, -1);

tests/ten_runtime/smoke/predefined_graph/predefined_graph_incorrect_3.cc renamed to tests/ten_runtime/smoke/graph_error/predefined_graph_incorrect_3.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ TEN_CPP_REGISTER_ADDON_AS_EXTENSION(
8484

8585
} // namespace
8686

87-
TEST(PredefinedGraphTest, PredefinedGraphIncorrect3) { // NOLINT
87+
TEST(GraphErrorTest, PredefinedGraphIncorrect3) { // NOLINT
8888
auto *app_thread = ten_thread_create("app thread", app_thread_main, nullptr);
8989

9090
ten_thread_join(app_thread, -1);

tests/ten_runtime/smoke/property/property_in_graph_use_env_3.cc renamed to tests/ten_runtime/smoke/graph_error/property_in_graph_use_env_3.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ TEN_CPP_REGISTER_ADDON_AS_EXTENSION(property_in_graph_use_env_3__extension,
9898

9999
} // namespace
100100

101-
TEST(PropertyTest, DISABLED_InGraphUseEnv3) { // NOLINT
101+
TEST(GraphErrorTest, DISABLED_InGraphUseEnv3) { // NOLINT
102102
// Start app.
103103
auto *app_thread =
104104
ten_thread_create("app thread", test_app_thread_main, nullptr);

0 commit comments

Comments
 (0)