test_web.sh: Use bin/cli from whck submodule when direct path not passed as $2
This commit is contained in:
parent
92bfbff77e
commit
e6dddb240e
19
test_web.sh
19
test_web.sh
|
@ -39,30 +39,27 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$2" ]; then
|
if [ -z "$2" ]; then
|
||||||
# First try symlink from parent repo's bin/whck
|
# First try build script from whck/ in current folder (called from endpoints.php repo)
|
||||||
# Second try compiled version from parent repo (endpoint implementation) in whck submodule
|
# Or try build script from ../whck folder (called from this submodule)
|
||||||
# Third try compiled version from whck folder in grandparent folder (eg. when called from
|
|
||||||
# forge/endpoints.php/spec/test_web.sh to find forge/whck/target/*/whck)
|
|
||||||
output="$(findBin \
|
output="$(findBin \
|
||||||
../bin/whck \
|
whck/bin/cli \
|
||||||
../whck/target/release/whck \
|
../whck/bin/cli
|
||||||
../whck/target/debug/whck \
|
|
||||||
../../whck/target/release/whck \
|
|
||||||
../../whck/target/debug/whck \
|
|
||||||
)"
|
)"
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
if [[ "$(echo "$output" | wc -l)" == "1" ]]; then
|
if [[ "$(echo "$output" | wc -l)" == "1" ]]; then
|
||||||
export WHCK="$output"
|
export FIND_WHCK="$output"
|
||||||
else
|
else
|
||||||
# Some warnings, print but use result from last line
|
# Some warnings, print but use result from last line
|
||||||
echo "$output" | head -n -1
|
echo "$output" | head -n -1
|
||||||
export WHCK="$(echo "$output" | tail -n 1)"
|
export FIND_WHCK="$(echo "$output" | tail -n 1)"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "ERROR: Could not find webhook check program (whck). Output:"
|
echo "ERROR: Could not find webhook check program (whck). Output:"
|
||||||
echo "$output"
|
echo "$output"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
# cli script needs to be executed to get absolute path to the program
|
||||||
|
export WHCK="$("$FIND_WHCK")"
|
||||||
else
|
else
|
||||||
if [ -x "$ORIGDIR"/"$2" ]; then
|
if [ -x "$ORIGDIR"/"$2" ]; then
|
||||||
export WHCK="$(realpath "$ORIGDIR"/"$2")"
|
export WHCK="$(realpath "$ORIGDIR"/"$2")"
|
||||||
|
|
Loading…
Reference in New Issue