Skip to content

Commit 77fb230

Browse files
committed
Run coverage with MOOCORE_DEBUG=1 and exclude unreachable lines.
* .github/workflows/R.yml: Run coverage with MOOCORE_DEBUG=1. Disable LTO when running coverage. * r/src/Makevars: Use MOOCORE_DEBUG instead of DEBUG. * r/cleanup: Remove .gcda files. * c/: Exclude unreachable lines. * python/pyproject.toml [tool.coverage.report]: Exclude nocov lines. * python/tox.ini (.pkg-cov): Set MOOCORE_DEBUG=1.
1 parent 853258a commit 77fb230

File tree

14 files changed

+40
-27
lines changed

14 files changed

+40
-27
lines changed

.github/workflows/R.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,11 @@ jobs:
162162
env:
163163
NOT_CRAN: false
164164
run: |
165-
coverage <- covr::package_coverage(type="all", quiet=FALSE, clean = FALSE,
165+
coverage <- withr::with_makevars(c(MOOCORE_DEBUG="1", LTO_OPT=""),
166+
covr::package_coverage(type="all", quiet=FALSE, clean = FALSE,
166167
commentDonttest = FALSE, commentDontrun = FALSE, flags="R",
167168
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package"))
169+
)
168170
print(coverage)
169171
covr::to_cobertura(coverage)
170172
list.files("../", pattern="*.xml", recursive=TRUE)

c/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ $(CXXSHLIB): $(LIBHV_OBJS)
226226
$(CXX) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $^ $(SHLIB_LDFLAGS)
227227

228228
clean:
229-
@-$(RM) *.s *.i
229+
@-$(RM) *.s *.i *.gcda mt19937/*.gcda
230230
@-$(RM) config.status config.log
231231
@-$(RM) Hypervolume_MEX.mex
232232
@-$(RM) $(SHLIB) $(CXXSHLIB)

c/cmdline.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ static inline void default_cmdline_handler(int opt)
270270
usage();
271271
exit(EXIT_SUCCESS);
272272
default:
273-
unreachable();
273+
unreachable(); // COVR_EXCL_LINE # nocov
274274
}
275275
}
276276

c/gcc_attribs.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,14 @@
121121

122122

123123
#if (defined(__GNUC__) && __GNUC__ >= 3) || defined(__clang__)
124-
# define likely(x) __builtin_expect(!!(x), 1)
125-
# define unlikely(x) __builtin_expect(!!(x), 0)
124+
# define likely(x) __builtin_expect(!!(x), 1)
125+
# define unlikely(x) __builtin_expect(!!(x), 0)
126126
#elif (defined(__cplusplus) && __cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L)
127-
# define likely(x) (x) [[likely]]
128-
# define unlikely(x) (x) [[unlikely]]
127+
# define likely(x) (x) [[likely]]
128+
# define unlikely(x) (x) [[unlikely]]
129129
#else
130-
# define likely(x) (x)
131-
# define unlikely(x) (x)
130+
# define likely(x) (x)
131+
# define unlikely(x) (x)
132132
#endif
133133

134134
#ifdef _MSC_VER

c/hv4d_priv.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ restart_base_setup_z_and_closest(dlnode_t * restrict list, dlnode_t * restrict n
156156
}
157157
p = p->next[0];
158158
}
159-
unreachable();
159+
unreachable(); // COVR_EXCL_LINE # nocov
160160
}
161161

162162
// FIXME: This is very similar to the loop in hvc3d_list() but it doesn't use p->last_slice_z
@@ -211,7 +211,7 @@ one_contribution_3d(dlnode_t * restrict newp)
211211
lastz = px[2];
212212
p = p->next[0];
213213
}
214-
unreachable();
214+
unreachable(); // COVR_EXCL_LINE # nocov
215215
}
216216

217217
/* Compute the hypervolume indicator in d=4 by iteratively computing the one

c/hvapprox.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ int_of_power_of_sin_from_0_to_b(dimension_t m, double b)
434434
return 0.13994993409141898*b - cos_b*sin_b*(
435435
0.03125*POW(sin_b, 30) + 31/960.*POW(sin_b, 28) + 899/26880.*POW(sin_b, 26) + 8091/232960.*POW(sin_b, 24) + 13485/372736.*POW(sin_b, 22) + 310155/8200192.*POW(sin_b, 20) + 186093/4685824.*POW(sin_b, 18) + 392863/9371648.*POW(sin_b, 16) + 6678671/149946368.*POW(sin_b, 14) + 100180065/2099249152.*POW(sin_b, 12) + 33393355/645922816.*POW(sin_b, 10) + 6678671/117440512.*POW(sin_b, 8) + 60108039/939524096.*POW(sin_b, 6) + 0.07463996484875679*POW(sin_b, 4) + 0.093299956060945988*POW(sin_b, 2) + 0.13994993409141898);
436436
default:
437-
unreachable();
437+
unreachable(); // COVR_EXCL_LINE # nocov
438438
}
439439
#undef POW
440440
}

c/main-hvapprox.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ hvapprox_file (const char *filename, double *reference,
173173
volume = hv_approx_hua_wang(&data[nobj * cumsize], nobj, cumsizes[n] - cumsize, reference, maximise, nsamples);
174174
break;
175175
default:
176-
unreachable();
176+
unreachable(); // COVR_EXCL_LINE # nocov
177177
}
178178

179179
if (volume == 0.0) {

c/nondominated.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ find_dominated_point_(const double * restrict points, dimension_t dim, size_t si
474474
return find_dominated_point_agree_(
475475
points, dim, size, keep_weakly, AGREE_MAXIMISE, /*minmax=*/NULL);
476476
default:
477-
unreachable();
477+
unreachable(); // # nocov
478478
}
479479
}
480480

@@ -525,7 +525,7 @@ find_nondominated_set_(const double * restrict points, dimension_t dim, size_t s
525525
return find_nondominated_set_agree_(
526526
points, dim, size, nondom, keep_weakly, AGREE_MAXIMISE, /*minmax=*/NULL);
527527
default:
528-
unreachable();
528+
unreachable(); // # nocov
529529
}
530530
}
531531

c/pow_int.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ fast_pow_uint_max32(double base, uint_fast8_t exp)
4242
case 30: { b15 = fast_pow_uint_max32(base, 15); return b15 * b15; }
4343
case 31: { b15 = fast_pow_uint_max32(base, 15); return b15 * b15 * base; }
4444
case 32: { b16 = fast_pow_uint_max32(base, 16); return b16 * b16; }
45-
default: unreachable();
45+
default: unreachable(); // COVR_EXCL_LINE # nocov
4646
}
4747
}
4848

@@ -103,7 +103,7 @@ fast_powl_uint_max32(long double base, uint_fast8_t exp)
103103
case 30: { b15 = fast_powl_uint_max32(base, 15); return b15 * b15; }
104104
case 31: { b15 = fast_powl_uint_max32(base, 15); return b15 * b15 * base; }
105105
case 32: { b16 = fast_powl_uint_max32(base, 16); return b16 * b16; }
106-
default: unreachable();
106+
default: unreachable(); // COVR_EXCL_LINE # nocov
107107
}
108108
}
109109

python/pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,11 @@ faulthandler_timeout = 10
192192
doctest_optionflags = "NUMBER"
193193
addopts = [ "--import-mode=importlib", "--durations=5", "--durations-min=1.0" ]
194194

195+
[tool.coverage.report]
196+
exclude_also = [
197+
'# nocov',
198+
]
199+
195200
[tool.mypy]
196201
python_version = "3.11"
197202
# Strictness (recommended for library code)

0 commit comments

Comments
 (0)