Classes | Namespaces | Enumerations | Functions | Variables
logging_unittest.cc File Reference
#include "config.h"
#include "utilities.h"
#include <fcntl.h>
#include <sys/stat.h>
#include <cstdio>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <memory>
#include <queue>
#include <sstream>
#include <string>
#include <vector>
#include "base/commandlineflags.h"
#include <glog/logging.h>
#include <glog/raw_logging.h>
#include "googletest.h"
Include dependency graph for logging_unittest.cc:

Go to the source code of this file.

Classes

struct  LogTimeRecorder
 
struct  MyLogger
 
struct  NewHook
 
struct  RecordDeletionLogger
 
class  TestLogSinkImpl
 
class  TestLogSinkWriter
 
class  TestWaitingLogSink
 
struct  UserDefinedClass
 

Namespaces

 base
 
 base::internal
 
 glog_internal_namespace_
 
 LogTimes
 

Enumerations

enum  { CASE_A, CASE_B }
 

Functions

static void BM_Check1 (int n)
 
static void BM_Check2 (int n)
 
static void BM_Check3 (int n)
 
static void BM_logspeed (int n)
 
static void BM_vlog (int n)
 
static void CheckFailure (int a, int b, const char *file, int line, const char *msg)
 
static void CheckFile (const string &name, const string &expected_string, const bool checkInFileOrNot=true)
 
 DECLARE_string (log_backtrace_at)
 
static void DeleteFiles (const string &pattern)
 
int64 elapsedTime_ns (const timespec &begin, const timespec &end)
 
bool base::internal::GetExitOnDFatal ()
 
static void GetFiles (const string &pattern, vector< string > *files)
 
static void LogWithLevels (int v, int severity, bool err, bool alsoerr)
 
int main (int argc, char **argv)
 
static void NoAllocNewHook ()
 
ostream & operator<< (ostream &out, const UserDefinedClass &)
 
std::ostream & operator<< (std::ostream &stream, LogTimeRecorder &t)
 
bool glog_internal_namespace_::SafeFNMatch_ (const char *pattern, size_t patt_len, const char *str, size_t str_len)
 
void base::internal::SetExitOnDFatal (bool value)
 
 TEST (CheckNOTNULL, Simple)
 
 TEST (DeathCheckNN, Simple)
 
 TEST (DeathNoAllocNewHook, logging)
 
 TEST (DeathRawCHECK, logging)
 
 TEST (DeathSTREQ, logging)
 
 TEST (SafeFNMatch, logging)
 
 TEST (Strerror, logging)
 
 TEST (UserDefinedClass, logging)
 
static void TestBasename ()
 
static void TestBasenameAppendWhenNoTimestamp ()
 
static void TestCHECK ()
 
static void TestCustomLoggerDeletionOnShutdown ()
 
static void TestDCHECK ()
 
static void TestErrno ()
 
static void TestExtension ()
 
static _END_GOOGLE_NAMESPACE_ void TestLogging (bool check_counts)
 
static void TestLoggingLevels ()
 
static void TestLogPeriodically ()
 
static void TestLogSink ()
 
static void TestLogSinkWaitTillSent ()
 
static void TestLogString ()
 
static void TestLogToString ()
 
static void TestOneTruncate (const char *path, uint64 limit, uint64 keep, size_t dsize, size_t ksize, size_t expect)
 
static void TestRawLogging ()
 
static void TestSTREQ ()
 
static void TestSymlink ()
 
static void TestTruncate ()
 
static void TestTwoProcessesWrite ()
 
int TestVlogHelper ()
 
static void TestVLogModule ()
 
static void TestWrapper ()
 
static _END_GOOGLE_NAMESPACE_ bool WrapSafeFNMatch (string pattern, string str)
 

Variables

static vector< stringglobal_messages
 
GLOG_CONSTEXPR int64_t LogTimes::LOG_PERIOD_NS = 10000000
 
GLOG_CONSTEXPR int64_t LogTimes::LOG_PERIOD_TOL_NS = 500000
 
GLOG_CONSTEXPR size_t LogTimes::MAX_CALLS = 10
 
static int x = -1
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
CASE_A 
CASE_B 

Definition at line 583 of file logging_unittest.cc.

Function Documentation

◆ BM_Check1()

static void BM_Check1 ( int  n)
static

Definition at line 121 of file logging_unittest.cc.

◆ BM_Check2()

static void BM_Check2 ( int  n)
static

Definition at line 150 of file logging_unittest.cc.

◆ BM_Check3()

static void BM_Check3 ( int  n)
static

Definition at line 136 of file logging_unittest.cc.

◆ BM_logspeed()

static void BM_logspeed ( int  n)
static

Definition at line 171 of file logging_unittest.cc.

◆ BM_vlog()

static void BM_vlog ( int  n)
static

Definition at line 178 of file logging_unittest.cc.

◆ CheckFailure()

static void CheckFailure ( int  a,
int  b,
const char *  file,
int  line,
const char *  msg 
)
static

Definition at line 167 of file logging_unittest.cc.

◆ CheckFile()

static void CheckFile ( const string name,
const string expected_string,
const bool  checkInFileOrNot = true 
)
static

Definition at line 716 of file logging_unittest.cc.

◆ DECLARE_string()

DECLARE_string ( log_backtrace_at  )

◆ DeleteFiles()

static void DeleteFiles ( const string pattern)
static

Definition at line 707 of file logging_unittest.cc.

◆ elapsedTime_ns()

int64 elapsedTime_ns ( const timespec &  begin,
const timespec &  end 
)

Definition at line 1074 of file logging_unittest.cc.

