1f08c3bdfSopenharmony_ci#!/bin/bash
2f08c3bdfSopenharmony_ci#
3f08c3bdfSopenharmony_ci# Run mce test cases in a loop. It exits on failure of any one of the test cases.
4f08c3bdfSopenharmony_ci# This script is using simple test driver.
5f08c3bdfSopenharmony_ci#
6f08c3bdfSopenharmony_ci#   Authors: Dean Nelson <dnelson@redhat.com>
7f08c3bdfSopenharmony_ci#           iZheng Jiajia <jiajia.zheng@intel.com>
8f08c3bdfSopenharmony_ci# This file is released under the GPLv2.
9f08c3bdfSopenharmony_ci#
10f08c3bdfSopenharmony_ci# Usage:
11f08c3bdfSopenharmony_ci#Run as root and invoke this test tool on test configure file. 
12f08c3bdfSopenharmony_ci#For example, ./loop-mce-test simple_ser.conf
13f08c3bdfSopenharmony_ci#Note that only simple test configure file is used and full path is not needed here.
14f08c3bdfSopenharmony_ci
15f08c3bdfSopenharmony_cisd=$(dirname "$0")
16f08c3bdfSopenharmony_ciexport ROOT=`(cd $sd/..; pwd)`
17f08c3bdfSopenharmony_ciprog=$(basename "$0")
18f08c3bdfSopenharmony_ci
19f08c3bdfSopenharmony_ciusage()
20f08c3bdfSopenharmony_ci{
21f08c3bdfSopenharmony_ci    echo "$prog <config>"
22f08c3bdfSopenharmony_ci    exit 1
23f08c3bdfSopenharmony_ci}
24f08c3bdfSopenharmony_ci
25f08c3bdfSopenharmony_ci. $ROOT/lib/functions.sh
26f08c3bdfSopenharmony_ci
27f08c3bdfSopenharmony_ci[ $# -eq 1 ] || usage
28f08c3bdfSopenharmony_ciconfig=$(basename "$1")
29f08c3bdfSopenharmony_ci[ -f $ROOT/config/$config ] || usage
30f08c3bdfSopenharmony_ci
31f08c3bdfSopenharmony_cii=0
32f08c3bdfSopenharmony_ciwhile true ; do
33f08c3bdfSopenharmony_ci	((i=i+1))
34f08c3bdfSopenharmony_ci	echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!! loop $i"
35f08c3bdfSopenharmony_ci	rm $ROOT/results/simple/result
36f08c3bdfSopenharmony_ci
37f08c3bdfSopenharmony_ci	sh $ROOT/drivers/simple/driver.sh $ROOT/config/$1
38f08c3bdfSopenharmony_ci
39f08c3bdfSopenharmony_ci	sed -e'/gcov/d' $ROOT/results/simple/result | grep "Fail" > /dev/null
40f08c3bdfSopenharmony_ci	if [ $? = 0 ] ; then
41f08c3bdfSopenharmony_ci		echo "failed on loop $i"
42f08c3bdfSopenharmony_ci		exit 1
43f08c3bdfSopenharmony_ci	fi
44f08c3bdfSopenharmony_cidone
45f08c3bdfSopenharmony_ci
46