GCC Code Coverage Report
Directory: ../ Exec Total Coverage
File: /home/iojs/build/workspace/node-test-commit-linux-coverage-daily/nodes/benchmark/out/../src/node_config.cc Lines: 19 19 100.0 %
Date: 2019-02-13 22:28:58 Branches: 0 0 - %

Line Branch Exec Source
1
#include "env-inl.h"
2
#include "node.h"
3
#include "node_i18n.h"
4
#include "node_options-inl.h"
5
#include "util-inl.h"
6
7
namespace node {
8
9
using v8::Boolean;
10
using v8::Context;
11
using v8::Integer;
12
using v8::Isolate;
13
using v8::Local;
14
using v8::Number;
15
using v8::Object;
16
using v8::Value;
17
18
// The config binding is used to provide an internal view of compile or runtime
19
// config options that are required internally by lib/*.js code. This is an
20
// alternative to dropping additional properties onto the process object as
21
// has been the practice previously in node.cc.
22
23
4416
static void Initialize(Local<Object> target,
24
                       Local<Value> unused,
25
                       Local<Context> context) {
26
4416
  Environment* env = Environment::GetCurrent(context);
27
4416
  Isolate* isolate = env->isolate();
28
29
#if defined(DEBUG) && DEBUG
30
  READONLY_TRUE_PROPERTY(target, "isDebugBuild");
31
#else
32
13248
  READONLY_FALSE_PROPERTY(target, "isDebugBuild");
33
#endif  // defined(DEBUG) && DEBUG
34
35
#if HAVE_OPENSSL
36
13248
  READONLY_TRUE_PROPERTY(target, "hasOpenSSL");
37
#else
38
  READONLY_FALSE_PROPERTY(target, "hasOpenSSL");
39
#endif  // HAVE_OPENSSL
40
41
#ifdef NODE_FIPS_MODE
42
  READONLY_TRUE_PROPERTY(target, "fipsMode");
43
  // TODO(addaleax): Use options parser variable instead.
44
  if (per_process::cli_options->force_fips_crypto)
45
    READONLY_TRUE_PROPERTY(target, "fipsForced");
46
#endif
47
48
#ifdef NODE_HAVE_I18N_SUPPORT
49
50
13248
  READONLY_TRUE_PROPERTY(target, "hasIntl");
51
52
#ifdef NODE_HAVE_SMALL_ICU
53
13248
  READONLY_TRUE_PROPERTY(target, "hasSmallICU");
54
#endif  // NODE_HAVE_SMALL_ICU
55
56
#if NODE_USE_V8_PLATFORM
57
13248
  READONLY_TRUE_PROPERTY(target, "hasTracing");
58
#endif
59
60
#if !defined(NODE_WITHOUT_NODE_OPTIONS)
61
13248
  READONLY_TRUE_PROPERTY(target, "hasNodeOptions");
62
#endif
63
64
#endif  // NODE_HAVE_I18N_SUPPORT
65
66
#if HAVE_INSPECTOR
67
13248
  READONLY_TRUE_PROPERTY(target, "hasInspector");
68
#else
69
  READONLY_FALSE_PROPERTY(target, "hasInspector");
70
#endif
71
72
17664
  READONLY_PROPERTY(target,
73
                    "bits",
74
                    Number::New(env->isolate(), 8 * sizeof(intptr_t)));
75
76
4416
  Local<Object> debug_options_obj = Object::New(isolate);
77
13248
  READONLY_PROPERTY(target, "debugOptions", debug_options_obj);
78
79
4416
  const DebugOptions& debug_options = env->options()->debug_options();
80
17664
  READONLY_PROPERTY(debug_options_obj,
81
                    "inspectorEnabled",
82
                    Boolean::New(isolate, debug_options.inspector_enabled));
83
17664
  READONLY_STRING_PROPERTY(
84
      debug_options_obj, "host", debug_options.host_port.host());
85
17664
  READONLY_PROPERTY(debug_options_obj,
86
                    "port",
87
                    Integer::New(isolate, debug_options.host_port.port()));
88
4416
}  // InitConfig
89
90
}  // namespace node
91
92
4314
NODE_MODULE_CONTEXT_AWARE_INTERNAL(config, node::Initialize)