◆ GetFiles()

static void GetFiles ( const string pattern,
vector< string > *  files 
)
static

Definition at line 674 of file logging_unittest.cc.

◆ LogWithLevels()

void LogWithLevels ( int  v,
int  severity,
bool  err,
bool  alsoerr 
)
static

Definition at line 401 of file logging_unittest.cc.

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 185 of file logging_unittest.cc.

◆ NoAllocNewHook()

static void NoAllocNewHook ( )
static

Definition at line 326 of file logging_unittest.cc.

◆ operator<<() [1/2]

ostream& operator<< ( ostream &  out,
const UserDefinedClass  
)
inline

Definition at line 1463 of file logging_unittest.cc.

◆ operator<<() [2/2]

std::ostream& operator<< ( std::ostream &  stream,
LogTimeRecorder t 
)

Definition at line 1069 of file logging_unittest.cc.

◆ TEST() [1/8]

TEST ( CheckNOTNULL  ,
Simple   
)

Definition at line 658 of file logging_unittest.cc.

◆ TEST() [2/8]

TEST ( DeathCheckNN  ,
Simple   
)

Definition at line 669 of file logging_unittest.cc.

◆ TEST() [3/8]

TEST ( DeathNoAllocNewHook  ,
logging   
)

Definition at line 339 of file logging_unittest.cc.

◆ TEST() [4/8]

TEST ( DeathRawCHECK  ,
logging   
)

Definition at line 497 of file logging_unittest.cc.

◆ TEST() [5/8]

TEST ( DeathSTREQ  ,
logging   
)

Definition at line 648 of file logging_unittest.cc.

◆ TEST() [6/8]

TEST ( SafeFNMatch  ,
logging   
)

Definition at line 1122 of file logging_unittest.cc.

◆ TEST() [7/8]

TEST ( Strerror  ,
logging   
)

Definition at line 1301 of file logging_unittest.cc.

◆ TEST() [8/8]

TEST ( UserDefinedClass  ,
logging   
)

Definition at line 1468 of file logging_unittest.cc.

◆ TestBasename()

static void TestBasename ( )
static

Definition at line 737 of file logging_unittest.cc.

◆ TestBasenameAppendWhenNoTimestamp()

static void TestBasenameAppendWhenNoTimestamp ( )
static

Definition at line 753 of file logging_unittest.cc.

◆ TestCHECK()

void TestCHECK ( )
static

Definition at line 588 of file logging_unittest.cc.

◆ TestCustomLoggerDeletionOnShutdown()

static void TestCustomLoggerDeletionOnShutdown ( )
static

Definition at line 1002 of file logging_unittest.cc.

◆ TestDCHECK()

void TestDCHECK ( )
static

Definition at line 614 of file logging_unittest.cc.

◆ TestErrno()

static void TestErrno ( )
static

Definition at line 881 of file logging_unittest.cc.

◆ TestExtension()

static void TestExtension ( )
static

Definition at line 831 of file logging_unittest.cc.

◆ TestLogging()

void TestLogging ( bool  check_counts)
static

Definition at line 276 of file logging_unittest.cc.

◆ TestLoggingLevels()

void TestLoggingLevels ( )
static

Definition at line 466 of file logging_unittest.cc.

◆ TestLogPeriodically()

static void TestLogPeriodically ( )
static

Definition at line 1080 of file logging_unittest.cc.

◆ TestLogSink()

void TestLogSink ( )
static

Definition at line 549 of file logging_unittest.cc.

◆ TestLogSinkWaitTillSent()

static void TestLogSinkWaitTillSent ( )
static

Definition at line 1281 of file logging_unittest.cc.

◆ TestLogString()

void TestLogString ( )
static

Definition at line 504 of file logging_unittest.cc.

◆ TestLogToString()

void TestLogToString ( )
static

Definition at line 521 of file logging_unittest.cc.

◆ TestOneTruncate()

static void TestOneTruncate ( const char *  path,
uint64  limit,
uint64  keep,
size_t  dsize,
size_t  ksize,
size_t  expect 
)
static

Definition at line 889 of file logging_unittest.cc.

◆ TestRawLogging()

void TestRawLogging ( )
static

Definition at line 347 of file logging_unittest.cc.

◆ TestSTREQ()

void TestSTREQ ( )
static

Definition at line 634 of file logging_unittest.cc.

◆ TestSymlink()

static void TestSymlink ( )
static

Definition at line 812 of file logging_unittest.cc.

◆ TestTruncate()

static void TestTruncate ( )
static

Definition at line 936 of file logging_unittest.cc.

◆ TestTwoProcessesWrite()

static void TestTwoProcessesWrite ( )
static

Definition at line 779 of file logging_unittest.cc.

◆ TestVlogHelper()

int TestVlogHelper ( )

Definition at line 479 of file logging_unittest.cc.

◆ TestVLogModule()

void TestVLogModule ( )
static

Definition at line 486 of file logging_unittest.cc.

◆ TestWrapper()

static void TestWrapper ( )
static

Definition at line 868 of file logging_unittest.cc.

◆ WrapSafeFNMatch()

static _END_GOOGLE_NAMESPACE_ bool WrapSafeFNMatch ( string  pattern,
string  str 
)
static

Definition at line 1115 of file logging_unittest.cc.

Variable Documentation

◆ global_messages

vector<string> global_messages
static

Definition at line 1145 of file logging_unittest.cc.

◆ x

int x = -1
static

Definition at line 120 of file logging_unittest.cc.



libaditof
Author(s):
autogenerated on Wed May 21 2025 02:07:03