Skip to content

run.py: check for pattern on test's parent dir#2864

Open
inashivb wants to merge 1 commit intoOISF:masterfrom
inashivb:pattern-name-fix/v3
Open

run.py: check for pattern on test's parent dir#2864
inashivb wants to merge 1 commit intoOISF:masterfrom
inashivb:pattern-name-fix/v3

Conversation

@inashivb
Copy link
Member

Previous PR: #2858

Changes since v2:

  • instead of parent of basename, get parent from tests dir

@catenacyber catenacyber added the framework Has a suricata-verify framework change label Jan 16, 2026
@catenacyber
Copy link
Collaborator

Thanks for doing this

In case the test name is not a match for a pattern passed on the
cmdline, also check for it's parent dir. It is no use to make test names
redundant when the dir clubs them under a name but they should all be
able to run if the dir pattern was passed.

Current behavior:

run.py dcerpc   # runs all tests that match dcerpc; this leaves some
                # tests in dcerpc/ dir that do not have dcerpc in their
                # names

With this patch:

run.py dcerpc   # first matches the test name with the pattern, if not
                # found, checks if its parent dir matches. All dcerpc
                # tests grouped under dcerpc/ dir will run
@inashivb inashivb force-pushed the pattern-name-fix/v3 branch from 96525be to c29d881 Compare January 16, 2026 12:51
@jasonish jasonish self-assigned this Jan 21, 2026
if dirpath == tdir:
continue
basename = os.path.basename(dirpath)
parent = dirpath.replace(tdir, "")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strip prefix dirty like parent = dirpath[len(tdir):] ?

for pattern in patterns:
if args.exact:
if pattern == basename:
if pattern == parent or pattern == basename:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure we should change the exact logic with parent name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

framework Has a suricata-verify framework change

Development

Successfully merging this pull request may close these issues.

3 participants