diff --git a/src/bq_log/log/log_snapshot.cpp b/src/bq_log/log/log_snapshot.cpp index 2ac4919..76b9d3c 100644 --- a/src/bq_log/log/log_snapshot.cpp +++ b/src/bq_log/log/log_snapshot.cpp @@ -91,7 +91,7 @@ namespace bq { if (cccc.load()) { cccc11.fetch_add(1); } - } else { + } else if(!snapshot_buffer_){ if (cccc.load()) { cccc12.fetch_add(1); } diff --git a/test/main.cpp b/test/main.cpp index 75a5193..12073ee 100644 --- a/test/main.cpp +++ b/test/main.cpp @@ -37,15 +37,6 @@ int32_t main() SetConsoleCP(CP_UTF8); #endif TEST_GROUP_BEGIN(Bq_Common_Test); - TEST_GROUP(Bq_Common_Test, bq::test, test_property); - TEST_GROUP(Bq_Common_Test, bq::test, test_basic_type); - TEST_GROUP(Bq_Common_Test, bq::test, test_optional); - TEST_GROUP(Bq_Common_Test, bq::test, test_array); - TEST_GROUP(Bq_Common_Test, bq::test, test_string); - TEST_GROUP(Bq_Common_Test, bq::test, test_hash_map); - TEST_GROUP(Bq_Common_Test, bq::test, test_utils); - TEST_GROUP(Bq_Common_Test, bq::test, test_file_manager); - TEST_GROUP(Bq_Common_Test, bq::test, test_thread_atomic); TEST_GROUP_END(Bq_Common_Test); TEST_GROUP_BEGIN(Bq_Log_Test); diff --git a/test/test_log.h b/test/test_log.h index 33b5df9..721bc64 100644 --- a/test/test_log.h +++ b/test/test_log.h @@ -163,7 +163,7 @@ namespace bq { while (!is_cancelled()) { bq::test::create_test_log_3_file_appender(snapshot_config[(int32_t)(begin_epoch_ms % 4)]); log_ptr->take_snapshot(false); - sleep(0); + sleep(begin_epoch_ms % 2); } } }; diff --git a/test/test_log_2.cpp b/test/test_log_2.cpp index aeb9b1e..e40acd4 100644 --- a/test/test_log_2.cpp +++ b/test/test_log_2.cpp @@ -66,7 +66,7 @@ namespace bq { } { - const uint64_t seconds = 10; + const uint64_t seconds = 1; test_output_dynamic_param(bq::log_level::info, "testing multithread string log. wait for %" PRIu64 " seconds please...\n if error exist, an assert will be triggered\n", seconds); multi_thread_string_test_modifier modifier_thread; diff --git a/test/test_log_3.cpp b/test/test_log_3.cpp index 86d8495..2d7ec03 100644 --- a/test/test_log_3.cpp +++ b/test/test_log_3.cpp @@ -874,7 +874,7 @@ namespace bq { snapshot_idx_mode = (snapshot_idx_mode % 1024) + 1; } - bq::util::log_device_console(bq::log_level::fatal, "%s\t, %p\t, 一:%d\t, 二:%d\t, 开始w:%d\t, w成功:%d\t, 读没b:%d\t, 读成功:%d\t, 删:%d\t, 换-分配失败:%d\t, 换-读:%d\t, 读失败原因:%d\t 换:%d\t 创:%d", ccc_continue.load() ? "Y" : "X", ccc_snapshot_obj.load(), cccc1.load(), cccc2.load(), cccc3.load(), cccc4.load(), cccc5.load(), cccc6.load(), cccc7.load(), cccc8.load(), cccc9.load(), cccc10.load(), cccc11.load(), cccc12.load()); + bq::util::log_device_console(bq::log_level::fatal, "%s\t, %p\t, 一:%d\t, 二:%d\t, 三开始w:%d\t, 四w成功:%d\t, 五读没b:%d\t, 六读成功:%d\t, 七删:%d\t, 八换-分配失败:%d\t, 九换-读:%d\t, 十读失败原因:%d\t 十一换:%d\t 十二创:%d", ccc_continue.load() ? "Y" : "X", ccc_snapshot_obj.load(), cccc1.load(), cccc2.load(), cccc3.load(), cccc4.load(), cccc5.load(), cccc6.load(), cccc7.load(), cccc8.load(), cccc9.load(), cccc10.load(), cccc11.load(), cccc12.load()); size_t new_percent = (size_t)(current_tested_num * 100 / total_test_num); if (new_percent != current_tested_percent) {