GCC Code Coverage Report
Directory: ../ Exec Total Coverage
File: /home/iojs/build/workspace/node-test-commit-linux-coverage-daily/nodes/benchmark/out/../tools/snapshot/node_mksnapshot.cc Lines: 18 22 81.8 %
Date: 2019-09-16 22:31:04 Branches: 6 12 50.0 %

Line Branch Exec Source
1
#include <cstdio>
2
#include <fstream>
3
#include <iostream>
4
#include <sstream>
5
#include <string>
6
#include <vector>
7
8
#include "libplatform/libplatform.h"
9
#include "node_internals.h"
10
#include "snapshot_builder.h"
11
#include "util-inl.h"
12
#include "v8.h"
13
14
#ifdef _WIN32
15
#include <windows.h>
16
17
int wmain(int argc, wchar_t* argv[]) {
18
#else   // UNIX
19
1
int main(int argc, char* argv[]) {
20
#endif  // _WIN32
21
22
1
  v8::V8::SetFlagsFromString("--random_seed=42");
23
24
1
  if (argc < 2) {
25
    std::cerr << "Usage: " << argv[0] << " <path/to/output.cc>\n";
26
    return 1;
27
  }
28
29
1
  std::ofstream out;
30
1
  out.open(argv[1], std::ios::out | std::ios::binary);
31
1
  if (!out.is_open()) {
32
    std::cerr << "Cannot open " << argv[1] << "\n";
33
    return 1;
34
  }
35
36
1
  int node_argc = 1;
37
1
  char argv0[] = "node";
38
1
  char* node_argv[] = {argv0, nullptr};
39
40
  node::InitializationResult result =
41
2
      node::InitializeOncePerProcess(node_argc, node_argv);
42
1
  CHECK(!result.early_return);
43
1
  CHECK_EQ(result.exit_code, 0);
44
45
  {
46
    std::string snapshot =
47
1
        node::SnapshotBuilder::Generate(result.args, result.exec_args);
48
1
    out << snapshot;
49
1
    out.close();
50
  }
51
52
1
  node::TearDownOncePerProcess();
53
2
  return 0;
54

3
}