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 | } |
Martin Storsjö | 0a4cdde | 2022-05-31 11:24:59 +0300 | [diff] [blame] | 44 | #usage: runBinaryTest $TestBitStream |
| 45 | runBinaryTest() |
shihuade | c1a9bee | 2014-07-15 06:42:42 -0400 | [diff] [blame] | 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" |
shihuade | c1a9bee | 2014-07-15 06:42:42 -0400 | [diff] [blame] | 56 | cd ${WorkingDir} |
| 57 | echo "" |
| 58 | echo " binary compare test, test bit stream is ${TestBitStream}" |
| 59 | echo "" |
Martin Storsjö | 0a4cdde | 2022-05-31 11:24:59 +0300 | [diff] [blame] | 60 | ${BinaryTestDir}/run_OneBitStream.sh ${TestBitStream} ${TestType} |
shihuade | c1a9bee | 2014-07-15 06:42:42 -0400 | [diff] [blame] | 61 | return $? |
| 62 | } |
| 63 | #usage:runMain ${TestType} ${TestBitStream} |
| 64 | runMain() |
| 65 | { |
shihuade | 7877134 | 2014-07-08 13:15:57 -0400 | [diff] [blame] | 66 | local TestType=$1 |
| 67 | local TestBitStream=$2 |
shihuade | c1a9bee | 2014-07-15 06:42:42 -0400 | [diff] [blame] | 68 | runInputParamCheck ${TestType} ${TestBitStream} |
| 69 | if [ ! $? -eq 0 ] |
| 70 | then |
| 71 | echo "usage: ./runTest.sh UnitTest \${PrepareFlag}" |
| 72 | echo " or ./runTest.sh BinaryCompare \${TestBitStreamName} \${PrepareFlag} " |
| 73 | exit 1 |
| 74 | fi |
shihuade | 7877134 | 2014-07-08 13:15:57 -0400 | [diff] [blame] | 75 | if [ "${TestType}" = "UnitTest" ] |
| 76 | then |
Martin Storsjö | db476ba | 2014-07-11 12:31:19 +0300 | [diff] [blame] | 77 | set -e |
shihuade | c1a9bee | 2014-07-15 06:42:42 -0400 | [diff] [blame] | 78 | runUnitTest |
| 79 | return $? |
shihuade | 7877134 | 2014-07-08 13:15:57 -0400 | [diff] [blame] | 80 | fi |
shihuade | c1a9bee | 2014-07-15 06:42:42 -0400 | [diff] [blame] | 81 | if [ "${TestType}" = "BinaryCompare" ] |
| 82 | then |
| 83 | set -e |
Martin Storsjö | 0a4cdde | 2022-05-31 11:24:59 +0300 | [diff] [blame] | 84 | runBinaryTest ${TestBitStream} TravisTest |
shihuade | c1a9bee | 2014-07-15 06:42:42 -0400 | [diff] [blame] | 85 | return $? |
| 86 | fi |
shihuade | 7877134 | 2014-07-08 13:15:57 -0400 | [diff] [blame] | 87 | } |
shihuade | 7877134 | 2014-07-08 13:15:57 -0400 | [diff] [blame] | 88 | TestType=$1 |
| 89 | TestBitStream=$2 |
shihuade | 7877134 | 2014-07-08 13:15:57 -0400 | [diff] [blame] | 90 | runMain ${TestType} ${TestBitStream} |
| 91 | |