[LTP] [PATCH 1/4] ci: patchwork.sh: Add check for number of parameters

Petr Vorel pvorel@suse.cz
Fri Apr 25 17:30:42 CEST 2025


Checking user input is always good to avoid unexpected results
(e.g. setting patchwork state without a description).

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Minor cleanup before modifying the file.

 ci/tools/patchwork.sh | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/ci/tools/patchwork.sh b/ci/tools/patchwork.sh
index 83ef0bb220..fe6c049aca 100755
--- a/ci/tools/patchwork.sh
+++ b/ci/tools/patchwork.sh
@@ -76,6 +76,11 @@ set_patch_state() {
 }
 
 set_series_state() {
+        if [ $# -ne 2 ]; then
+            echo "'state' command expects 2 parameters ($#)"
+            exit 1
+        fi
+
         local series_id="$1"
         local state="$2"
 
@@ -131,6 +136,11 @@ verify_new_patches() {
 }
 
 send_results() {
+        if [ $# -ne 4 ]; then
+            echo "'check' command expects 4 parameters ($#)"
+            exit 1
+        fi
+
         local series_id="$1"
         local target_url="$2"
 
-- 
2.49.0



More information about the ltp mailing list