Permalink
Browse files

core, feat: support --cov=filename to specify the cov filename (#368)

  • Loading branch information...
ngot authored and xicilion committed Nov 1, 2017
1 parent c8ac686 commit 95cf94caa87bba134c4d44283147a38a6e2dde90
Showing with 14 additions and 4 deletions.
  1. +1 −0 fibjs/include/options.h
  2. +6 −1 fibjs/src/base/options.cpp
  3. +7 −3 fibjs/src/process/process.cpp
View
@@ -18,6 +18,7 @@ extern bool g_prof;
extern int32_t g_prof_interval;
extern bool g_cov;
extern exlib::string g_cov_filename;
extern bool g_tracetcp;
}
@@ -25,6 +25,7 @@ bool g_prof = false;
int32_t g_prof_interval = 1000;
bool g_cov = false;
exlib::string g_cov_filename;
bool g_tracetcp = false;
@@ -48,7 +49,7 @@ static void printHelp()
" --prof-interval=n interval for --prof samples (in microseconds, default: 1000).\n"
" --prof-process process log file generated by profiler.start.\n"
"\n"
" --cov collect code coverage information (only work on the main Worker).\n"
" --cov[=filename] collect code coverage information (only work on the main Worker).\n"
" --cov-process generate code coverage analysis report.\n"
"\n"
" --v8-options print v8 command line options.\n"
@@ -92,6 +93,10 @@ void options(int32_t& pos, char* argv[])
if (g_prof_interval < 50)
g_prof_interval = 50;
df++;
} else if (!qstrcmp(arg, "--cov=", 6)) {
g_cov = true;
g_cov_filename = arg + 6;
df++;
} else if (!qstrcmp(arg, "--cov")) {
g_cov = true;
df++;
@@ -268,9 +268,13 @@ result_t process_base::exit()
flushLog();
if (g_cov && isolate->m_id == 1) {
char name[32];
sprintf(name, "fibjs-%08x.lcov", (uint32_t)(intptr_t)isolate);
WriteLcovData(isolate->m_isolate, name);
if (g_cov_filename.length() > 0) {
WriteLcovData(isolate->m_isolate, g_cov_filename.c_str());
} else {
char name[32];
sprintf(name, "fibjs-%08x.lcov", (uint32_t)(intptr_t)isolate);
WriteLcovData(isolate->m_isolate, name);
}
}
#ifdef _WIN32

0 comments on commit 95cf94c

Please sign in to comment.