selftests: netconsole: Do not exit from inside the validation function
authorBreno Leitao <leitao@debian.org>
Mon, 9 Jun 2025 09:46:28 +0000 (02:46 -0700)
committerJakub Kicinski <kuba@kernel.org>
Tue, 10 Jun 2025 21:21:53 +0000 (14:21 -0700)
Remove the exit call from validate_result() function and move the
test exit logic to the main script. This allows the function to
be reused in scenarios where the test needs to continue execution
after validation, rather than terminating immediately.

The validate_result() function should focus on validation logic
only, while the calling script maintains control over program
flow and exit conditions. This change improves code modularity
and prepares for potential future enhancements where multiple
validations might be needed in a single test run.

Signed-off-by: Breno Leitao <leitao@debian.org>
Link: https://patch.msgid.link/20250609-netcons_ext-v3-3-5336fa670326@debian.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/drivers/net/lib/sh/lib_netcons.sh
tools/testing/selftests/drivers/net/netcons_basic.sh

index 29b01b8..2d5dd32 100644 (file)
@@ -185,7 +185,6 @@ function validate_result() {
        # Delete the file once it is validated, otherwise keep it
        # for debugging purposes
        rm "${TMPFILENAME}"
-       exit "${ksft_pass}"
 }
 
 function check_for_dependencies() {
index fe765da..d2f0685 100755 (executable)
@@ -50,3 +50,5 @@ busywait "${BUSYWAIT_TIMEOUT}" test -s "${OUTPUT_FILE}"
 # Make sure the message was received in the dst part
 # and exit
 validate_result "${OUTPUT_FILE}"
+
+exit "${ksft_pass}"