diff options
-rw-r--r-- | cmake/GetCompileFlags.cmake | 10 | ||||
-rw-r--r-- | src/nvim/CMakeLists.txt | 14 | ||||
-rw-r--r-- | src/nvim/message.c | 16 | ||||
-rw-r--r-- | src/nvim/testdir/runtest.vim | 1 | ||||
-rw-r--r-- | src/nvim/testdir/test_timers.vim | 2 | ||||
-rw-r--r-- | test/functional/core/job_spec.lua | 71 |
6 files changed, 102 insertions, 12 deletions
diff --git a/cmake/GetCompileFlags.cmake b/cmake/GetCompileFlags.cmake index 482eacca16..667b97350c 100644 --- a/cmake/GetCompileFlags.cmake +++ b/cmake/GetCompileFlags.cmake @@ -13,6 +13,11 @@ function(get_compile_flags _compile_flags) get_directory_property(compile_definitions DIRECTORY "src/nvim" COMPILE_DEFINITIONS) + get_target_property(compile_definitions_target nvim COMPILE_DEFINITIONS) + if(compile_definitions_target) + list(APPEND compile_definitions ${compile_definitions_target}) + list(REMOVE_DUPLICATES compile_definitions) + endif() # NOTE: list(JOIN) requires CMake 3.12, string(CONCAT) requires CMake 3. string(REPLACE ";" " -D" compile_definitions "${compile_definitions}") if(compile_definitions) @@ -28,6 +33,11 @@ function(get_compile_flags _compile_flags) get_directory_property(compile_options DIRECTORY "src/nvim" COMPILE_OPTIONS) + get_target_property(compile_options_target nvim COMPILE_OPTIONS) + if(compile_options_target) + list(APPEND compile_options ${compile_options_target}) + list(REMOVE_DUPLICATES compile_options) + endif() # NOTE: list(JOIN) requires CMake 3.12. string(REPLACE ";" " " compile_options "${compile_options}") string(REPLACE diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index 22f3153230..06957dd77d 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -552,19 +552,19 @@ if(CLANG_ASAN_UBSAN) else() set(SANITIZE_RECOVER -fno-sanitize-recover) # Clang 3.5- endif() - set_property(TARGET nvim APPEND_STRING PROPERTY COMPILE_FLAGS "-DEXITFREE ") - set_property(TARGET nvim APPEND_STRING PROPERTY COMPILE_FLAGS "${SANITIZE_RECOVER} -fno-omit-frame-pointer -fno-optimize-sibling-calls -fsanitize=address -fsanitize=undefined -fsanitize-blacklist=${PROJECT_SOURCE_DIR}/src/.asan-blacklist") + set_property(TARGET nvim APPEND PROPERTY COMPILE_DEFINITIONS EXITFREE) + set_property(TARGET nvim APPEND PROPERTY COMPILE_OPTIONS ${SANITIZE_RECOVER} -fno-omit-frame-pointer -fno-optimize-sibling-calls -fsanitize=address -fsanitize=undefined -fsanitize-blacklist=${PROJECT_SOURCE_DIR}/src/.asan-blacklist) set_property(TARGET nvim APPEND_STRING PROPERTY LINK_FLAGS "-fsanitize=address -fsanitize=undefined ") elseif(CLANG_MSAN) message(STATUS "Enabling Clang memory sanitizer for nvim.") - set_property(TARGET nvim APPEND_STRING PROPERTY COMPILE_FLAGS "-DEXITFREE ") - set_property(TARGET nvim APPEND_STRING PROPERTY COMPILE_FLAGS "-fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer -fno-optimize-sibling-calls ") + set_property(TARGET nvim APPEND PROPERTY COMPILE_DEFINITIONS EXITFREE) + set_property(TARGET nvim APPEND PROPERTY COMPILE_OPTIONS -fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer -fno-optimize-sibling-calls) set_property(TARGET nvim APPEND_STRING PROPERTY LINK_FLAGS "-fsanitize=memory -fsanitize-memory-track-origins ") elseif(CLANG_TSAN) message(STATUS "Enabling Clang thread sanitizer for nvim.") - set_property(TARGET nvim APPEND_STRING PROPERTY COMPILE_FLAGS "-DEXITFREE ") - set_property(TARGET nvim APPEND_STRING PROPERTY COMPILE_FLAGS "-fsanitize=thread ") - set_property(TARGET nvim APPEND_STRING PROPERTY COMPILE_FLAGS "-fPIE ") + set_property(TARGET nvim APPEND PROPERTY COMPILE_DEFINITIONS EXITFREE) + set_property(TARGET nvim APPEND PROPERTY COMPILE_OPTIONS -fsanitize=thread) + set_property(TARGET nvim APPEND PROPERTY COMPILE_OPTIONS -fPIE) set_property(TARGET nvim APPEND_STRING PROPERTY LINK_FLAGS "-fsanitize=thread ") endif() diff --git a/src/nvim/message.c b/src/nvim/message.c index 6e935022ca..9bea9f5c4a 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -582,9 +582,25 @@ static bool emsg_multiline(const char *s, bool multiline) } redir_write(s, strlen(s)); } + + // Log (silent) errors as debug messages. + if (sourcing_name != NULL && sourcing_lnum != 0) { + DLOG("(:silent) %s (%s (line %ld))", + s, sourcing_name, (long)sourcing_lnum); + } else { + DLOG("(:silent) %s", s); + } + return true; } + // Log editor errors as INFO. + if (sourcing_name != NULL && sourcing_lnum != 0) { + ILOG("%s (%s (line %ld))", s, sourcing_name, (long)sourcing_lnum); + } else { + ILOG("%s", s); + } + ex_exitval = 1; // Reset msg_silent, an error causes messages to be switched back on. diff --git a/src/nvim/testdir/runtest.vim b/src/nvim/testdir/runtest.vim index 5c62538b7d..4ddb15c9de 100644 --- a/src/nvim/testdir/runtest.vim +++ b/src/nvim/testdir/runtest.vim @@ -286,6 +286,7 @@ let s:flaky_tests = [ \ 'Test_quoteplus()', \ 'Test_quotestar()', \ 'Test_reltime()', + \ 'Test_repeat_many()', \ 'Test_repeat_three()', \ 'Test_terminal_composing_unicode()', \ 'Test_terminal_redir_file()', diff --git a/src/nvim/testdir/test_timers.vim b/src/nvim/testdir/test_timers.vim index 9384989a35..24c735865c 100644 --- a/src/nvim/testdir/test_timers.vim +++ b/src/nvim/testdir/test_timers.vim @@ -48,7 +48,7 @@ func Test_repeat_many() endif sleep 200m call timer_stop(timer) - call assert_inrange((has('mac') ? 1 : 2), LoadAdjust(4), g:val) + call assert_inrange((has('mac') ? 1 : 2), LoadAdjust(5), g:val) endfunc func Test_with_partial_callback() diff --git a/test/functional/core/job_spec.lua b/test/functional/core/job_spec.lua index a1d9f50720..2531b45521 100644 --- a/test/functional/core/job_spec.lua +++ b/test/functional/core/job_spec.lua @@ -768,16 +768,79 @@ describe('jobs', function() -- ..c.."', '-c', '"..c.."'])") -- Create child with several descendants. + if iswin() then + source([[ + function! s:formatprocs(pid, prefix) + let result = '' + let result .= a:prefix . printf("%-24.24s%6s %12.12s %s\n", + \ s:procs[a:pid]['name'], + \ a:pid, + \ s:procs[a:pid]['Session Name'], + \ s:procs[a:pid]['Session']) + if has_key(s:procs[a:pid], 'children') + for pid in s:procs[a:pid]['children'] + let result .= s:formatprocs(pid, a:prefix . ' ') + endfor + endif + return result + endfunction + + function! PsTree() abort + let s:procs = {} + for proc in map( + \ map( + \ systemlist('tasklist /NH'), + \ 'substitute(v:val, "\r", "", "")'), + \ 'split(v:val, "\\s\\+")') + if len(proc) == 6 + let s:procs[proc[1]] ..']]'..[[= {'name': proc[0], + \ 'Session Name': proc[2], + \ 'Session': proc[3]} + endif + endfor + for pid in keys(s:procs) + let children = nvim_get_proc_children(str2nr(pid)) + if !empty(children) + let s:procs[pid]['children'] = children + for cpid in children + let s:procs[printf('%d', cpid)]['parent'] = str2nr(pid) + endfor + endif + endfor + let result = '' + for pid in sort(keys(s:procs), {i1, i2 -> i1 - i2}) + if !has_key(s:procs[pid], 'parent') + let result .= s:formatprocs(pid, '') + endif + endfor + return result + endfunction + ]]) + end local sleep_cmd = (iswin() and 'ping -n 31 127.0.0.1' or 'sleep 30') local j = eval("jobstart('"..sleep_cmd..' | '..sleep_cmd..' | '..sleep_cmd.."')") local ppid = funcs.jobpid(j) local children - retry(nil, nil, function() - children = meths.get_proc_children(ppid) - eq((iswin() and 4 or 3), #children) - end) + if iswin() then + local status, result = pcall(retry, nil, nil, function() + children = meths.get_proc_children(ppid) + -- On Windows conhost.exe may exist, and + -- e.g. vctip.exe might appear. #10783 + ok(#children >= 3 and #children <= 5) + end) + if not status then + print('') + print(eval('PsTree()')) + error(result) + end + else + retry(nil, nil, function() + children = meths.get_proc_children(ppid) + eq(3, #children) + end) + end -- Assert that nvim_get_proc() sees the children. for _, child_pid in ipairs(children) do local info = meths.get_proc(child_pid) |