mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	CI: improve gcov handling #10404
- Move __gcov_flush to process_spawn, for more reliable coverage tracking of subprocesses - Travis: use GCOV_ERROR_FILE - codecov: use "-X fix" to skip "fixing" uploaded coverage data; it should be handled by codecov's backend instead. - AppVeyor: no $PATH mangling, which breaks with the improved coverage tracking due to missing .dll in PATH.
This commit is contained in:
		 Daniel Hahler
					Daniel Hahler
				
			
				
					committed by
					
						 Justin M. Keyes
						Justin M. Keyes
					
				
			
			
				
	
			
			
			 Justin M. Keyes
						Justin M. Keyes
					
				
			
						parent
						
							38342d75f6
						
					
				
				
					commit
					28a86608a8
				
			| @@ -108,6 +108,7 @@ jobs: | |||||||
|       env: |       env: | ||||||
|         - GCOV=gcov |         - GCOV=gcov | ||||||
|         - CMAKE_FLAGS="$CMAKE_FLAGS -DUSE_GCOV=ON" |         - CMAKE_FLAGS="$CMAKE_FLAGS -DUSE_GCOV=ON" | ||||||
|  |         - GCOV_ERROR_FILE="/tmp/libgcov-errors.log" | ||||||
|         - *common-job-env |         - *common-job-env | ||||||
|     - name: clang-tsan |     - name: clang-tsan | ||||||
|       os: linux |       os: linux | ||||||
|   | |||||||
| @@ -32,6 +32,8 @@ after_build: | |||||||
|     if (Test-Path $env:GCOV_ERROR_FILE) { |     if (Test-Path $env:GCOV_ERROR_FILE) { | ||||||
|       Get-Content $env:GCOV_ERROR_FILE -Head 10 |       Get-Content $env:GCOV_ERROR_FILE -Head 10 | ||||||
|       Get-Content $env:GCOV_ERROR_FILE -Tail 10 |       Get-Content $env:GCOV_ERROR_FILE -Tail 10 | ||||||
|  |     } else { | ||||||
|  |       write-host "no GCOV_ERROR_FILE" | ||||||
|     } |     } | ||||||
| cache: | cache: | ||||||
| - C:\projects\nvim-deps -> third-party\** | - C:\projects\nvim-deps -> third-party\** | ||||||
|   | |||||||
| @@ -25,6 +25,7 @@ python3 -m gcovr --branches --exclude-unreachable-branches --print-summary -j 2 | |||||||
|  |  | ||||||
| # Upload to codecov. | # Upload to codecov. | ||||||
| # -X gcov: disable gcov, done manually above. | # -X gcov: disable gcov, done manually above. | ||||||
|  | # -X fix: disable fixing of reports (not necessary, rather slow) | ||||||
| # -Z: exit non-zero on failure | # -Z: exit non-zero on failure | ||||||
| # -F: flag(s) | # -F: flag(s) | ||||||
| # NOTE: ignoring flags for now, since this causes timeouts on codecov.io then, | # NOTE: ignoring flags for now, since this causes timeouts on codecov.io then, | ||||||
| @@ -32,7 +33,7 @@ python3 -m gcovr --branches --exclude-unreachable-branches --print-summary -j 2 | |||||||
| # Flags must match pattern ^[\w\,]+$ ("," as separator). | # Flags must match pattern ^[\w\,]+$ ("," as separator). | ||||||
| codecov_flags="$(uname -s),${1}" | codecov_flags="$(uname -s),${1}" | ||||||
| codecov_flags=$(echo "$codecov_flags" | sed 's/[^,_a-zA-Z0-9]/_/g') | codecov_flags=$(echo "$codecov_flags" | sed 's/[^,_a-zA-Z0-9]/_/g') | ||||||
| if ! "$codecov_sh" -f coverage.xml -X gcov -Z -F "${codecov_flags}"; then | if ! "$codecov_sh" -f coverage.xml -X gcov -X fix -Z -F "${codecov_flags}"; then | ||||||
|   echo "codecov upload failed." |   echo "codecov upload failed." | ||||||
| fi | fi | ||||||
|  |  | ||||||
|   | |||||||
| @@ -11,3 +11,9 @@ if [[ "${TRAVIS_OS_NAME}" == osx ]]; then | |||||||
| else | else | ||||||
|   ci/run_${CI_TARGET}.sh |   ci/run_${CI_TARGET}.sh | ||||||
| fi | fi | ||||||
|  |  | ||||||
|  | if [[ -s "${GCOV_ERROR_FILE}" ]]; then | ||||||
|  |   echo '=== Unexpected gcov errors: ===' | ||||||
|  |   cat "${GCOV_ERROR_FILE}" | ||||||
|  |   exit 1 | ||||||
|  | fi | ||||||
|   | |||||||
| @@ -26,6 +26,11 @@ | |||||||
| // For PTY processes SIGTERM is sent first (in case SIGHUP was not enough). | // For PTY processes SIGTERM is sent first (in case SIGHUP was not enough). | ||||||
| #define KILL_TIMEOUT_MS 2000 | #define KILL_TIMEOUT_MS 2000 | ||||||
|  |  | ||||||
|  | /// Externally defined with gcov. | ||||||
|  | #ifdef USE_GCOV | ||||||
|  | void __gcov_flush(void); | ||||||
|  | #endif | ||||||
|  |  | ||||||
| static bool process_is_tearing_down = false; | static bool process_is_tearing_down = false; | ||||||
|  |  | ||||||
| /// @returns zero on success, or negative error code | /// @returns zero on success, or negative error code | ||||||
| @@ -50,6 +55,11 @@ int process_spawn(Process *proc, bool in, bool out, bool err) | |||||||
|     proc->err.closed = true; |     proc->err.closed = true; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  | #ifdef USE_GCOV | ||||||
|  |   // Flush coverage data before forking, to avoid "Merge mismatch" errors. | ||||||
|  |   __gcov_flush(); | ||||||
|  | #endif | ||||||
|  |  | ||||||
|   int status; |   int status; | ||||||
|   switch (proc->type) { |   switch (proc->type) { | ||||||
|     case kProcessTypeUv: |     case kProcessTypeUv: | ||||||
|   | |||||||
| @@ -36,11 +36,6 @@ | |||||||
| # include "os/pty_process_unix.c.generated.h" | # include "os/pty_process_unix.c.generated.h" | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| /// Externally defined with gcov. |  | ||||||
| #ifdef USE_GCOV |  | ||||||
| void __gcov_flush(void); |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| /// termios saved at startup (for TUI) or initialized by pty_process_spawn(). | /// termios saved at startup (for TUI) or initialized by pty_process_spawn(). | ||||||
| static struct termios termios_default; | static struct termios termios_default; | ||||||
|  |  | ||||||
| @@ -64,11 +59,6 @@ int pty_process_spawn(PtyProcess *ptyproc) | |||||||
|     init_termios(&termios_default); |     init_termios(&termios_default); | ||||||
|   } |   } | ||||||
|  |  | ||||||
| #ifdef USE_GCOV |  | ||||||
|   // Flush coverage data before forking, to avoid "Merge mismatch" errors. |  | ||||||
|   __gcov_flush(); |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
|   int status = 0;  // zero or negative error code (libuv convention) |   int status = 0;  // zero or negative error code (libuv convention) | ||||||
|   Process *proc = (Process *)ptyproc; |   Process *proc = (Process *)ptyproc; | ||||||
|   assert(proc->err.closed); |   assert(proc->err.closed); | ||||||
|   | |||||||
| @@ -21,8 +21,6 @@ describe('executable()', function() | |||||||
|     -- Windows: siblings are in Nvim's "pseudo-$PATH". |     -- Windows: siblings are in Nvim's "pseudo-$PATH". | ||||||
|     local expected = iswin() and 1 or 0 |     local expected = iswin() and 1 or 0 | ||||||
|     if iswin() then |     if iswin() then | ||||||
|       -- $PATH on AppVeyor CI might be oversized, redefine it to a minimal one. |  | ||||||
|       clear({env={PATH=[[C:\Windows\system32;C:\Windows]]}}) |  | ||||||
|       eq('arg1=lemon;arg2=sky;arg3=tree;', |       eq('arg1=lemon;arg2=sky;arg3=tree;', | ||||||
|          call('system', sibling_exe..' lemon sky tree')) |          call('system', sibling_exe..' lemon sky tree')) | ||||||
|     end |     end | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user