Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] selftests/mm: Exit on invalid command-line options
@ 2026-09-06 13:44 hi
  2026-09-06 13:54 ` [PATCH RESEND] " Tianyi Chen
  0 siblings, 1 reply; 11+ messages in thread
From: hi @ 2026-09-06 13:44 UTC (permalink / raw)
  To: akpm, david; +Cc: shuah, linux-mm, linux-kselftest, linux-kernel, jsavitz

[-- Attachment #1: Type: text/plain, Size: 1548 bytes --]

getopts reports unknown options and missing option arguments, but

run_vmtests.sh ignores its error result and continues running tests.

For example, passing -z or omitting the argument to -t can run the

default test selection instead of rejecting the command.




Exit with failure when getopts reports an error, before any tests or

their setup run. Keep the diagnostic provided by getopts.




Verified that -z, -t and -t mmap -z exit with status 1, while -h still

exits with status 0. The mmap category's three test programs pass in

a VM running the kernel built from the same source tree.




Fixes: 85463321e726 ("selftests/vm: enable running select groups of tests")

Assisted-by: LLM
Signed-off-by: Tianyi Chen <hi@tychen.cc>


---

 tools/testing/selftests/mm/run_vmtests.sh | 1 +

 1 file changed, 1 insertion(+)




diff --git a/tools/testing/selftests/mm/run_vmtests.sh b/tools/testing/selftests/mm/run_vmtests.sh

index d09f9f6a384..189927f87e6 100755

--- a/tools/testing/selftests/mm/run_vmtests.sh

+++ b/tools/testing/selftests/mm/run_vmtests.sh

@@ -110,6 +110,7 @@ while getopts "aht:nd" OPT; do

            "t") VM_SELFTEST_ITEMS=${OPTARG} ;;

            "n") TAP_PREFIX= ;;

            "d") RUN_DESTRUCTIVE=true ;;

+           "?") exit 1 ;;

      esac

 done

 shift $((OPTIND -1))

-- 

2.55.0


 (https://www.spaceship.com/business-email/?utm_source=def_email_sign&utm_medium=email&utm_campaign=def_email_sign)

[-- Attachment #2: Type: text/html, Size: 3742 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2026-09-08 11:37 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-06 13:44 [PATCH] selftests/mm: Exit on invalid command-line options hi
2026-09-06 13:54 ` [PATCH RESEND] " Tianyi Chen
2026-09-07 11:47   ` David Hildenbrand (Arm)
2026-09-08  9:55     ` Tianyi Chen
2026-09-08  9:55   ` [PATCH v2 0/2] selftests/mm: Validate selections and scope memfd_secret setup Tianyi Chen
2026-09-08  9:55     ` [PATCH v2 1/2] selftests/mm: Reject invalid test selections before running tests Tianyi Chen
2026-09-08 10:13       ` David Hildenbrand (Arm)
2026-09-08 11:36         ` Tianyi Chen
2026-09-08  9:55     ` [PATCH v2 2/2] selftests/mm: Only prepare ptrace_scope when memfd_secret is selected Tianyi Chen
2026-09-08 10:14       ` David Hildenbrand (Arm)
2026-09-08 10:15     ` [PATCH v2 0/2] selftests/mm: Validate selections and scope memfd_secret setup David Hildenbrand (Arm)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox