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: 17 21 81.0 %
Date: 2019-07-27 22:37:30 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
  if (argc < 2) {
23
    std::cerr << "Usage: " << argv[0] << " <path/to/output.cc>\n";
24
    return 1;
25
  }
26
27
1
  std::ofstream out;
28
1
  out.open(argv[1], std::ios::out | std::ios::binary);
29
1
  if (!out.is_open()) {
30
    std::cerr << "Cannot open " << argv[1] << "\n";
31
    return 1;
32
  }
33
34
1
  int node_argc = 1;
35
1
  char argv0[] = "node";
36
1
  char* node_argv[] = {argv0, nullptr};
37
38
  node::InitializationResult result =
39
2
      node::InitializeOncePerProcess(node_argc, node_argv);
40
1
  CHECK(!result.early_return);
41
1
  CHECK_EQ(result.exit_code, 0);
42
43
  {
44
    std::string snapshot =
45
1
        node::SnapshotBuilder::Generate(result.args, result.exec_args);
46
1
    out << snapshot;
47
1
    out.close();
48
  }
49
50
1
  node::TearDownOncePerProcess();
51
2
  return 0;
52

3
}