• 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: runBinaryTest $TestBitStream
45runBinaryTest()
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  cd ${WorkingDir}
57  echo ""
58  echo " binary compare test, test bit stream is ${TestBitStream}"
59  echo ""
60  ${BinaryTestDir}/run_OneBitStream.sh  ${TestBitStream} ${TestType}
61  return $?
62}
63#usage:runMain  ${TestType}  ${TestBitStream}
64runMain()
65{
66  local TestType=$1
67  local TestBitStream=$2
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
75  if [ "${TestType}"  = "UnitTest"  ]
76  then
77    set -e
78    runUnitTest
79    return $?
80  fi
81  if [  "${TestType}"  = "BinaryCompare" ]
82  then
83    set -e
84    runBinaryTest ${TestBitStream} TravisTest
85    return $?
86  fi
87}
88TestType=$1
89TestBitStream=$2
90runMain  ${TestType}  ${TestBitStream}
91
92