< prev index next >

test/native/logging/test_log.cpp

Print this page
rev 12483 : 8172098: A lot of gtests uses TEST instead of TEST_VM
Reviewed-by: duke

*** 39,56 **** assert(ret > 0, "Failed to print prefix. Log buffer too small?"); return (size_t) ret; } #ifdef ASSERT // 'test' tag is debug only ! TEST_F(LogTest, prefix) { set_log_config(TestLogFileName, "logging+test=trace"); log_trace(logging, test)(LOG_LINE_STR); EXPECT_TRUE(file_contains_substring(TestLogFileName, LOG_PREFIX_STR LOG_LINE_STR)); } #endif ! TEST_F(LogTest, large_message) { char big_msg[4096] = {0}; char Xchar = '~'; set_log_config(TestLogFileName, "logging=trace"); --- 39,56 ---- assert(ret > 0, "Failed to print prefix. Log buffer too small?"); return (size_t) ret; } #ifdef ASSERT // 'test' tag is debug only ! TEST_VM_F(LogTest, prefix) { set_log_config(TestLogFileName, "logging+test=trace"); log_trace(logging, test)(LOG_LINE_STR); EXPECT_TRUE(file_contains_substring(TestLogFileName, LOG_PREFIX_STR LOG_LINE_STR)); } #endif ! TEST_VM_F(LogTest, large_message) { char big_msg[4096] = {0}; char Xchar = '~'; set_log_config(TestLogFileName, "logging=trace");
*** 66,76 **** size_t count = 0; for (size_t ps = 0 ; output[ps + count] != '\0'; output[ps + count] == Xchar ? count++ : ps++); EXPECT_EQ(sizeof(big_msg) - 1, count); } ! TEST_F(LogTest, enabled_logtarget) { set_log_config(TestLogFileName, "gc=debug"); LogTarget(Debug, gc) log; EXPECT_TRUE(log.is_enabled()); --- 66,76 ---- size_t count = 0; for (size_t ps = 0 ; output[ps + count] != '\0'; output[ps + count] == Xchar ? count++ : ps++); EXPECT_EQ(sizeof(big_msg) - 1, count); } ! TEST_VM_F(LogTest, enabled_logtarget) { set_log_config(TestLogFileName, "gc=debug"); LogTarget(Debug, gc) log; EXPECT_TRUE(log.is_enabled());
*** 78,88 **** log.print(LOG_TEST_STRING_LITERAL); EXPECT_TRUE(file_contains_substring(TestLogFileName, LOG_TEST_STRING_LITERAL)); } ! TEST_F(LogTest, disabled_logtarget) { set_log_config(TestLogFileName, "gc=info"); LogTarget(Debug, gc) log; EXPECT_FALSE(log.is_enabled()); --- 78,88 ---- log.print(LOG_TEST_STRING_LITERAL); EXPECT_TRUE(file_contains_substring(TestLogFileName, LOG_TEST_STRING_LITERAL)); } ! TEST_VM_F(LogTest, disabled_logtarget) { set_log_config(TestLogFileName, "gc=info"); LogTarget(Debug, gc) log; EXPECT_FALSE(log.is_enabled());
*** 93,103 **** log_info(gc)("Dummy line"); EXPECT_FALSE(file_contains_substring(TestLogFileName, LOG_TEST_STRING_LITERAL)); } ! TEST_F(LogTest, enabled_loghandle) { set_log_config(TestLogFileName, "gc=debug"); Log(gc) log; LogHandle log_handle(log); --- 93,103 ---- log_info(gc)("Dummy line"); EXPECT_FALSE(file_contains_substring(TestLogFileName, LOG_TEST_STRING_LITERAL)); } ! TEST_VM_F(LogTest, enabled_loghandle) { set_log_config(TestLogFileName, "gc=debug"); Log(gc) log; LogHandle log_handle(log);
*** 107,117 **** log_handle.debug("%d workers", 3); EXPECT_TRUE(file_contains_substring(TestLogFileName, "3 workers")); } ! TEST_F(LogTest, disabled_loghandle) { set_log_config(TestLogFileName, "gc=info"); Log(gc) log; LogHandle log_handle(log); --- 107,117 ---- log_handle.debug("%d workers", 3); EXPECT_TRUE(file_contains_substring(TestLogFileName, "3 workers")); } ! TEST_VM_F(LogTest, disabled_loghandle) { set_log_config(TestLogFileName, "gc=info"); Log(gc) log; LogHandle log_handle(log);
*** 124,134 **** log_info(gc)("Dummy line"); EXPECT_FALSE(file_contains_substring(TestLogFileName, "3 workers")); } ! TEST_F(LogTest, enabled_logtargethandle) { set_log_config(TestLogFileName, "gc=debug"); LogTarget(Debug, gc) log; LogTargetHandle log_handle(log); --- 124,134 ---- log_info(gc)("Dummy line"); EXPECT_FALSE(file_contains_substring(TestLogFileName, "3 workers")); } ! TEST_VM_F(LogTest, enabled_logtargethandle) { set_log_config(TestLogFileName, "gc=debug"); LogTarget(Debug, gc) log; LogTargetHandle log_handle(log);
*** 138,148 **** log_handle.print("%d workers", 3); EXPECT_TRUE(file_contains_substring(TestLogFileName, "3 workers")); } ! TEST_F(LogTest, disabled_logtargethandle) { set_log_config(TestLogFileName, "gc=info"); LogTarget(Debug, gc) log; LogTargetHandle log_handle(log); --- 138,148 ---- log_handle.print("%d workers", 3); EXPECT_TRUE(file_contains_substring(TestLogFileName, "3 workers")); } ! TEST_VM_F(LogTest, disabled_logtargethandle) { set_log_config(TestLogFileName, "gc=info"); LogTarget(Debug, gc) log; LogTargetHandle log_handle(log);
< prev index next >