Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Namespaces | Functions
TestRunner Namespace Reference

Namespaces

namespace  FlagValidators
 

Functions

void InitAndLogCmdlineArgs (int argc, char **argv)
 
bool ShouldRunTestCase (const char *name, CommandLineFlags::StringArray &matchFlag, CommandLineFlags::StringArray &skipFlag)
 
void Log (const char *format,...) SK_PRINTF_LIKE(1
 

Function Documentation

◆ InitAndLogCmdlineArgs()

void TestRunner::InitAndLogCmdlineArgs ( int  argc,
char **  argv 
)

Definition at line 88 of file TestRunner.cpp.

88 {
89#if defined(SK_BUILD_FOR_ANDROID)
90 // If true, sends SkDebugf to stdout as well.
91 //
92 // It is critical that we set this up as early in a test runner as possible, otherwise
93 // SK_ABORT(msg) and other similar macros will just print "Trap" to stdout without logging the
94 // message.
95 gSkDebugToStdOut = true;
96#endif
97
98 // Print command-line for debugging purposes.
99 if (argc < 2) {
100 TestRunner::Log("Test runner invoked with no arguments.");
101 } else {
102 std::ostringstream oss;
103 for (int i = 1; i < argc; i++) {
104 if (i > 1) {
105 oss << " ";
106 }
107 oss << argv[i];
108 }
109 TestRunner::Log("Test runner invoked with arguments: %s", oss.str().c_str());
110 }
111}
char ** argv
Definition library.h:9
void Log(const char *format,...) SK_PRINTF_LIKE(1

◆ Log()

void TestRunner::Log ( const char *  format,
  ... 
)

Definition at line 137 of file TestRunner.cpp.

137 {
138 std::time_t t = std::time(nullptr);
139 std::tm* now = std::gmtime(&t);
140 std::ostringstream oss;
141 oss << std::put_time(now, "%Y-%m-%d %H:%M:%S UTC");
142 printf("[%s] ", oss.str().c_str());
143
144 va_list args;
145 va_start(args, format);
146 vprintf(format, args);
147 va_end(args);
148
149 printf("\n");
150 fflush(stdout);
151}
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
uint32_t uint32_t * format

◆ ShouldRunTestCase()

bool TestRunner::ShouldRunTestCase ( const char *  name,
CommandLineFlags::StringArray matchFlag,
CommandLineFlags::StringArray skipFlag 
)

Definition at line 113 of file TestRunner.cpp.

115 {
116 for (int i = 0; i < skipFlag.size(); i++) {
117 std::regex re(skipFlag[i]);
118 if (std::regex_search(name, re)) {
119 return false;
120 }
121 }
122
123 if (matchFlag.isEmpty()) {
124 return true;
125 }
126
127 for (int i = 0; i < matchFlag.size(); i++) {
128 std::regex re(matchFlag[i]);
129 if (std::regex_search(name, re)) {
130 return true;
131 }
132 }
133
134 return false;
135}
const char * name
Definition fuchsia.cc:50