From d39cbf911fd19ac25fee9b12d6130471bb139a39 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Mon, 5 Feb 2018 14:57:13 +0100 Subject: [PATCH 1/4] build: add node_lib_target_name to cctest deps Currently the cctest target depend on the node_core_target_name target. But it is the node_lib_target_name target that compiles the sources now which means that if a source file in src is updated the cctest executable will not be re-linked against it, but will remain unchanged. The code will still be compiled, just not linked which means that if you are debugging you'll not see the changes and also a warning will be displayed about this issue. This commit changes the cctest target to depend on node_lib_target_name. --- node.gyp | 131 +-------------------------------- test/cctest/node_module_reg.cc | 30 -------- 2 files changed, 3 insertions(+), 158 deletions(-) delete mode 100644 test/cctest/node_module_reg.cc diff --git a/node.gyp b/node.gyp index 826543a9d17ce1..499cc767e03405 100644 --- a/node.gyp +++ b/node.gyp @@ -911,8 +911,7 @@ 'type': 'executable', 'dependencies': [ - '<(node_core_target_name)', - 'rename_node_bin_win', + '<(node_lib_target_name)', 'deps/gtest/gtest.gyp:gtest', 'node_js2c#host', 'node_dtrace_header', @@ -920,39 +919,6 @@ 'node_dtrace_provider', ], - 'variables': { - 'obj_path': '<(obj_dir)/<(node_lib_target_name)/src', - 'obj_gen_path': '<(obj_dir)/<(node_lib_target_name)/gen', - 'obj_tracing_path': '<(obj_dir)/<(node_lib_target_name)/src/tracing', - 'obj_suffix': 'o', - 'obj_separator': '/', - 'conditions': [ - ['OS=="win"', { - 'obj_suffix': 'obj', - }], - ['GENERATOR=="ninja"', { - 'obj_path': '<(obj_dir)/src', - 'obj_gen_path': '<(obj_dir)/gen', - 'obj_tracing_path': '<(obj_dir)/src/tracing', - 'obj_separator': '/<(node_lib_target_name).', - }, { - 'conditions': [ - ['OS=="win"', { - 'obj_path': '<(obj_dir)/<(node_lib_target_name)', - 'obj_gen_path': '<(obj_dir)/<(node_lib_target_name)', - 'obj_tracing_path': '<(obj_dir)/<(node_lib_target_name)', - }], - ['OS=="aix"', { - 'obj_path': '<(obj_dir)/<(node_lib_target_name)/src', - 'obj_gen_path': '<(obj_dir)/<(node_lib_target_name)/gen', - 'obj_tracing_path': - '<(obj_dir)/<(node_lib_target_name)/src/tracing', - }], - ]} - ] - ], - }, - 'includes': [ 'node.gypi' ], @@ -969,7 +935,6 @@ 'defines': [ 'NODE_WANT_INTERNALS=1' ], 'sources': [ - 'test/cctest/node_module_reg.cc', 'test/cctest/node_test_fixture.cc', 'test/cctest/test_aliased_buffer.cc', 'test/cctest/test_base64.cc', @@ -979,120 +944,30 @@ 'test/cctest/test_url.cc' ], - 'libraries': [ - '<(obj_path)<(obj_separator)async_wrap.<(obj_suffix)', - '<(obj_path)<(obj_separator)handle_wrap.<(obj_suffix)', - '<(obj_path)<(obj_separator)env.<(obj_suffix)', - '<(obj_path)<(obj_separator)node.<(obj_suffix)', - '<(obj_path)<(obj_separator)node_buffer.<(obj_suffix)', - '<(obj_path)<(obj_separator)node_debug_options.<(obj_suffix)', - '<(obj_path)<(obj_separator)node_i18n.<(obj_suffix)', - '<(obj_path)<(obj_separator)node_perf.<(obj_suffix)', - '<(obj_path)<(obj_separator)node_platform.<(obj_suffix)', - '<(obj_path)<(obj_separator)node_url.<(obj_suffix)', - '<(obj_path)<(obj_separator)util.<(obj_suffix)', - '<(obj_path)<(obj_separator)string_bytes.<(obj_suffix)', - '<(obj_path)<(obj_separator)string_decoder.<(obj_suffix)', - '<(obj_path)<(obj_separator)string_search.<(obj_suffix)', - '<(obj_path)<(obj_separator)stream_base.<(obj_suffix)', - '<(obj_path)<(obj_separator)node_constants.<(obj_suffix)', - '<(obj_tracing_path)<(obj_separator)agent.<(obj_suffix)', - '<(obj_tracing_path)<(obj_separator)node_trace_buffer.<(obj_suffix)', - '<(obj_tracing_path)<(obj_separator)node_trace_writer.<(obj_suffix)', - '<(obj_tracing_path)<(obj_separator)trace_event.<(obj_suffix)', - '<(obj_gen_path)<(obj_separator)node_javascript.<(obj_suffix)', - ], - 'conditions': [ [ 'node_use_openssl=="true"', { - 'conditions': [ - ['node_target_type!="static_library"', { - 'libraries': [ - '<(obj_path)<(obj_separator)node_crypto.<(obj_suffix)', - '<(obj_path)<(obj_separator)node_crypto_bio.<(obj_suffix)', - '<(obj_path)<(obj_separator)node_crypto_clienthello.<(obj_suffix)', - '<(obj_path)<(obj_separator)tls_wrap.<(obj_suffix)', - ], - }], - ], 'defines': [ 'HAVE_OPENSSL=1', ], }], [ 'node_use_perfctr=="true"', { 'defines': [ 'HAVE_PERFCTR=1' ], - 'libraries': [ - '<(obj_path)<(obj_separator)node_counters.<(obj_suffix)', - '<(obj_path)<(obj_separator)' - 'node_win32_perfctr_provider.<(obj_suffix)', - ], }], ['v8_enable_inspector==1', { 'sources': [ 'test/cctest/test_inspector_socket.cc', 'test/cctest/test_inspector_socket_server.cc' ], - 'conditions': [ - ['node_target_type!="static_library"', { - 'libraries': [ - '<(obj_path)<(obj_separator)inspector_agent.<(obj_suffix)', - '<(obj_path)<(obj_separator)inspector_io.<(obj_suffix)', - '<(obj_path)<(obj_separator)inspector_js_api.<(obj_suffix)', - '<(obj_path)<(obj_separator)inspector_socket.<(obj_suffix)', - '<(obj_path)<(obj_separator)inspector_socket_server.<(obj_suffix)', - ], - }], - ], 'defines': [ 'HAVE_INSPECTOR=1', ], - }], - [ 'node_use_dtrace=="true" and node_target_type!="static_library"', { - 'libraries': [ - '<(obj_path)<(obj_separator)node_dtrace.<(obj_suffix)', - ], - 'conditions': [ - ['OS!="mac" and OS!="linux"', { - 'libraries': [ - '<(obj_path)<(obj_separator)node_dtrace_provider.<(obj_suffix)', - '<(obj_path)<(obj_separator)node_dtrace_ustack.<(obj_suffix)', - ] - }], - ['OS=="linux"', { - 'libraries': [ - '<(SHARED_INTERMEDIATE_DIR)<(obj_separator)' - 'node_dtrace_provider.<(obj_suffix)', - ] - }], - ], - }, { - 'conditions': [ - [ 'node_use_etw=="true" and OS=="win"', { - 'libraries': [ - '<(obj_path)<(obj_separator)node_dtrace.<(obj_suffix)', - '<(obj_path)<(obj_separator)' - 'node_win32_etw_provider.<(obj_suffix)', - ], - }] - ] - }], - [ 'OS=="win" and node_target_type!="static_library"', { - 'libraries': [ - '<(obj_path)<(obj_separator)backtrace_win32.<(obj_suffix)', - ], }, { - 'conditions': [ - ['node_target_type!="static_library"', { - 'libraries': [ - '<(obj_path)<(obj_separator)backtrace_posix.<(obj_suffix)', - ], - }], - ], + 'defines': [ 'HAVE_INSPECTOR=0' ] }], ['OS=="solaris"', { 'ldflags': [ '-I<(SHARED_INTERMEDIATE_DIR)' ] }], - ] + ], } ], # end targets diff --git a/test/cctest/node_module_reg.cc b/test/cctest/node_module_reg.cc deleted file mode 100644 index bd4f20bc9f823d..00000000000000 --- a/test/cctest/node_module_reg.cc +++ /dev/null @@ -1,30 +0,0 @@ -// Need to create empty definition for these modules' -// registration function for cctest. Because when -// building cctest, the definitions for the following -// registration functions are not included. -void _register_cares_wrap() {} -void _register_config() {} -void _register_contextify() {} -void _register_domain() {} -void _register_fs() {} -void _register_fs_event_wrap() {} -void _register_http2() {} -void _register_http_parser() {} -void _register_js_stream() {} -void _register_module_wrap() {} -void _register_os() {} -void _register_pipe_wrap() {} -void _register_process_wrap() {} -void _register_serdes() {} -void _register_signal_wrap() {} -void _register_spawn_sync() {} -void _register_stream_wrap() {} -void _register_tcp_wrap() {} -void _register_timer_wrap() {} -void _register_trace_events() {} -void _register_tty_wrap() {} -void _register_udp_wrap() {} -void _register_util() {} -void _register_uv() {} -void _register_v8() {} -void _register_zlib() {} From 9fc08aff845ba13e5aef10f38f5a369e6d8af6df Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Wed, 14 Feb 2018 11:22:36 +0100 Subject: [PATCH 2/4] squash: add extern declarations for constants --- test/cctest/test_node_postmortem_metadata.cc | 22 ++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/test/cctest/test_node_postmortem_metadata.cc b/test/cctest/test_node_postmortem_metadata.cc index be5cc7ce8ad2c5..a1fdeeb4892848 100644 --- a/test/cctest/test_node_postmortem_metadata.cc +++ b/test/cctest/test_node_postmortem_metadata.cc @@ -1,5 +1,3 @@ -#include "node_postmortem_metadata.cc" - #include "gtest/gtest.h" #include "node.h" #include "node_internals.h" @@ -7,6 +5,26 @@ #include "req_wrap-inl.h" #include "tracing/agent.h" #include "v8.h" +#include "v8abbr.h" + +extern uintptr_t + nodedbg_offset_HandleWrap__handle_wrap_queue___ListNode_HandleWrap; +extern uintptr_t + nodedbg_offset_Environment__handle_wrap_queue___Environment_HandleWrapQueue; +extern int debug_symbols_generated; +extern int nodedbg_const_Environment__kContextEmbedderDataIndex__int; +extern uintptr_t + nodedbg_offset_Environment_HandleWrapQueue__head___ListNode_HandleWrap; +extern uintptr_t + nodedbg_offset_Environment__req_wrap_queue___Environment_ReqWrapQueue; +extern uintptr_t nodedbg_offset_ExternalString__data__uintptr_t; +extern uintptr_t nodedbg_offset_ListNode_ReqWrap__next___uintptr_t; +extern uintptr_t nodedbg_offset_ReqWrap__req_wrap_queue___ListNode_ReqWrapQueue; +extern uintptr_t nodedbg_offset_ListNode_HandleWrap__next___uintptr_t; +extern uintptr_t + nodedbg_offset_Environment_ReqWrapQueue__head___ListNode_ReqWrapQueue; +extern uintptr_t + nodedbg_offset_BaseObject__persistent_handle___v8_Persistent_v8_Object; class DebugSymbolsTest : public EnvironmentTestFixture {}; From 15051d324c19eec027f6ea5b40a8ad685e09c8b9 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Wed, 14 Feb 2018 12:08:17 +0100 Subject: [PATCH 3/4] squash: re-add rename_node_bin_win to cctest deps --- node.gyp | 1 + 1 file changed, 1 insertion(+) diff --git a/node.gyp b/node.gyp index 499cc767e03405..5100716d0d6e0a 100644 --- a/node.gyp +++ b/node.gyp @@ -912,6 +912,7 @@ 'dependencies': [ '<(node_lib_target_name)', + 'rename_node_bin_win', 'deps/gtest/gtest.gyp:gtest', 'node_js2c#host', 'node_dtrace_header', From d76100caf0f569f19762fa93bbf27083b2d5fe42 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Fri, 16 Feb 2018 12:28:15 +0100 Subject: [PATCH 4/4] squash: add extern "C" to global vars It seems that these are not linked properly on Windows with out this. --- test/cctest/test_node_postmortem_metadata.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/cctest/test_node_postmortem_metadata.cc b/test/cctest/test_node_postmortem_metadata.cc index a1fdeeb4892848..e901d97668f5ff 100644 --- a/test/cctest/test_node_postmortem_metadata.cc +++ b/test/cctest/test_node_postmortem_metadata.cc @@ -7,6 +7,7 @@ #include "v8.h" #include "v8abbr.h" +extern "C" { extern uintptr_t nodedbg_offset_HandleWrap__handle_wrap_queue___ListNode_HandleWrap; extern uintptr_t @@ -25,6 +26,7 @@ extern uintptr_t nodedbg_offset_Environment_ReqWrapQueue__head___ListNode_ReqWrapQueue; extern uintptr_t nodedbg_offset_BaseObject__persistent_handle___v8_Persistent_v8_Object; +} class DebugSymbolsTest : public EnvironmentTestFixture {};