Skip to content

Commit 46a8bb4

Browse files
committed
tests: check_selftest: make sure we extract the base name
For C files we are trimming the .c from the needle, but then still use path in the search. So the .c suffix remains leading to: tools/testing/selftests/net/af_unix/so_peek_off.c not found in Makefile so_peek_off.c not found in .gitignore Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 2a3f501 commit 46a8bb4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tests/patch/check_selftest/test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ def check_new_files_makefile(tree, new_files, log):
4242
log.append("makefile inclusion check ignoring " + path)
4343
continue
4444

45+
needle = os.path.basename(needle)
4546
makefile = os.path.dirname(path) + "/Makefile"
46-
needle = os.path.basename(path)
4747

4848
cmd = ["git", "grep", needle, "--", makefile]
4949
result = subprocess.run(cmd, cwd=tree.path, capture_output=True,
@@ -72,8 +72,8 @@ def check_new_files_gitignore(tree, new_files, log):
7272
log.append("gitignore check ignoring " + path)
7373
continue
7474

75+
needle = os.path.basename(needle)
7576
target = os.path.dirname(path) + "/.gitignore"
76-
needle = os.path.basename(path)
7777

7878
cmd = ["git", "grep", needle, "--", target]
7979
result = subprocess.run(cmd, cwd=tree.path, capture_output=True,

0 commit comments

Comments
 (0)