1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- if [ "$(uname --operating-system)" == "Msys" ]
- then
- CFLAGS='-I.. -Wall -std=c++11 -DWIN32 -pthread -DDEBUG_LOG_FILE="/c/serviceDebug.log"'
- else
- CFLAGS='-I.. -Wall -std=c++0x -g -O0 -pthread'
- fi
-
- progName=serviceProgram
-
- g++ $CFLAGS $progName.cpp ../CodeDweller/service.cpp -o $progName
- if [ $? -ne 0 ]
- then
- exit -1
- fi
-
- # Run test.
- logFileName=$progName.log
-
- rm -f $logFileName
-
- if [ "$(uname --operating-system)" == "Msys" ]
- then
- sc create "Test Service" binPath= "$(pwd)/$progName.exe"
-
- sc start "Test Service" "$(pwd)/$logFileName"
- sleep 1
-
- sc pause "Test Service" "$(pwd)/$logFileName"
- sleep 2
-
- sc continue "Test Service" "$(pwd)/$logFileName"
- sleep 2
-
- sc stop "Test Service"
- sleep 1
-
- sc delete "Test Service"
- else
- ./$progName $(pwd)/$logFileName
-
- PID=$(ps axl | grep -i $progName |grep -v grep | cut -d ' ' -f 4)
- sleep 1
-
- kill -TSTP $PID
- sleep 2
-
- kill -CONT $PID
- sleep 2
-
- kill -TERM $PID
- sleep 1
- fi
-
- if diff --strip-trailing-cr expected_$logFileName $logFileName > /dev/null 2>&1
- then
- echo CodeDweller::Service: ok
- else
- echo CodeDweller::Service: fail
- fi
|