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 | { |
Martin Storsjö | 5702e7c | 2015-01-16 14:00:13 +0200 | [diff] [blame] | 38 | CFLAGS=-Werror make -B ENABLE64BIT=Yes BUILDTYPE=Release all plugin test |
| 39 | CFLAGS=-Werror make -B ENABLE64BIT=Yes BUILDTYPE=Debug all plugin test |
| 40 | CFLAGS=-Werror make -B ENABLE64BIT=No BUILDTYPE=Release all plugin test |
| 41 | CFLAGS=-Werror make -B ENABLE64BIT=No BUILDTYPE=Debug all plugin test |
shihuade | c1a9bee | 2014-07-15 06:42:42 -0400 | [diff] [blame] | 42 | return $? |
| 43 | } |
| 44 | #usage: runPrepareAndBinaryTest $TestBitStream |
| 45 | runPrepareAndBinaryTest() |
| 46 | { |
huade | 944a041 | 2014-12-09 15:59:07 +0800 | [diff] [blame] | 47 | if [ ! $# -eq 2 ] |
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 |
huade | 944a041 | 2014-12-09 15:59:07 +0800 | [diff] [blame] | 53 | local TestType=$2 |
shihuade | c1a9bee | 2014-07-15 06:42:42 -0400 | [diff] [blame] | 54 | local WorkingDir=`pwd` |
| 55 | local BinaryTestDir="test/encoder_binary_comparison" |
| 56 | local TestSpacePrepareLog="AllTestSpacePrepare.log" |
| 57 | cd ${BinaryTestDir} |
| 58 | ./run_PrepareAllTestData.sh 64 2>${TestSpacePrepareLog} |
| 59 | cd ${WorkingDir} |
| 60 | echo "" |
| 61 | echo " binary compare test, test bit stream is ${TestBitStream}" |
| 62 | echo "" |
huade | 944a041 | 2014-12-09 15:59:07 +0800 | [diff] [blame] | 63 | ./test/encoder_binary_comparison/run_OneBitStream.sh ${TestBitStream} ${TestType} |
shihuade | c1a9bee | 2014-07-15 06:42:42 -0400 | [diff] [blame] | 64 | return $? |
| 65 | } |
| 66 | #usage:runMain ${TestType} ${TestBitStream} |
| 67 | runMain() |
| 68 | { |
shihuade | 7877134 | 2014-07-08 13:15:57 -0400 | [diff] [blame] | 69 | local TestType=$1 |
| 70 | local TestBitStream=$2 |
shihuade | c1a9bee | 2014-07-15 06:42:42 -0400 | [diff] [blame] | 71 | runInputParamCheck ${TestType} ${TestBitStream} |
| 72 | if [ ! $? -eq 0 ] |
| 73 | then |
| 74 | echo "usage: ./runTest.sh UnitTest \${PrepareFlag}" |
| 75 | echo " or ./runTest.sh BinaryCompare \${TestBitStreamName} \${PrepareFlag} " |
| 76 | exit 1 |
| 77 | fi |
shihuade | 7877134 | 2014-07-08 13:15:57 -0400 | [diff] [blame] | 78 | if [ "${TestType}" = "UnitTest" ] |
| 79 | then |
Martin Storsjö | db476ba | 2014-07-11 12:31:19 +0300 | [diff] [blame] | 80 | set -e |
shihuade | c1a9bee | 2014-07-15 06:42:42 -0400 | [diff] [blame] | 81 | runUnitTest |
| 82 | return $? |
shihuade | 7877134 | 2014-07-08 13:15:57 -0400 | [diff] [blame] | 83 | fi |
shihuade | c1a9bee | 2014-07-15 06:42:42 -0400 | [diff] [blame] | 84 | if [ "${TestType}" = "BinaryCompare" ] |
| 85 | then |
| 86 | set -e |
huade | 944a041 | 2014-12-09 15:59:07 +0800 | [diff] [blame] | 87 | runPrepareAndBinaryTest ${TestBitStream} TravisTest |
shihuade | c1a9bee | 2014-07-15 06:42:42 -0400 | [diff] [blame] | 88 | return $? |
| 89 | fi |
shihuade | 7877134 | 2014-07-08 13:15:57 -0400 | [diff] [blame] | 90 | } |
shihuade | 7877134 | 2014-07-08 13:15:57 -0400 | [diff] [blame] | 91 | TestType=$1 |
| 92 | TestBitStream=$2 |
shihuade | 7877134 | 2014-07-08 13:15:57 -0400 | [diff] [blame] | 93 | runMain ${TestType} ${TestBitStream} |
| 94 | |