Update test.sh appended prefix "X" to string variable comparisons (#1711)

Added the prefix "X" to string variable comparisons because it is the convention mentioned in the book with the turtle. This is done because comparing a variable to a - causes issues.
This commit is contained in:
albaropereyra22 2023-08-10 21:00:23 -07:00 committed by GitHub
parent 56f620717e
commit 3fa480dd87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 8 deletions

16
test.sh
View File

@ -4,7 +4,7 @@ echo "First arg:"
echo $1 echo $1
os='linux' os='linux'
if [ "$1" = "-w" ]; then if [ "X$1" = "X-w" ]; then
os='windows' os='windows'
fi fi
@ -12,7 +12,7 @@ src_dir=$(pwd)
echo "OS:" $os echo "OS:" $os
if [ $os = "linux" ]; then if [ "X$os" = "Xlinux" ]; then
drogon_ctl_exec=$(pwd)/build/drogon_ctl/drogon_ctl drogon_ctl_exec=$(pwd)/build/drogon_ctl/drogon_ctl
else else
drogon_ctl_exec=$(pwd)/build/drogon_ctl/Debug/drogon_ctl.exe drogon_ctl_exec=$(pwd)/build/drogon_ctl/Debug/drogon_ctl.exe
@ -21,7 +21,7 @@ fi
echo ${drogon_ctl_exec} echo ${drogon_ctl_exec}
cd build/lib/tests/ cd build/lib/tests/
if [ $os = "windows" ]; then if [ "X$os" = "Xwindows" ]; then
cd Debug cd Debug
fi fi
@ -42,7 +42,7 @@ case $(nproc) in
;; ;;
esac esac
if [ $os = "linux" ]; then if [ "X$os" = "Xlinux" ]; then
if [ -f /bin/ninja ]; then if [ -f /bin/ninja ]; then
cmake_gen='-G Ninja' cmake_gen='-G Ninja'
else else
@ -51,7 +51,7 @@ if [ $os = "linux" ]; then
fi fi
#Make integration_test_server run as a daemon #Make integration_test_server run as a daemon
if [ $os = "linux" ]; then if [ "X$os" = "Xlinux" ]; then
sed -i -e "s/\"run_as_daemon.*$/\"run_as_daemon\": true\,/" config.example.json sed -i -e "s/\"run_as_daemon.*$/\"run_as_daemon\": true\,/" config.example.json
fi fi
sed -i -e "s/\"relaunch_on_error.*$/\"relaunch_on_error\": true\,/" config.example.json sed -i -e "s/\"relaunch_on_error.*$/\"relaunch_on_error\": true\,/" config.example.json
@ -131,7 +131,7 @@ cd ../views
echo "Hello, world!" >>hello.csp echo "Hello, world!" >>hello.csp
cd ../build cd ../build
if [ $os = "windows" ]; then if [ "X$os" = "Xwindows" ]; then
cmake_gen="$cmake_gen -DCMAKE_TOOLCHAIN_FILE=$src_dir/conan_toolchain.cmake \ cmake_gen="$cmake_gen -DCMAKE_TOOLCHAIN_FILE=$src_dir/conan_toolchain.cmake \
-DCMAKE_PREFIX_PATH=$src_dir/install \ -DCMAKE_PREFIX_PATH=$src_dir/install \
-DCMAKE_POLICY_DEFAULT_CMP0091=NEW \ -DCMAKE_POLICY_DEFAULT_CMP0091=NEW \
@ -151,7 +151,7 @@ if [ $? -ne 0 ]; then
exit -1 exit -1
fi fi
if [ $os = "linux" ]; then if [ "X$os" = "Xlinux" ]; then
if [ ! -f "drogon_test" ]; then if [ ! -f "drogon_test" ]; then
echo "Failed to build drogon_test" echo "Failed to build drogon_test"
exit -1 exit -1
@ -166,7 +166,7 @@ fi
cd ../../ cd ../../
rm -rf drogon_test rm -rf drogon_test
if [ "$1" = "-t" ]; then if [ "X$1" = "X-t" ]; then
#unit testing #unit testing
cd ../../ cd ../../
echo "Unit testing" echo "Unit testing"