mirror of
https://github.com/neovim/neovim.git
synced 2025-10-08 19:06:31 +00:00
Dump gcov coverage in process_spawn (#10230)
Fixes https://github.com/neovim/neovim/pull/3926#issuecomment-502343527.
This commit is contained in:
@@ -7,6 +7,7 @@ if(USE_GCOV)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage")
|
||||
add_compile_definitions(USE_GCOV)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@@ -22,6 +22,11 @@
|
||||
# include "event/process.c.generated.h"
|
||||
#endif
|
||||
|
||||
/// Externally defined with gcov.
|
||||
#ifdef USE_GCOV
|
||||
void __gcov_dump(void);
|
||||
#endif
|
||||
|
||||
// Time for a process to exit cleanly before we send KILL.
|
||||
// For PTY processes SIGTERM is sent first (in case SIGHUP was not enough).
|
||||
#define KILL_TIMEOUT_MS 2000
|
||||
@@ -50,6 +55,11 @@ int process_spawn(Process *proc, bool in, bool out, bool err)
|
||||
proc->err.closed = true;
|
||||
}
|
||||
|
||||
#ifdef USE_GCOV
|
||||
// Dump coverage data before forking, to avoid "Merge mismatch" errors.
|
||||
__gcov_dump();
|
||||
#endif
|
||||
|
||||
int status;
|
||||
switch (proc->type) {
|
||||
case kProcessTypeUv:
|
||||
|
Reference in New Issue
Block a user