• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
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}
21runInputParamCheck()
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
33  return ${ParameterFlag}
34}
35#usage: runUnitTest
36runUnitTest()
37{
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
42  return $?
43}
44#usage: runPrepareAndBinaryTest $TestBitStream
45runPrepareAndBinaryTest()
46{
47  if [ ! $# -eq 2  ]
48  then
49    echo "usage: runPrepareAndBinaryTest  \$TestBitStream"
50    exit 1
51  fi
52  local TestBitStream=$1
53  local TestType=$2
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 ""
63./test/encoder_binary_comparison/run_OneBitStream.sh  ${TestBitStream} ${TestType}
64  return $?
65}
66#usage:runMain  ${TestType}  ${TestBitStream}
67runMain()
68{
69  local TestType=$1
70  local TestBitStream=$2
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
78  if [ "${TestType}"  = "UnitTest"  ]
79  then
80    set -e
81    runUnitTest
82    return $?
83  fi
84  if [  "${TestType}"  = "BinaryCompare" ]
85  then
86    set -e
87    runPrepareAndBinaryTest ${TestBitStream} TravisTest
88    return $?
89  fi
90}
91TestType=$1
92TestBitStream=$2
93runMain  ${TestType}  ${TestBitStream}
94
95