File tree Expand file tree Collapse file tree 4 files changed +129
-29
lines changed
Expand file tree Collapse file tree 4 files changed +129
-29
lines changed Original file line number Diff line number Diff line change 22set -o nounset
33set -o errexit
44
5- DEVFILES_DIR=" $( pwd) /stacks"
5+ # Source shared utilities
6+ source " $( dirname " $0 " ) /paths_util.sh"
7+
8+ # Parse all arguments
9+ parse_arguments " $@ "
10+
11+ # Restore positional parameters
12+ set -- " ${POSITIONAL_ARGS[@]} "
13+
14+ # Set defaults for stack arguments
15+ set_stack_defaults
16+
17+ DEVFILES_DIR=" $stacksPath "
618
719# The stacks to test as a string separated by spaces
8- STACKS=$( bash " $( pwd ) /tests/get_stacks.sh " )
20+ STACKS=" $stackDirs "
921
1022# Path to the check_non_terminating go package
1123BIN_NAME=${BIN_NAME:- " flatten-parent" }
Original file line number Diff line number Diff line change 22
33set -x
44
5- stackDirs=$( bash " $( pwd) /tests/get_stacks.sh" )
5+ # Source shared utilities
6+ source " $( dirname " $0 " ) /paths_util.sh"
7+
8+ # Parse all arguments
9+ parse_arguments " $@ "
10+
11+ # Restore positional parameters
12+ set -- " ${POSITIONAL_ARGS[@]} "
13+
14+ # Set defaults for stack arguments
15+ set_stack_defaults
16+
617args=" "
718
819if [ ! -z " ${1} " ]; then
@@ -63,4 +74,4 @@ ginkgo run --mod=readonly --procs 2 \
6374 --skip=" stack: ollama" \
6475 --slow-spec-threshold 120s \
6576 --timeout 3h \
66- tests/odov3 -- -stacksPath " $( pwd ) " /stacks -stackDirs " $stackDirs " ${args}
77+ tests/odov3 -- -stacksPath " $stacksPath " -stackDirs " $stackDirs " ${args}
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ # Common variables used by all scripts
4+ stackDirs=' '
5+ stacksPath=' '
6+ POSITIONAL_ARGS=()
7+
8+ # Function to parse all arguments
9+ parse_arguments () {
10+ while [[ $# -gt 0 ]]; do
11+ case $1 in
12+ --stackDirs)
13+ if [ -z " ${stackDirs} " ]; then
14+ stackDirs=$2
15+ else
16+ stackDirs=" ${stackDirs} $2 "
17+ fi
18+ shift # past argument
19+ shift
20+ ;;
21+ --stacksPath)
22+ stacksPath=$2
23+ shift # past argument
24+ shift
25+ ;;
26+ -* |--* )
27+ # Try script-specific handler if it exists
28+ local consumed=0
29+ local errno=1
30+ if declare -f handle_additional_args > /dev/null 2>&1 ; then
31+ consumed=$( handle_additional_args " $@ " )
32+ errno=$?
33+ fi
34+
35+ if [ $errno -eq 0 ] && [ $consumed -gt 0 ]; then
36+ # Script handler consumed some arguments
37+ for (( i= 0 ; i< consumed; i++ )) ; do
38+ shift
39+ done
40+ else
41+ echo " Unknown option $1 "
42+ return $errno
43+ fi
44+ ;;
45+ * )
46+ POSITIONAL_ARGS+=(" $1 " ) # save positional arg
47+ shift # past argument
48+ ;;
49+ esac
50+ done
51+
52+ return 0
53+ }
54+
55+ # Function to set default values for stack arguments
56+ set_stack_defaults () {
57+ if [ -z " $stackDirs " ]; then
58+ stackDirs=$( bash " $( pwd) /tests/get_stacks.sh" )
59+ fi
60+
61+ if [ -z " $stacksPath " ]; then
62+ stacksPath=" $( pwd) /stacks"
63+ fi
64+ }
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22
3- POSITIONAL_ARGS=()
3+ # Source shared utilities
4+ source " $( dirname " $0 " ) /paths_util.sh"
5+
46SAMPLES=" false"
57VERBOSE=" false"
68
7- while [[ $# -gt 0 ]]; do
8- case $1 in
9- -s|--samples)
10- SAMPLES=" true"
11- shift # past argument
12- ;;
13- -v|--verbose)
14- VERBOSE=" true"
15- shift # past argument
16- ;;
17- -* |--* )
18- echo " Unknown option $1 "
19- exit 1
20- ;;
21- * )
22- POSITIONAL_ARGS+=(" $1 " ) # save positional arg
23- shift # past argument
24- ;;
25- esac
26- done
27-
28- set -- " ${POSITIONAL_ARGS[@]} " # restore positional parameters
9+ handle_additional_args () {
10+ case $1 in
11+ -s|--samples)
12+ SAMPLES=" true"
13+ echo 1
14+ return 0
15+ ;;
16+ -v|--verbose)
17+ VERBOSE=" true"
18+ echo 1
19+ return 0
20+ ;;
21+ * )
22+ echo 0
23+ return 1
24+ ;;
25+ esac
26+ }
27+
28+ # Parse all arguments
29+ parse_arguments " $@ "
30+
31+ # Restore positional parameters
32+ set -- " ${POSITIONAL_ARGS[@]} "
33+
2934set -x
3035
31- stacksDir=${STACKS_DIR:- stacks}
32- stackDirs=${STACKS:- " $( bash " $( pwd) /tests/get_stacks.sh" ) " }
36+ # Set defaults for stack arguments, with backward compatibility for environment variables
37+ if [ -z " $stacksPath " ]; then
38+ stacksPath=${STACKS_DIR:- stacks}
39+ fi
40+
41+ if [ -z " $stackDirs " ]; then
42+ stackDirs=${STACKS:- " $( bash " $( pwd) /tests/get_stacks.sh" ) " }
43+ fi
44+
45+ stacksDir=" $stacksPath "
3346
3447# Use pwd if relative path
3548if [[ ! ${stacksDir} = /* ]]; then
You can’t perform that action at this time.
0 commit comments