|
|
|
|
|
|
|
|
progName=serviceProgram |
|
|
progName=serviceProgram |
|
|
debugFileName=$progName"Debug.log" |
|
|
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 |
|
|
g++ $CFLAGS $progName.cpp ../CodeDweller/service.cpp -o $progName |
|
|
if [ $? -ne 0 ] |
|
|
if [ $? -ne 0 ] |
|
|
|
|
|
|
|
|
if [ "$(uname --operating-system)" == "Msys" ] |
|
|
if [ "$(uname --operating-system)" == "Msys" ] |
|
|
then |
|
|
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 |
|
|
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 |
|
|
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 |
|
|
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 |
|
|
sleep 1 |
|
|
|
|
|
|
|
|
sc delete "Test Service" > /dev/null 2>&1 |
|
|
|
|
|
|
|
|
sc delete "Test Service" |
|
|
|
|
|
|
|
|
else |
|
|
else |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
# Run tests. |
|
|
# Run tests. |
|
|
|
|
|
echo Running Nominal test |
|
|
run_test Nominal |
|
|
run_test Nominal |
|
|
nominal_status=$? |
|
|
nominal_status=$? |
|
|
|
|
|
echo Completed Nominal test |
|
|
|
|
|
echo |
|
|
|
|
|
|
|
|
# Stop timeout. |
|
|
# Stop timeout. |
|
|
|
|
|
echo Running Stop test |
|
|
run_test Stop |
|
|
run_test Stop |
|
|
stop_status=$? |
|
|
stop_status=$? |
|
|
|
|
|
echo Completed Stop test |
|
|
|
|
|
|
|
|
if [ $nominal_status == "0" -a \ |
|
|
if [ $nominal_status == "0" -a \ |
|
|
$stop_status == "0" ] |
|
|
$stop_status == "0" ] |