Browse Source

Modify to run under Windows also.

git-svn-id: https://svn.microneil.com/svn/CodeDweller-Tests/trunk@23 b3372362-9eaa-4a85-aa2b-6faa1ab7c995
master
adeniz 10 years ago
parent
commit
353aa42407
1 changed files with 37 additions and 16 deletions
  1. 37
    16
      TestService/buildAndRun

+ 37
- 16
TestService/buildAndRun View File

@@ -1,38 +1,59 @@
if [ "$(uname --operating-system)" == "Msys" ]
then
CFLAGS='-I.. -std=c++11 -g -O0 -DWIN32 -pthread'
CFLAGS='-I.. -Wall -std=c++11 -DWIN32 -pthread -DDEBUG_LOG_FILE="/c/serviceDebug.log"'
else
CFLAGS='-I.. -std=c++0x -g -O0 -pthread'
CFLAGS='-I.. -Wall -std=c++0x -g -O0 -pthread'
fi

g++ $CFLAGS serviceProgram.cpp ../CodeDweller/service.cpp -o serviceProgram
progName=serviceProgram

g++ $CFLAGS $progName.cpp ../CodeDweller/service.cpp -o $progName
if [ $? -ne 0 ]
then
exit -1
exit -1
fi

# Run test.
logFileName=serviceProgram.log
logFileName=$progName.log

rm -f $logFileName

./serviceProgram $(pwd)/$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

PID=$(ps axl | grep -i serviceProgram |grep -v grep | cut -d ' ' -f 4)
sleep 1
sc continue "Test Service" "$(pwd)/$logFileName"
sleep 2

kill -TSTP $PID
sleep 2
sc stop "Test Service"
sleep 1

kill -CONT $PID
sleep 2
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 -TERM $PID
sleep 1
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 under Linux: ok
echo CodeDweller::Service: ok
else
echo CodeDweller::Service under Linux: fail
echo CodeDweller::Service: fail
fi

Loading…
Cancel
Save