Skip to content

Commit c521dc6

Browse files
committed
csmock: record suppressed results
1 parent b3914ed commit c521dc6

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

py/csmock

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ DEFAULT_RESULT_FILTERS = [
9090
"csgrep --mode=json --invert-match --path '^ksh-.*[0-9]+\\.c$'",
9191
"csgrep --mode=json --invert-match --path 'CMakeFiles/CMakeTmp|conftest.c'"]
9292

93+
# path filter needed with `rpmbuild -bi`
94+
# TODO: introduce a csgrep option for this
95+
RPM_BI_FILTER = "sed 's|/builddir/build/BUILDROOT/[^/]*/|/builddir/build/BUILD//|'"
96+
9397
# path to csexec-loader is hard-coded for now
9498
CSEXEC_ENABLE_FLAG = "-Wl,--dynamic-linker,/usr/bin/csexec-loader"
9599

@@ -1035,8 +1039,7 @@ cd %%s*/ || cd *\n\
10351039
ec = mock.exec_mockbuild_cmd(cmd, quiet=False)
10361040
if ec != 0:
10371041
results.error("%install failed", ec=ec)
1038-
bd_flt = "sed 's|/builddir/build/BUILDROOT/[^/]*/|/builddir/build/BUILD//|'"
1039-
props.result_filters = [bd_flt] + props.result_filters
1042+
props.result_filters = [RPM_BI_FILTER] + props.result_filters
10401043

10411044
# execute post-build commands in the chroot
10421045
for cmd in props.post_build_chroot_cmds:
@@ -1093,6 +1096,15 @@ cd %%s*/ || cd *\n\
10931096
cmd += " | cssort --key=path > '%s'" % js_file
10941097
results.exec_cmd(cmd, shell=True)
10951098

1099+
# record suppressed results
1100+
js_supp = "%s/suppressed-results.js" % results.dbgdir
1101+
cmd = "%s '%s' " % (RPM_BI_FILTER, all_file)
1102+
cmd += "| csgrep --mode=json --strip-path-prefix /builddir/build/BUILD/ "
1103+
cmd += "| csdiff --show-internal '%s' - " % js_file
1104+
cmd += "| cssort > '%s'" % js_supp
1105+
results.exec_cmd(cmd, shell=True)
1106+
finalize_results(js_supp, results, props)
1107+
10961108
finalize_results(js_file, results, props)
10971109
return results.ec
10981110

0 commit comments

Comments
 (0)