Skip to content

Commit 39bccb3

Browse files
author
Lucas Yoon
committed
adding dynamic test scripts for devfile
1 parent 7792c86 commit 39bccb3

File tree

2 files changed

+62
-4
lines changed

2 files changed

+62
-4
lines changed

tests/check_non_terminating.sh

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,48 @@
22
set -o nounset
33
set -o errexit
44

5-
DEVFILES_DIR="$(pwd)/stacks"
5+
POSITIONAL_ARGS=()
6+
7+
stackDirs=''
8+
stacksPath=''
9+
10+
while [[ $# -gt 0 ]]; do
11+
case $1 in
12+
--stackDirs)
13+
stackDirs=$2
14+
shift # past argument
15+
shift
16+
;;
17+
--stacksPath)
18+
stacksPath=$2
19+
shift # past argument
20+
shift
21+
;;
22+
-*|--*)
23+
echo "Unknown option $1"
24+
exit 1
25+
;;
26+
*)
27+
POSITIONAL_ARGS+=("$1") # save positional arg
28+
shift # past argument
29+
;;
30+
esac
31+
done
32+
33+
set -- "${POSITIONAL_ARGS[@]}" # restore positional parameters
34+
35+
if [ -z "$stackDirs" ]; then
36+
stackDirs=$(bash "$(pwd)/tests/get_stacks.sh")
37+
fi
38+
39+
if [ -z "$stacksPath" ]; then
40+
stacksPath="$(pwd)/stacks"
41+
fi
42+
43+
DEVFILES_DIR="$stacksPath"
644

745
# The stacks to test as a string separated by spaces
8-
STACKS=$(bash "$(pwd)/tests/get_stacks.sh")
46+
STACKS="$stackDirs"
947

1048
# Path to the check_non_terminating go package
1149
BIN_NAME=${BIN_NAME:-"flatten-parent"}

tests/validate_devfile_schemas.sh

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ POSITIONAL_ARGS=()
44
SAMPLES="false"
55
VERBOSE="false"
66

7+
stackDirs=''
8+
stacksPath=''
9+
710
while [[ $# -gt 0 ]]; do
811
case $1 in
912
-s|--samples)
@@ -14,6 +17,16 @@ while [[ $# -gt 0 ]]; do
1417
VERBOSE="true"
1518
shift # past argument
1619
;;
20+
--stackDirs)
21+
stackDirs=$2
22+
shift # past argument
23+
shift
24+
;;
25+
--stacksPath)
26+
stacksPath=$2
27+
shift # past argument
28+
shift
29+
;;
1730
-*|--*)
1831
echo "Unknown option $1"
1932
exit 1
@@ -28,8 +41,15 @@ done
2841
set -- "${POSITIONAL_ARGS[@]}" # restore positional parameters
2942
set -x
3043

31-
stacksDir=${STACKS_DIR:-stacks}
32-
stackDirs=${STACKS:-"$(bash "$(pwd)/tests/get_stacks.sh")"}
44+
if [ -z "$stacksPath" ]; then
45+
stacksPath=${STACKS_DIR:-stacks}
46+
fi
47+
48+
if [ -z "$stackDirs" ]; then
49+
stackDirs=${STACKS:-"$(bash "$(pwd)/tests/get_stacks.sh")"}
50+
fi
51+
52+
stacksDir="$stacksPath"
3353

3454
# Use pwd if relative path
3555
if [[ ! ${stacksDir} = /* ]]; then

0 commit comments

Comments
 (0)