File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -140,6 +140,29 @@ function _exeflags_and_env(options)
140
140
end
141
141
# if exeflags already contains '--color=no', the 'no' will prevail
142
142
pushfirst! (exeflags, " --color=yes" )
143
+
144
+ # Ensure that coverage settings are passed to the worker so that worker
145
+ # code is tracked correctly during tests.
146
+ # Based on https://github.com/JuliaLang/julia/blob/eed18bdf706b7aab15b12f3ba0588e8fafcd4930/base/util.jl#L216-L229.
147
+ opts = Base. JLOptions ()
148
+ if opts. code_coverage != 0
149
+ # Forward the code-coverage flag only if applicable (if the filename
150
+ # is pid-dependent)
151
+ coverage_file =
152
+ (opts. output_code_coverage != C_NULL ) ?
153
+ unsafe_string (opts. output_code_coverage) : " "
154
+ if isempty (coverage_file) || occursin (" %p" , coverage_file)
155
+ if opts. code_coverage == 1
156
+ push! (exeflags, " --code-coverage=user" )
157
+ elseif opts. code_coverage == 2
158
+ push! (exeflags, " --code-coverage=all" )
159
+ elseif opts. code_coverage == 3
160
+ push! (exeflags, " --code-coverage=@$(unsafe_string (opts. tracked_path)) " )
161
+ end
162
+ isempty (coverage_file) || push! (exeflags, " --code-coverage=$coverage_file " )
163
+ end
164
+ end
165
+
143
166
return exeflags, env
144
167
end
145
168
You can’t perform that action at this time.
0 commit comments