Skip to content

Commit

Permalink
chore: add more CI test cases (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
halajohn authored Oct 14, 2024
1 parent 78c4ca6 commit 9b23789
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 17 deletions.
27 changes: 12 additions & 15 deletions .github/workflows/build_win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,24 +54,21 @@ jobs:
- name: Run Tests (ten_utils_unit_test)
env:
TEN_ENABLE_MEMORY_TRACKING: "true"
TEN_ENABLE_BACKTRACE_DUMP: "true"
run: |
chmod +x out/win/x64/tests/standalone/ten_utils_unit_test
out/win/x64/tests/standalone/ten_utils_unit_test
# - name: Run Tests (ten_runtime_unit_test)
# env:
# TEN_ENABLE_MEMORY_TRACKING: "true"
# TEN_ENABLE_BACKTRACE_DUMP: "true"
# run: |
# chmod +x out/win/x64/tests/standalone/ten_runtime_unit_test
# out/win/x64/tests/standalone/ten_runtime_unit_test
- name: Run Tests (ten_runtime_unit_test)
env:
TEN_ENABLE_BACKTRACE_DUMP: "true"
run: |
chmod +x out/win/x64/tests/standalone/ten_runtime_unit_test
out/win/x64/tests/standalone/ten_runtime_unit_test
# - name: Run Tests (ten_runtime_smoke_test)
# env:
# TEN_ENABLE_MEMORY_TRACKING: "true"
# TEN_ENABLE_BACKTRACE_DUMP: "true"
# run: |
# chmod +x out/win/x64/tests/standalone/ten_runtime_smoke_test
# out/win/x64/tests/standalone/ten_runtime_smoke_test
- name: Run Tests (ten_runtime_smoke_test)
env:
TEN_ENABLE_BACKTRACE_DUMP: "true"
run: |
chmod +x out/win/x64/tests/standalone/ten_runtime_smoke_test
out/win/x64/tests/standalone/ten_runtime_smoke_test
10 changes: 9 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"request": "launch",
"program": "${workspaceFolder}/out/linux/x64/tests/standalone/ten_runtime_unit_test",
"args": [
"--gtest_filter=SchemaTest.SchemaStoreValidateProperty"
// "--gtest_filter=TenErrorTest.cpp_thread"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}/out/linux/x64/",
Expand All @@ -59,6 +59,14 @@
{
"name": "LD_PRELOAD",
"value": "/usr/lib/gcc/x86_64-linux-gnu/10/libasan.so"
},
{
"name": "TEN_ENABLE_MEMORY_TRACKING",
"value": "true"
},
{
"name": "TEN_ENABLE_BACKTRACE_DUMP",
"value": "true"
}
],
"externalConsole": false,
Expand Down
4 changes: 3 additions & 1 deletion core/src/ten_utils/lib/sys/posix/mutex.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,13 @@ ten_mutex_t *ten_mutex_create(void) {
}

int ten_mutex_lock(ten_mutex_t *mutex) {
TEN_ASSERT(mutex && ten_mutex_check_integrity(mutex), "Invalid argument.");
TEN_ASSERT(mutex, "Invalid argument.");
if (!mutex) {
return -1;
}

TEN_ASSERT(ten_mutex_check_integrity(mutex), "Invalid argument.");

int rc = pthread_mutex_lock(&mutex->mutex);
if (rc) {
TEN_ASSERT(0, "Should not happen: %d", rc);
Expand Down
12 changes: 12 additions & 0 deletions core/src/ten_utils/sanitizer/memory_check.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ static void ten_sanitizer_memory_record_check_enabled(void) {
}

void ten_sanitizer_memory_record_init(void) {
#if defined(TEN_ENABLE_MEMORY_CHECK)

#if defined(TEN_USE_ASAN)
__lsan_disable();
#endif
Expand All @@ -73,9 +75,15 @@ void ten_sanitizer_memory_record_init(void) {
#if defined(TEN_USE_ASAN)
__lsan_enable();
#endif

#else
TEN_LOGI("The memory check is disabled.");
#endif
}

void ten_sanitizer_memory_record_deinit(void) {
#if defined(TEN_ENABLE_MEMORY_CHECK)

#if defined(TEN_USE_ASAN)
__lsan_disable();
#endif
Expand All @@ -89,6 +97,10 @@ void ten_sanitizer_memory_record_deinit(void) {
#if defined(TEN_USE_ASAN)
__lsan_enable();
#endif

#else
TEN_LOGI("The memory check is disabled.");
#endif
}

static ten_sanitizer_memory_record_t *ten_sanitizer_memory_record_create(
Expand Down

0 comments on commit 9b23789

Please sign in to comment.