Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make test fails with header_guard error in cpplint #2693

Closed
hmage opened this issue Sep 4, 2015 · 5 comments · Fixed by #2710
Closed

make test fails with header_guard error in cpplint #2693

hmage opened this issue Sep 4, 2015 · 5 comments · Fixed by #2710
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. test Issues and PRs related to the tests.

Comments

@hmage
Copy link

hmage commented Sep 4, 2015

When adding node.js formula into norm, I found out that, for some reason, cpplint in make test insists that header guards must include full pathname to the file where header is located. This pretty much breaks the tests and I had to disable them.

Tested on 32-bit debian squeeze chroot.

I have no solution at the moment, but it seems like you're passing full pathname to cpplint and it blindly converts it to _FULL_PATHNAME_TO_FILE_H_, then compares it against the existing guard and fails.

make test output:

(squeeze) bujak_e@wraith:~/compile/node-v0.12.7$ make test
make -C out BUILDTYPE=Release V=1
make[1]: Entering directory `/home/bujak_e/compile/node-v0.12.7/out'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/bujak_e/compile/node-v0.12.7/out'
ln -fs out/Release/node node
/usr/bin/python tools/test.py --mode=release simple message
[02:53|% 100|+ 792|-   0]: Done                                                
make jslint
make[1]: Entering directory `/home/bujak_e/compile/node-v0.12.7'
PYTHONPATH=tools/closure_linter/ /usr/bin/python tools/closure_linter/closure_linter/gjslint.py --unix_mode --strict --nojsdoc -r lib/ -r src/ --exclude_files lib/punycode.js
Skipping 1 file(s).
50 files checked, no errors found.
make[1]: Leaving directory `/home/bujak_e/compile/node-v0.12.7'
make cpplint
make[1]: Entering directory `/home/bujak_e/compile/node-v0.12.7'
Done processing src/async-wrap.cc
Done processing src/cares_wrap.cc
Done processing src/fs_event_wrap.cc
Done processing src/handle_wrap.cc
Done processing src/node_buffer.cc
Done processing src/node.cc
Done processing src/node_constants.cc
Done processing src/node_contextify.cc
Done processing src/node_counters.cc
Done processing src/node_crypto_bio.cc
Done processing src/node_crypto.cc
Done processing src/node_crypto_clienthello.cc
Done processing src/node_dtrace.cc
Done processing src/node_file.cc
Done processing src/node_http_parser.cc
Done processing src/node_i18n.cc
Done processing src/node_javascript.cc
Done processing src/node_main.cc
Done processing src/node_os.cc
Done processing src/node_stat_watcher.cc
Done processing src/node_v8.cc
Done processing src/node_watchdog.cc
Done processing src/node_win32_etw_provider.cc
Done processing src/node_zlib.cc
Done processing src/pipe_wrap.cc
Done processing src/process_wrap.cc
Done processing src/signal_wrap.cc
Done processing src/smalloc.cc
Done processing src/spawn_sync.cc
Done processing src/stream_wrap.cc
Done processing src/string_bytes.cc
Done processing src/tcp_wrap.cc
Done processing src/timer_wrap.cc
Done processing src/tls_wrap.cc
Done processing src/tty_wrap.cc
Done processing src/udp_wrap.cc
Done processing src/util.cc
Done processing src/uv.cc
src/async-wrap.h:22:  #ifndef header guard has wrong style, please use: _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_ASYNC_WRAP_H_  [build/header_guard] [5]
src/async-wrap.h:97:  #endif line should be "#endif  // _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_ASYNC_WRAP_H_"  [build/header_guard] [5]
Done processing src/async-wrap.h
src/async-wrap-inl.h:22:  #ifndef header guard has wrong style, please use: _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_ASYNC_WRAP_INL_H_  [build/header_guard] [5]
src/async-wrap-inl.h:114:  #endif line should be "#endif  // _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_ASYNC_WRAP_INL_H_"  [build/header_guard] [5]
Done processing src/async-wrap-inl.h
src/base-object.h:22:  #ifndef header guard has wrong style, please use: _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_BASE_OBJECT_H_  [build/header_guard] [5]
src/base-object.h:71:  #endif line should be "#endif  // _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_BASE_OBJECT_H_"  [build/header_guard] [5]
Done processing src/base-object.h
src/base-object-inl.h:22:  #ifndef header guard has wrong style, please use: _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_BASE_OBJECT_INL_H_  [build/header_guard] [5]
src/base-object-inl.h:87:  #endif line should be "#endif  // _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_BASE_OBJECT_INL_H_"  [build/header_guard] [5]
Done processing src/base-object-inl.h
src/env.h:22:  #ifndef header guard has wrong style, please use: _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_ENV_H_  [build/header_guard] [5]
src/env.h:593:  #endif line should be "#endif  // _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_ENV_H_"  [build/header_guard] [5]
Done processing src/env.h
src/env-inl.h:22:  #ifndef header guard has wrong style, please use: _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_ENV_INL_H_  [build/header_guard] [5]
src/env-inl.h:470:  #endif line should be "#endif  // _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_ENV_INL_H_"  [build/header_guard] [5]
Done processing src/env-inl.h
src/handle_wrap.h:22:  #ifndef header guard has wrong style, please use: _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_HANDLE_WRAP_H_  [build/header_guard] [5]
src/handle_wrap.h:87:  #endif line should be "#endif  // _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_HANDLE_WRAP_H_"  [build/header_guard] [5]
Done processing src/handle_wrap.h
src/node_buffer.h:22:  #ifndef header guard has wrong style, please use: _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_BUFFER_H_  [build/header_guard] [5]
src/node_buffer.h:125:  #endif line should be "#endif  // _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_BUFFER_H_"  [build/header_guard] [5]
Done processing src/node_buffer.h
src/node_constants.h:22:  #ifndef header guard has wrong style, please use: _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_CONSTANTS_H_  [build/header_guard] [5]
src/node_constants.h:32:  #endif line should be "#endif  // _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_CONSTANTS_H_"  [build/header_guard] [5]
Done processing src/node_constants.h
src/node_counters.h:22:  #ifndef header guard has wrong style, please use: _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_COUNTERS_H_  [build/header_guard] [5]
src/node_counters.h:55:  #endif line should be "#endif  // _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_COUNTERS_H_"  [build/header_guard] [5]
Done processing src/node_counters.h
src/node_crypto_bio.h:22:  #ifndef header guard has wrong style, please use: _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_CRYPTO_BIO_H_  [build/header_guard] [5]
src/node_crypto_bio.h:138:  #endif line should be "#endif  // _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_CRYPTO_BIO_H_"  [build/header_guard] [5]
Done processing src/node_crypto_bio.h
src/node_crypto_clienthello.h:22:  #ifndef header guard has wrong style, please use: _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_CRYPTO_CLIENTHELLO_H_  [build/header_guard] [5]
src/node_crypto_clienthello.h:145:  #endif line should be "#endif  // _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_CRYPTO_CLIENTHELLO_H_"  [build/header_guard] [5]
Done processing src/node_crypto_clienthello.h
src/node_crypto_clienthello-inl.h:22:  #ifndef header guard has wrong style, please use: _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_CRYPTO_CLIENTHELLO_INL_H_  [build/header_guard] [5]
src/node_crypto_clienthello-inl.h:76:  #endif line should be "#endif  // _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_CRYPTO_CLIENTHELLO_INL_H_"  [build/header_guard] [5]
Done processing src/node_crypto_clienthello-inl.h
src/node_crypto_groups.h:22:  #ifndef header guard has wrong style, please use: _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_CRYPTO_GROUPS_H_  [build/header_guard] [5]
src/node_crypto_groups.h:412:  #endif line should be "#endif  // _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_CRYPTO_GROUPS_H_"  [build/header_guard] [5]
Done processing src/node_crypto_groups.h
src/node_crypto.h:22:  #ifndef header guard has wrong style, please use: _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_CRYPTO_H_  [build/header_guard] [5]
src/node_crypto.h:715:  #endif line should be "#endif  // _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_CRYPTO_H_"  [build/header_guard] [5]
Done processing src/node_crypto.h
src/node_dtrace.h:22:  #ifndef header guard has wrong style, please use: _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_DTRACE_H_  [build/header_guard] [5]
src/node_dtrace.h:82:  #endif line should be "#endif  // _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_DTRACE_H_"  [build/header_guard] [5]
Done processing src/node_dtrace.h
src/node_file.h:22:  #ifndef header guard has wrong style, please use: _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_FILE_H_  [build/header_guard] [5]
src/node_file.h:34:  #endif line should be "#endif  // _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_FILE_H_"  [build/header_guard] [5]
Done processing src/node_file.h
src/node.h:22:  #ifndef header guard has wrong style, please use: _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_H_  [build/header_guard] [5]
src/node.h:447:  #endif line should be "#endif  // _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_H_"  [build/header_guard] [5]
Done processing src/node.h
src/node_http_parser.h:22:  #ifndef header guard has wrong style, please use: _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_HTTP_PARSER_H_  [build/header_guard] [5]
src/node_http_parser.h:35:  #endif line should be "#endif  // _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_HTTP_PARSER_H_"  [build/header_guard] [5]
Done processing src/node_http_parser.h
src/node_i18n.h:22:  #ifndef header guard has wrong style, please use: _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_I18N_H_  [build/header_guard] [5]
src/node_i18n.h:39:  #endif line should be "#endif  // _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_I18N_H_"  [build/header_guard] [5]
Done processing src/node_i18n.h
src/node_internals.h:22:  #ifndef header guard has wrong style, please use: _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_INTERNALS_H_  [build/header_guard] [5]
src/node_internals.h:236:  #endif line should be "#endif  // _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_INTERNALS_H_"  [build/header_guard] [5]
Done processing src/node_internals.h
src/node_javascript.h:22:  #ifndef header guard has wrong style, please use: _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_JAVASCRIPT_H_  [build/header_guard] [5]
src/node_javascript.h:35:  #endif line should be "#endif  // _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_JAVASCRIPT_H_"  [build/header_guard] [5]
Done processing src/node_javascript.h
src/node_object_wrap.h:22:  #ifndef header guard has wrong style, please use: _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_OBJECT_WRAP_H_  [build/header_guard] [5]
src/node_object_wrap.h:137:  #endif line should be "#endif  // _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_OBJECT_WRAP_H_"  [build/header_guard] [5]
Done processing src/node_object_wrap.h
src/node_stat_watcher.h:22:  #ifndef header guard has wrong style, please use: _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_STAT_WATCHER_H_  [build/header_guard] [5]
src/node_stat_watcher.h:57:  #endif line should be "#endif  // _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_STAT_WATCHER_H_"  [build/header_guard] [5]
Done processing src/node_stat_watcher.h
src/node_version.h:22:  #ifndef header guard has wrong style, please use: _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_VERSION_H_  [build/header_guard] [5]
src/node_version.h:69:  #endif line should be "#endif  // _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_VERSION_H_"  [build/header_guard] [5]
Done processing src/node_version.h
src/node_watchdog.h:22:  #ifndef header guard has wrong style, please use: _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_WATCHDOG_H_  [build/header_guard] [5]
src/node_watchdog.h:58:  #endif line should be "#endif  // _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_WATCHDOG_H_"  [build/header_guard] [5]
Done processing src/node_watchdog.h
src/node_win32_etw_provider.h:22:  #ifndef header guard has wrong style, please use: _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_WIN32_ETW_PROVIDER_H_  [build/header_guard] [5]
src/node_win32_etw_provider.h:99:  #endif line should be "#endif  // _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_WIN32_ETW_PROVIDER_H_"  [build/header_guard] [5]
Done processing src/node_win32_etw_provider.h
src/node_win32_etw_provider-inl.h:22:  #ifndef header guard has wrong style, please use: _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_WIN32_ETW_PROVIDER_INL_H_  [build/header_guard] [5]
src/node_win32_etw_provider-inl.h:281:  #endif line should be "#endif  // _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_WIN32_ETW_PROVIDER_INL_H_"  [build/header_guard] [5]
Done processing src/node_win32_etw_provider-inl.h
src/node_win32_perfctr_provider.h:22:  #ifndef header guard has wrong style, please use: _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_WIN32_PERFCTR_PROVIDER_H_  [build/header_guard] [5]
src/node_win32_perfctr_provider.h:54:  #endif line should be "#endif  // _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_WIN32_PERFCTR_PROVIDER_H_"  [build/header_guard] [5]
Done processing src/node_win32_perfctr_provider.h
src/node_wrap.h:22:  #ifndef header guard has wrong style, please use: _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_WRAP_H_  [build/header_guard] [5]
src/node_wrap.h:68:  #endif line should be "#endif  // _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_NODE_WRAP_H_"  [build/header_guard] [5]
Done processing src/node_wrap.h
src/pipe_wrap.h:22:  #ifndef header guard has wrong style, please use: _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_PIPE_WRAP_H_  [build/header_guard] [5]
src/pipe_wrap.h:67:  #endif line should be "#endif  // _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_PIPE_WRAP_H_"  [build/header_guard] [5]
Done processing src/pipe_wrap.h
src/req_wrap.h:22:  #ifndef header guard has wrong style, please use: _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_REQ_WRAP_H_  [build/header_guard] [5]
src/req_wrap.h:70:  #endif line should be "#endif  // _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_REQ_WRAP_H_"  [build/header_guard] [5]
Done processing src/req_wrap.h
src/smalloc.h:22:  #ifndef header guard has wrong style, please use: _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_SMALLOC_H_  [build/header_guard] [5]
src/smalloc.h:153:  #endif line should be "#endif  // _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_SMALLOC_H_"  [build/header_guard] [5]
Done processing src/smalloc.h
src/spawn_sync.h:22:  #ifndef header guard has wrong style, please use: _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_SPAWN_SYNC_H_  [build/header_guard] [5]
src/spawn_sync.h:247:  #endif line should be "#endif  // _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_SPAWN_SYNC_H_"  [build/header_guard] [5]
Done processing src/spawn_sync.h
src/stream_wrap.h:22:  #ifndef header guard has wrong style, please use: _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_STREAM_WRAP_H_  [build/header_guard] [5]
src/stream_wrap.h:226:  #endif line should be "#endif  // _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_STREAM_WRAP_H_"  [build/header_guard] [5]
Done processing src/stream_wrap.h
src/string_bytes.h:22:  #ifndef header guard has wrong style, please use: _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_STRING_BYTES_H_  [build/header_guard] [5]
src/string_bytes.h:128:  #endif line should be "#endif  // _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_STRING_BYTES_H_"  [build/header_guard] [5]
Done processing src/string_bytes.h
src/tcp_wrap.h:22:  #ifndef header guard has wrong style, please use: _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_TCP_WRAP_H_  [build/header_guard] [5]
src/tcp_wrap.h:71:  #endif line should be "#endif  // _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_TCP_WRAP_H_"  [build/header_guard] [5]
Done processing src/tcp_wrap.h
src/tls_wrap.h:22:  #ifndef header guard has wrong style, please use: _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_TLS_WRAP_H_  [build/header_guard] [5]
src/tls_wrap.h:178:  #endif line should be "#endif  // _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_TLS_WRAP_H_"  [build/header_guard] [5]
Done processing src/tls_wrap.h
src/tty_wrap.h:22:  #ifndef header guard has wrong style, please use: _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_TTY_WRAP_H_  [build/header_guard] [5]
src/tty_wrap.h:56:  #endif line should be "#endif  // _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_TTY_WRAP_H_"  [build/header_guard] [5]
Done processing src/tty_wrap.h
src/udp_wrap.h:22:  #ifndef header guard has wrong style, please use: _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_UDP_WRAP_H_  [build/header_guard] [5]
src/udp_wrap.h:86:  #endif line should be "#endif  // _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_UDP_WRAP_H_"  [build/header_guard] [5]
Done processing src/udp_wrap.h
src/util.h:22:  #ifndef header guard has wrong style, please use: _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_UTIL_H_  [build/header_guard] [5]
src/util.h:147:  #endif line should be "#endif  // _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_UTIL_H_"  [build/header_guard] [5]
Done processing src/util.h
src/util-inl.h:22:  #ifndef header guard has wrong style, please use: _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_UTIL_INL_H_  [build/header_guard] [5]
src/util-inl.h:124:  #endif line should be "#endif  // _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_SRC_UTIL_INL_H_"  [build/header_guard] [5]
Done processing src/util-inl.h
Done processing tools/icu/iculslocs.cc
Done processing tools/icu/no-op.cc
deps/debugger-agent/include/debugger-agent.h:22:  #ifndef header guard has wrong style, please use: _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_DEPS_DEBUGGER_AGENT_INCLUDE_DEBUGGER_AGENT_H_  [build/header_guard] [5]
deps/debugger-agent/include/debugger-agent.h:109:  #endif line should be "#endif  // _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_DEPS_DEBUGGER_AGENT_INCLUDE_DEBUGGER_AGENT_H_"  [build/header_guard] [5]
Done processing deps/debugger-agent/include/debugger-agent.h
Done processing deps/debugger-agent/src/agent.cc
deps/debugger-agent/src/agent.h:22:  #ifndef header guard has wrong style, please use: _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_DEPS_DEBUGGER_AGENT_SRC_AGENT_H_  [build/header_guard] [5]
deps/debugger-agent/src/agent.h:64:  #endif line should be "#endif  // _HOME_BUJAK_E_COMPILE_NODE_V0_12_7_DEPS_DEBUGGER_AGENT_SRC_AGENT_H_"  [build/header_guard] [5]
Done processing deps/debugger-agent/src/agent.h
Total errors found: 88
make[1]: *** [cpplint] Error 1
make[1]: Leaving directory `/home/bujak_e/compile/node-v0.12.7'
make: *** [test] Error 2
@mscdex mscdex added test Issues and PRs related to the tests. c++ Issues and PRs that require attention from people who are familiar with C++. labels Sep 4, 2015
@bnoordhuis
Copy link
Member

cpplint expects to be run in a git checkout, it uses the top-level .git directory as the include root. If it doesn't find one, it walks up all the way to the root directory and then you get the errors you're getting. Am I right that the patch below fixes the issue?

diff --git a/tools/cpplint.py b/tools/cpplint.py
index 5ab1561..4c4f577 100644
--- a/tools/cpplint.py
+++ b/tools/cpplint.py
@@ -695,37 +695,10 @@ class FileInfo:
     locations won't see bogus errors.
     """
     fullname = self.FullName()
-
-    if os.path.exists(fullname):
-      project_dir = os.path.dirname(fullname)
-
-      if os.path.exists(os.path.join(project_dir, ".svn")):
-        # If there's a .svn file in the current directory, we recursively look
-        # up the directory tree for the top of the SVN checkout
-        root_dir = project_dir
-        one_up_dir = os.path.dirname(root_dir)
-        while os.path.exists(os.path.join(one_up_dir, ".svn")):
-          root_dir = os.path.dirname(root_dir)
-          one_up_dir = os.path.dirname(one_up_dir)
-
-        prefix = os.path.commonprefix([root_dir, project_dir])
-        return fullname[len(prefix) + 1:]
-
-      # Not SVN? Try to find a git or hg top level directory by searching up
-      # from the current path.
-      root_dir = os.path.dirname(fullname)
-      while (root_dir != os.path.dirname(root_dir) and
-             not os.path.exists(os.path.join(root_dir, ".git")) and
-             not os.path.exists(os.path.join(root_dir, ".hg"))):
-        root_dir = os.path.dirname(root_dir)
-
-      if (os.path.exists(os.path.join(root_dir, ".git")) or
-          os.path.exists(os.path.join(root_dir, ".hg"))):
-        prefix = os.path.commonprefix([root_dir, project_dir])
-        return fullname[len(prefix) + 1:]
-
-    # Don't know what to do; header guard warnings may be wrong...
-    return fullname
+    # XXX(bnoordhuis) Expects that cpplint.py lives in the tools/ directory.
+    toplevel = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
+    prefix = os.path.commonprefix([fullname, toplevel])
+    return fullname[len(prefix) + 1:]

   def Split(self):
     """Splits the file into the directory, basename, and extension.

@hmage
Copy link
Author

hmage commented Sep 4, 2015

Will try later today and come back with results. Most likely it will judging by what I see in the patch.

@mscdex
Copy link
Contributor

mscdex commented Sep 5, 2015

+1 to solving this. I often use the github/release tarballs if I don't have the git repo checked out already and I always run into this during make lint.

@hmage
Copy link
Author

hmage commented Sep 5, 2015

Yes, the patch fixes the problem.

bnoordhuis added a commit to bnoordhuis/io.js that referenced this issue Sep 6, 2015
cpplint uses the top-level .git directory to determine what the root is
for #include guards.  If it doesn't find a .git directory, it walks up
all the way to the system root and subsequently complains that guards
must be written as HOME_USER_SRC_NODE_SRC_FILENAME_H_.

This commit replaces the .git-based path munging with a fixed root path
relative to the location of the cpplint script, making it possible to
successfully run `make test` from an extracted tarball.

Fixes: nodejs#2693
PR-URL: nodejs#2710
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
@bnoordhuis
Copy link
Member

Fixed by a493dab.

bnoordhuis added a commit that referenced this issue Sep 7, 2015
cpplint uses the top-level .git directory to determine what the root is
for #include guards.  If it doesn't find a .git directory, it walks up
all the way to the system root and subsequently complains that guards
must be written as HOME_USER_SRC_NODE_SRC_FILENAME_H_.

This commit replaces the .git-based path munging with a fixed root path
relative to the location of the cpplint script, making it possible to
successfully run `make test` from an extracted tarball.

Fixes: #2693
PR-URL: #2710
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
bnoordhuis added a commit that referenced this issue Sep 7, 2015
cpplint uses the top-level .git directory to determine what the root is
for #include guards.  If it doesn't find a .git directory, it walks up
all the way to the system root and subsequently complains that guards
must be written as HOME_USER_SRC_NODE_SRC_FILENAME_H_.

This commit replaces the .git-based path munging with a fixed root path
relative to the location of the cpplint script, making it possible to
successfully run `make test` from an extracted tarball.

Fixes: #2693
PR-URL: #2710
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
bnoordhuis added a commit that referenced this issue Sep 7, 2015
cpplint uses the top-level .git directory to determine what the root is
for #include guards.  If it doesn't find a .git directory, it walks up
all the way to the system root and subsequently complains that guards
must be written as HOME_USER_SRC_NODE_SRC_FILENAME_H_.

This commit replaces the .git-based path munging with a fixed root path
relative to the location of the cpplint script, making it possible to
successfully run `make test` from an extracted tarball.

Fixes: #2693
PR-URL: #2710
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
bnoordhuis added a commit that referenced this issue Sep 7, 2015
cpplint uses the top-level .git directory to determine what the root is
for #include guards.  If it doesn't find a .git directory, it walks up
all the way to the system root and subsequently complains that guards
must be written as HOME_USER_SRC_NODE_SRC_FILENAME_H_.

This commit replaces the .git-based path munging with a fixed root path
relative to the location of the cpplint script, making it possible to
successfully run `make test` from an extracted tarball.

Fixes: #2693
PR-URL: #2710
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
bnoordhuis added a commit to bnoordhuis/io.js that referenced this issue Jun 29, 2016
This reapplies commit a493dab ("cpplint: make it possible to run
outside git repo") from September 2015, this time with a proper
status line.

PR-URL: nodejs#7462
Refs: nodejs#2693
Reviewed-By: Trevor Norris <[email protected]>
Fishrock123 pushed a commit that referenced this issue Jul 5, 2016
This reapplies commit a493dab ("cpplint: make it possible to run
outside git repo") from September 2015, this time with a proper
status line.

PR-URL: #7462
Refs: #2693
Reviewed-By: Trevor Norris <[email protected]>
addaleax pushed a commit to addaleax/node that referenced this issue Jul 12, 2016
This reapplies commit a493dab ("cpplint: make it possible to run
outside git repo") from September 2015, this time with a proper
status line.

PR-URL: nodejs#7462
Refs: nodejs#2693
Reviewed-By: Trevor Norris <[email protected]>
MylesBorins pushed a commit that referenced this issue Jul 12, 2016
This reapplies commit a493dab ("cpplint: make it possible to run
outside git repo") from September 2015, this time with a proper
status line.

PR-URL: #7462
Refs: #2693
Reviewed-By: Trevor Norris <[email protected]>
MylesBorins pushed a commit that referenced this issue Jul 12, 2016
This reapplies commit a493dab ("cpplint: make it possible to run
outside git repo") from September 2015, this time with a proper
status line.

PR-URL: #7462
Refs: #2693
Reviewed-By: Trevor Norris <[email protected]>
MylesBorins pushed a commit that referenced this issue Jul 14, 2016
This reapplies commit a493dab ("cpplint: make it possible to run
outside git repo") from September 2015, this time with a proper
status line.

PR-URL: #7462
Refs: #2693
Reviewed-By: Trevor Norris <[email protected]>
MylesBorins pushed a commit that referenced this issue Jul 14, 2016
This reapplies commit a493dab ("cpplint: make it possible to run
outside git repo") from September 2015, this time with a proper
status line.

PR-URL: #7462
Refs: #2693
Reviewed-By: Trevor Norris <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants