Files
scst/scripts/kunit
Gleb Chesnokov d2a91a2147 scripts: Preserve kernel patch conditions across whitespace changes
In-tree CI builds report compatibility errors after whitespace cleanup:

  Linux 7.3:
    conflicting types for 'wr'; have 'struct ib_rdma_wr'
    'sgv_shrinker' is a pointer; did you mean to use '->'?

  Linux 6.18.57, dev_handlers/scst_vdisk_main.c:330:
    too many arguments to function 'blkdev_issue_flush'

Two assumptions in specialize-patch change branch selection when only
whitespace changes in otherwise equivalent preprocessor expressions.

The dispatch expression accepts only spaces before '#'. A tab-indented
opening directive is copied as ordinary text, while its closing directive
still changes the conditional nesting state. Accept all horizontal
whitespace as the expression evaluator already does, including when an
indented #elif becomes #if after discarding its original opening branch.

The evaluator also substitutes an empty string for absent RHEL_MAJOR,
RHEL_RELEASE_CODE and MOFED version macros. Thus 'RHEL_MAJOR - 0' becomes
'- 0', which its signed-number patterns cannot reduce correctly. This
leaves the two-argument blkdev_issue_flush() call in a modern upstream
patch. Substitute zero for these absent numeric macros, matching C
preprocessor semantics and the existing RHEL_MINOR handling. Keep their
defined() results false and preserve supplied vendor version values.

Add isolated regressions for spaces and tabs around '#', nested unknown
guards, promoted #elif branches and absent vendor versions. Cover all
three flush signatures at the upstream 5.8/5.12 and RHEL 8.4/8.6 boundaries,
plus EL7, RHEL 9, upstream 6.18.57 and 7.3, with both '-0' and '- 0'. Apply
each resulting patch in a temporary directory in removal and blank-
preserving modes, checking selected branches, surviving guards and hunk
lengths without compiling or loading SCST.

Install patch in the CI build stage used by these generator tests. Without
this dependency, all 98 specialization subcases abort before applying the
patches, with the following error in the minimal Fedora build image:

  FileNotFoundError: [Errno 2] No such file or directory: 'patch'
2026-10-21 22:12:25 +03:00
..
2026-10-14 16:30:27 +03:00