shihuade | 7877134 | 2014-07-08 13:15:57 -0400 | [diff] [blame] | 1 | #!/bin/bash |
shihuade | c1a9bee | 2014-07-15 06:42:42 -0400 | [diff] [blame] | 2 | #********************************************************************************** |
| 3 | # This script is for test on travis.Currently there are 5 jobs running on |
| 4 | # travis in parallel status which are listed as below: |
| 5 | # 1.Unit test with gcc compiler; |
| 6 | # 2.Unit test with clang compiler; |
| 7 | # 3.Binary comparison test for test bit stream A; |
| 8 | # 4.Binary comparison test for test bit stream B; |
| 9 | # 5.Binary comparison test for test bit stream C. |
| 10 | # For binary comparison test,before running all test cases, it need to prepare |
| 11 | # the test space.On travis,as those parallel jobs are running on different VMs, |
| 12 | # so each job need to prepare for its test space for itself. |
| 13 | # |
| 14 | # --usage: |
| 15 | # ./runTest.sh UnitTest |
| 16 | # or ./runTest.sh BinaryCompare ${TestBitStreamName} |
| 17 | # |
| 18 | # date: 10/06/2014 Created |
| 19 | #********************************************************************************** |
| 20 | #usage: runInputParamCheck ${TestType} ${TestBitStream} |
| 21 | runInputParamCheck() |
shihuade | 7877134 | 2014-07-08 13:15:57 -0400 | [diff] [blame] | 22 | { |
| 23 | local ParameterFlag="" |
| 24 | if [ $# -eq 1 -a "$1" = "UnitTest" ] |
| 25 | then |
| 26 | let "ParameterFlag=0" |
| 27 | elif [ $# -eq 2 -a "$1" = "BinaryCompare" ] |
| 28 | then |
| 29 | let "ParameterFlag=0" |
| 30 | else |
| 31 | let "ParameterFlag=1" |
| 32 | fi |
shihuade | c1a9bee | 2014-07-15 06:42:42 -0400 | [diff] [blame] | 33 | return ${ParameterFlag} |
| 34 | } |
| 35 | #usage: runUnitTest |
| 36 | runUnitTest() |
| 37 | { |
| 38 | make -B ENABLE64BIT=Yes BUILDTYPE=Release all plugin test |
| 39 | make -B ENABLE64BIT=Yes BUILDTYPE=Debug all plugin test |
| 40 | make -B ENABLE64BIT=No BUILDTYPE=Release all plugin test |
| 41 | make -B ENABLE64BIT=No BUILDTYPE=Debug all plugin test |
| 42 | return $? |
| 43 | } |
| 44 | #usage: runPrepareAndBinaryTest $TestBitStream |
| 45 | runPrepareAndBinaryTest() |
| 46 | { |
| 47 | if [ ! $# -eq 1 ] |
shihuade | 7877134 | 2014-07-08 13:15:57 -0400 | [diff] [blame] | 48 | then |
shihuade | c1a9bee | 2014-07-15 06:42:42 -0400 | [diff] [blame] | 49 | echo "usage: runPrepareAndBinaryTest \$TestBitStream" |
shihuade | 7877134 | 2014-07-08 13:15:57 -0400 | [diff] [blame] | 50 | exit 1 |
| 51 | fi |
shihuade | c1a9bee | 2014-07-15 06:42:42 -0400 | [diff] [blame] | 52 | local TestBitStream=$1 |
| 53 | local WorkingDir=`pwd` |
| 54 | local BinaryTestDir="test/encoder_binary_comparison" |
| 55 | local TestSpacePrepareLog="AllTestSpacePrepare.log" |
| 56 | cd ${BinaryTestDir} |
| 57 | ./run_PrepareAllTestData.sh 64 2>${TestSpacePrepareLog} |
| 58 | cd ${WorkingDir} |
| 59 | echo "" |
| 60 | echo " binary compare test, test bit stream is ${TestBitStream}" |
| 61 | echo "" |
| 62 | ./test/encoder_binary_comparison/run_OneBitStream.sh ${TestBitStream} |
| 63 | return $? |
| 64 | } |
| 65 | #usage:runMain ${TestType} ${TestBitStream} |
| 66 | runMain() |
| 67 | { |
shihuade | 7877134 | 2014-07-08 13:15:57 -0400 | [diff] [blame] | 68 | local TestType=$1 |
| 69 | local TestBitStream=$2 |
shihuade | c1a9bee | 2014-07-15 06:42:42 -0400 | [diff] [blame] | 70 | runInputParamCheck ${TestType} ${TestBitStream} |
| 71 | if [ ! $? -eq 0 ] |
| 72 | then |
| 73 | echo "usage: ./runTest.sh UnitTest \${PrepareFlag}" |
| 74 | echo " or ./runTest.sh BinaryCompare \${TestBitStreamName} \${PrepareFlag} " |
| 75 | exit 1 |
| 76 | fi |
shihuade | 7877134 | 2014-07-08 13:15:57 -0400 | [diff] [blame] | 77 | if [ "${TestType}" = "UnitTest" ] |
| 78 | then |
Martin Storsjö | db476ba | 2014-07-11 12:31:19 +0300 | [diff] [blame] | 79 | set -e |
shihuade | c1a9bee | 2014-07-15 06:42:42 -0400 | [diff] [blame] | 80 | runUnitTest |
| 81 | return $? |
shihuade | 7877134 | 2014-07-08 13:15:57 -0400 | [diff] [blame] | 82 | fi |
shihuade | c1a9bee | 2014-07-15 06:42:42 -0400 | [diff] [blame] | 83 | if [ "${TestType}" = "BinaryCompare" ] |
| 84 | then |
| 85 | set -e |
| 86 | runPrepareAndBinaryTest ${TestBitStream} |
| 87 | return $? |
| 88 | fi |
shihuade | 7877134 | 2014-07-08 13:15:57 -0400 | [diff] [blame] | 89 | } |
shihuade | 7877134 | 2014-07-08 13:15:57 -0400 | [diff] [blame] | 90 | TestType=$1 |
| 91 | TestBitStream=$2 |
shihuade | 7877134 | 2014-07-08 13:15:57 -0400 | [diff] [blame] | 92 | runMain ${TestType} ${TestBitStream} |
| 93 | |