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
|
||||
|
||||
if [ -z "$2" ]; then
|
||||
# First try symlink from parent repo's bin/whck
|
||||
# Second try compiled version from parent repo (endpoint implementation) in whck 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)
|
||||
# First try build script from whck/ in current folder (called from endpoints.php repo)
|
||||
# Or try build script from ../whck folder (called from this submodule)
|
||||
output="$(findBin \
|
||||
../bin/whck \
|
||||
../whck/target/release/whck \
|
||||
../whck/target/debug/whck \
|
||||
../../whck/target/release/whck \
|
||||
../../whck/target/debug/whck \
|
||||
whck/bin/cli \
|
||||
../whck/bin/cli
|
||||
)"
|
||||
if [ $? -eq 0 ]; then
|
||||
if [[ "$(echo "$output" | wc -l)" == "1" ]]; then
|
||||
export WHCK="$output"
|
||||
export FIND_WHCK="$output"
|
||||
else
|
||||
# Some warnings, print but use result from last line
|
||||
echo "$output" | head -n -1
|
||||
export WHCK="$(echo "$output" | tail -n 1)"
|
||||
export FIND_WHCK="$(echo "$output" | tail -n 1)"
|
||||
fi
|
||||
else
|
||||
echo "ERROR: Could not find webhook check program (whck). Output:"
|
||||
echo "$output"
|
||||
exit 1
|
||||
fi
|
||||
# cli script needs to be executed to get absolute path to the program
|
||||
export WHCK="$("$FIND_WHCK")"
|
||||
else
|
||||
if [ -x "$ORIGDIR"/"$2" ]; then
|
||||
export WHCK="$(realpath "$ORIGDIR"/"$2")"
|
||||
|
|
Loading…
Reference in New Issue