-
Notifications
You must be signed in to change notification settings - Fork 14
/
run-samples.sh
executable file
·53 lines (45 loc) · 1.14 KB
/
run-samples.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/bash
opt_short="dlp:"
opt_long="debug,looped,pattern:,negative"
OPTS=$(getopt -o "$opt_short" -l "$opt_long" -- "$@")
eval set -- "$OPTS"
# default values
build_type=Release
looped=false
pattern=
negative=
# get args
while true
do
case "$1" in
-d|--debug)
build_type=Debug
shift ;;
-l|--looped)
looped=true
shift;;
-p|--pattern)
[[ ! "$2" =~ ^- ]] && pattern="-path $2"
shift 2 ;;
--negative)
negative="!"
shift;;
--) # End of input reading
shift; break ;;
esac
done
script_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
if [ $build_type == "Debug" ];
then
echo "Will run the samples using the debug version of shards"
else
echo "Will run the samples using the release version of shards"
fi
# execute commands
pushd $script_dir/docs/samples
for i in $(find shards -name '*.edn' $negative $pattern);
do
echo "running sample $i";
$script_dir/build/$build_type/shards $script_dir/docs/samples/run-sample.edn --looped $looped --file "$i" > >(tee "$i.log");
done
popd