2014-07-08 19:15:57 +02:00
|
|
|
#!/bin/bash
|
2014-07-15 12:42:42 +02:00
|
|
|
#**********************************************************************************
|
|
|
|
# This script is for test on travis.Currently there are 5 jobs running on
|
|
|
|
# travis in parallel status which are listed as below:
|
|
|
|
# 1.Unit test with gcc compiler;
|
|
|
|
# 2.Unit test with clang compiler;
|
|
|
|
# 3.Binary comparison test for test bit stream A;
|
|
|
|
# 4.Binary comparison test for test bit stream B;
|
|
|
|
# 5.Binary comparison test for test bit stream C.
|
|
|
|
# For binary comparison test,before running all test cases, it need to prepare
|
|
|
|
# the test space.On travis,as those parallel jobs are running on different VMs,
|
|
|
|
# so each job need to prepare for its test space for itself.
|
|
|
|
#
|
|
|
|
# --usage:
|
|
|
|
# ./runTest.sh UnitTest
|
|
|
|
# or ./runTest.sh BinaryCompare ${TestBitStreamName}
|
|
|
|
#
|
|
|
|
# date: 10/06/2014 Created
|
|
|
|
#**********************************************************************************
|
|
|
|
#usage: runInputParamCheck ${TestType} ${TestBitStream}
|
|
|
|
runInputParamCheck()
|
2014-07-08 19:15:57 +02:00
|
|
|
{
|
|
|
|
local ParameterFlag=""
|
|
|
|
if [ $# -eq 1 -a "$1" = "UnitTest" ]
|
|
|
|
then
|
|
|
|
let "ParameterFlag=0"
|
|
|
|
elif [ $# -eq 2 -a "$1" = "BinaryCompare" ]
|
|
|
|
then
|
|
|
|
let "ParameterFlag=0"
|
|
|
|
else
|
|
|
|
let "ParameterFlag=1"
|
|
|
|
fi
|
2014-07-15 12:42:42 +02:00
|
|
|
return ${ParameterFlag}
|
|
|
|
}
|
|
|
|
#usage: runUnitTest
|
|
|
|
runUnitTest()
|
|
|
|
{
|
2015-01-16 13:00:13 +01:00
|
|
|
CFLAGS=-Werror make -B ENABLE64BIT=Yes BUILDTYPE=Release all plugin test
|
|
|
|
CFLAGS=-Werror make -B ENABLE64BIT=Yes BUILDTYPE=Debug all plugin test
|
|
|
|
CFLAGS=-Werror make -B ENABLE64BIT=No BUILDTYPE=Release all plugin test
|
|
|
|
CFLAGS=-Werror make -B ENABLE64BIT=No BUILDTYPE=Debug all plugin test
|
2014-07-15 12:42:42 +02:00
|
|
|
return $?
|
|
|
|
}
|
|
|
|
#usage: runPrepareAndBinaryTest $TestBitStream
|
|
|
|
runPrepareAndBinaryTest()
|
|
|
|
{
|
2014-12-09 08:59:07 +01:00
|
|
|
if [ ! $# -eq 2 ]
|
2014-07-08 19:15:57 +02:00
|
|
|
then
|
2014-07-15 12:42:42 +02:00
|
|
|
echo "usage: runPrepareAndBinaryTest \$TestBitStream"
|
2014-07-08 19:15:57 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
2014-07-15 12:42:42 +02:00
|
|
|
local TestBitStream=$1
|
2014-12-09 08:59:07 +01:00
|
|
|
local TestType=$2
|
2014-07-15 12:42:42 +02:00
|
|
|
local WorkingDir=`pwd`
|
|
|
|
local BinaryTestDir="test/encoder_binary_comparison"
|
|
|
|
local TestSpacePrepareLog="AllTestSpacePrepare.log"
|
|
|
|
cd ${BinaryTestDir}
|
|
|
|
./run_PrepareAllTestData.sh 64 2>${TestSpacePrepareLog}
|
|
|
|
cd ${WorkingDir}
|
|
|
|
echo ""
|
|
|
|
echo " binary compare test, test bit stream is ${TestBitStream}"
|
|
|
|
echo ""
|
2014-12-09 08:59:07 +01:00
|
|
|
./test/encoder_binary_comparison/run_OneBitStream.sh ${TestBitStream} ${TestType}
|
2014-07-15 12:42:42 +02:00
|
|
|
return $?
|
|
|
|
}
|
|
|
|
#usage:runMain ${TestType} ${TestBitStream}
|
|
|
|
runMain()
|
|
|
|
{
|
2014-07-08 19:15:57 +02:00
|
|
|
local TestType=$1
|
|
|
|
local TestBitStream=$2
|
2014-07-15 12:42:42 +02:00
|
|
|
runInputParamCheck ${TestType} ${TestBitStream}
|
|
|
|
if [ ! $? -eq 0 ]
|
|
|
|
then
|
|
|
|
echo "usage: ./runTest.sh UnitTest \${PrepareFlag}"
|
|
|
|
echo " or ./runTest.sh BinaryCompare \${TestBitStreamName} \${PrepareFlag} "
|
|
|
|
exit 1
|
|
|
|
fi
|
2014-07-08 19:15:57 +02:00
|
|
|
if [ "${TestType}" = "UnitTest" ]
|
|
|
|
then
|
2014-07-11 11:31:19 +02:00
|
|
|
set -e
|
2014-07-15 12:42:42 +02:00
|
|
|
runUnitTest
|
|
|
|
return $?
|
|
|
|
fi
|
|
|
|
if [ "${TestType}" = "BinaryCompare" ]
|
2014-07-08 19:15:57 +02:00
|
|
|
then
|
2014-07-15 12:42:42 +02:00
|
|
|
set -e
|
2014-12-09 08:59:07 +01:00
|
|
|
runPrepareAndBinaryTest ${TestBitStream} TravisTest
|
2014-07-15 12:42:42 +02:00
|
|
|
return $?
|
2014-07-08 19:15:57 +02:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
TestType=$1
|
|
|
|
TestBitStream=$2
|
|
|
|
runMain ${TestType} ${TestBitStream}
|
|
|
|
|