Skip to contentSkip to conversation

Improving test case constructions

cocci Markus Elfring 1 participant 1 message Jan 17, 2025

lore
Share & tools
lore
#0 lore raw

Dear Victor,

I noticed also the commit “add test case for crash fixed in cca22217” (from 2025-01-14).
https://gitlab.inria.fr/coccinelle/coccinelle/-/commit/3a8852684a48a6cd04f72a853c0ad22e4fb3e5dd

I find such a test case construction improvable.

Quoted 2 lines

+++ tests/define_unmatched.c
+// https://github.com/bminor/binutils-gdb/blob/gdb-15.2-release/sim/common/cgen-mem.h#L171-L173

The referenced source code indicates that conditional compilation would be relevant here.

Review

Quoted 3 lines
(quoted diff) +3 -0
+#define DECLARE_SETMEM_EXTERN(mode, size) \
+#define DECLARE_SETMEM(mode, size) DECLARE_SETMEM_EXTERN (mode, size
+DECLARE_SETMEM (SF, 4)

It seems that more code is provided than needed. Will reduced test cases become more helpful here?

Quoted 1 line

+++ tests/define_unmatched.cocci

…

Quoted 1 line

+// we do not expect a change, we are just checking coccinelle does not crash

…

I suggest to reconsider this test goal once more.

A change attempt is actually expressed.
I would prefer to use SmPL asterisk functionality here.

Quoted 1 line

+++ tests/define_unmatched.res

I find the shown test result questionable. I would expect corresponding modifications here. Will any bugs get additional development attention?

Regards,
Markus