From 1ba05dda6ded6a59fe7dbcaa16558c37eca5a548 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Fri, 21 Jul 2023 02:56:43 +0200 Subject: [PATCH] Add --dry-run option to debug what tests are going to be ran exactly --- lib/tests_coordination.sh | 8 ++++++++ package_check.sh | 10 +++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/tests_coordination.sh b/lib/tests_coordination.sh index fa80e32..1cba268 100644 --- a/lib/tests_coordination.sh +++ b/lib/tests_coordination.sh @@ -57,6 +57,14 @@ run_all_tests() { read -p "Press a key to start the tests..." < /dev/tty fi + if [ $dry_run -eq 1 ]; then + for FILE in $(ls $TEST_CONTEXT/tests/*.json) + do + cat $FILE | jq + done + exit + fi + # Launch all tests successively cat $TEST_CONTEXT/tests/*.json >> /proc/self/fd/3 diff --git a/package_check.sh b/package_check.sh index 674415c..52d3ba2 100755 --- a/package_check.sh +++ b/package_check.sh @@ -13,6 +13,7 @@ print_help() { -a, --arch=ARCH -d, --dist=DIST -y, --ynh-branch=BRANCH + -D, --dry-run Show a JSON representing which tests are going to be ran (meant for debugging) -i, --interactive Wait for the user to continue before each remove -e, --interactive-on-errors Wait for the user to continue on errors -s, --force-stop Force the stop of running package_check @@ -35,6 +36,7 @@ exit 0 [ "$#" -eq 0 ] && print_help gitbranch="" +dry_run=0 interactive=0 interactive_on_errors=0 rebuild=0 @@ -54,6 +56,7 @@ function parse_args() { fi # For each argument in the array, reduce to short argument for getopts arguments[$i]=${arguments[$i]//--interactive/-i} + arguments[$i]=${arguments[$i]//--dry-run/-D} arguments[$i]=${arguments[$i]//--rebuild/-r} arguments[$i]=${arguments[$i]//--force-stop/-s} arguments[$i]=${arguments[$i]//--help/-h} @@ -71,7 +74,7 @@ function parse_args() { # Initialize the index of getopts OPTIND=1 # Parse with getopts only if the argument begin by - - getopts ":b:iresh" parameter || true + getopts ":b:Diresh" parameter || true case $parameter in b) # --branch=branch-name @@ -83,6 +86,11 @@ function parse_args() { interactive=1 shift_value=1 ;; + D) + # --dry-run + dry_run=1 + shift_value=1 + ;; e) # --interactive-on-errors interactive_on_errors=1