|
|
@@ -1,16 +1,9 @@ |
|
|
|
progName=serviceProgram |
|
|
|
debugFileName=$progName"Debug.log" |
|
|
|
|
|
|
|
if [ "$(uname --operating-system)" == "Msys" ] |
|
|
|
then |
|
|
|
CFLAGS='-I.. -Wall -std=c++11 -DWIN32 -pthread -static -DDEBUG_LOG_FILE="' |
|
|
|
CFLAGS=$CFLAGS$(pwd)/$debugFileName\" |
|
|
|
CFLAGS='-I.. -Wall -std=c++11 -DWIN32 -pthread -static' |
|
|
|
else |
|
|
|
CFLAGS='-I.. -Wall -std=c++11 -g -O0 -pthread -DDEBUG_LOG_FILE="' |
|
|
|
CFLAGS=$CFLAGS$(pwd)/$debugFileName\" |
|
|
|
CFLAGS='-I.. -Wall -std=c++11 -g -O0 -pthread' |
|
|
|
fi |
|
|
|
#CFLAGS='-I.. -Wall -std=gnu++17 -g -O0 -pthread -DDEBUG_LOG_FILE="' |
|
|
|
CFLAGS='-I.. -Wall -DWINDOWS_SERVICE -static -DDEBUG_LOG_FILE="Debug.log"' |
|
|
|
#CFLAGS='-I.. -Wall -std=gnu++17 -g -O0 -pthread' |
|
|
|
|
|
|
|
g++ $CFLAGS $progName.cpp ../CodeDweller/service.cpp -o $progName |
|
|
|
if [ $? -ne 0 ] |
|
|
@@ -37,29 +30,29 @@ run_test() { |
|
|
|
if [ "$(uname --operating-system)" == "Msys" ] |
|
|
|
then |
|
|
|
|
|
|
|
sc create "Test Service" binPath= "$(pwd)/$progName.exe" > /dev/null 2>&1 |
|
|
|
sc create "Test Service" binPath= "$(pwd)/$progName.exe" |
|
|
|
|
|
|
|
#echo "Starting at "$(date +"%H:%M:%S.%N") |
|
|
|
sc start "Test Service" "$(pwd)/$logFile" $message > /dev/null 2>&1 |
|
|
|
#echo "Sleeping 1 s at "$(date +"%H:%M:%S.%N") |
|
|
|
echo "Starting at "$(date +"%H:%M:%S.%N") |
|
|
|
sc start "Test Service" "$(pwd)/$logFile" $message |
|
|
|
echo "Sleeping 1 s at "$(date +"%H:%M:%S.%N") |
|
|
|
sleep 1 |
|
|
|
|
|
|
|
#echo "Pausing at "$(date +"%H:%M:%S.%N") |
|
|
|
sc pause "Test Service" > /dev/null 2>&1 |
|
|
|
#echo "Sleeping 2 s at "$(date +"%H:%M:%S.%N") |
|
|
|
echo "Pausing at "$(date +"%H:%M:%S.%N") |
|
|
|
sc pause "Test Service" |
|
|
|
echo "Sleeping 2 s at "$(date +"%H:%M:%S.%N") |
|
|
|
sleep 2 |
|
|
|
|
|
|
|
#echo "Continuing at "$(date +"%H:%M:%S.%N") |
|
|
|
sc continue "Test Service" > /dev/null 2>&1 |
|
|
|
#echo "Sleeping 2 s at "$(date +"%H:%M:%S.%N") |
|
|
|
echo "Continuing at "$(date +"%H:%M:%S.%N") |
|
|
|
sc continue "Test Service" |
|
|
|
echo "Sleeping 2 s at "$(date +"%H:%M:%S.%N") |
|
|
|
sleep 2 |
|
|
|
|
|
|
|
#echo "Stopping at "$(date +"%H:%M:%S.%N") |
|
|
|
sc stop "Test Service" > /dev/null 2>&1 |
|
|
|
#echo "Returned at "$(date +"%H:%M:%S.%N") |
|
|
|
echo "Stopping at "$(date +"%H:%M:%S.%N") |
|
|
|
sc stop "Test Service" |
|
|
|
echo "Returned at "$(date +"%H:%M:%S.%N") |
|
|
|
sleep 1 |
|
|
|
|
|
|
|
sc delete "Test Service" > /dev/null 2>&1 |
|
|
|
sc delete "Test Service" |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
@@ -122,12 +115,17 @@ return 0 |
|
|
|
} |
|
|
|
|
|
|
|
# Run tests. |
|
|
|
echo Running Nominal test |
|
|
|
run_test Nominal |
|
|
|
nominal_status=$? |
|
|
|
echo Completed Nominal test |
|
|
|
echo |
|
|
|
|
|
|
|
# Stop timeout. |
|
|
|
echo Running Stop test |
|
|
|
run_test Stop |
|
|
|
stop_status=$? |
|
|
|
echo Completed Stop test |
|
|
|
|
|
|
|
if [ $nominal_status == "0" -a \ |
|
|
|
$stop_status == "0" ] |