diff --git a/.github/workflows/build_win.yml b/.github/workflows/build_win.yml index 7ccec6f716..d819d5411b 100644 --- a/.github/workflows/build_win.yml +++ b/.github/workflows/build_win.yml @@ -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 diff --git a/.vscode/launch.json b/.vscode/launch.json index a8d74cb9fc..df34bc8443 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -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/", @@ -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, diff --git a/core/src/ten_utils/lib/sys/posix/mutex.c b/core/src/ten_utils/lib/sys/posix/mutex.c index 45936e1ba0..783f93e0d8 100644 --- a/core/src/ten_utils/lib/sys/posix/mutex.c +++ b/core/src/ten_utils/lib/sys/posix/mutex.c @@ -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); diff --git a/core/src/ten_utils/sanitizer/memory_check.c b/core/src/ten_utils/sanitizer/memory_check.c index e3c689eb6b..bf90854d8b 100644 --- a/core/src/ten_utils/sanitizer/memory_check.c +++ b/core/src/ten_utils/sanitizer/memory_check.c @@ -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 @@ -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 @@ -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(