1f08c3bdfSopenharmony_ci#!/bin/bash 2f08c3bdfSopenharmony_ci 3f08c3bdfSopenharmony_ci# 4f08c3bdfSopenharmony_ci# Copyright (c) International Business Machines Corp., 2009 5f08c3bdfSopenharmony_ci# Author: Matt Helsley <matthltc@us.ibm.com> 6f08c3bdfSopenharmony_ci# 7f08c3bdfSopenharmony_ci# This library is free software; you can redistribute it and/or 8f08c3bdfSopenharmony_ci# modify it under the terms of the GNU Lesser General Public 9f08c3bdfSopenharmony_ci# License as published by the Free Software Foundation; either 10f08c3bdfSopenharmony_ci# version 2.1 of the License, or (at your option) any later version. 11f08c3bdfSopenharmony_ci# 12f08c3bdfSopenharmony_ci# This library is distributed in the hope that it will be useful, 13f08c3bdfSopenharmony_ci# but WITHOUT ANY WARRANTY; without even the implied warranty of 14f08c3bdfSopenharmony_ci# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15f08c3bdfSopenharmony_ci# Lesser General Public License for more details. 16f08c3bdfSopenharmony_ci# 17f08c3bdfSopenharmony_ci# You should have received a copy of the GNU Lesser General Public 18f08c3bdfSopenharmony_ci# License along with this library; if not, write to the Free Software 19f08c3bdfSopenharmony_ci# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20f08c3bdfSopenharmony_ci# 21f08c3bdfSopenharmony_ci 22f08c3bdfSopenharmony_ci### 23f08c3bdfSopenharmony_ci### LTP framework shim 24f08c3bdfSopenharmony_ci### 25f08c3bdfSopenharmony_ciexport npassed=0 26f08c3bdfSopenharmony_ciexport nfailed=0 27f08c3bdfSopenharmony_ci 28f08c3bdfSopenharmony_cifunction tst_func () 29f08c3bdfSopenharmony_ci{ 30f08c3bdfSopenharmony_ci local out_fd=1 31f08c3bdfSopenharmony_ci local tag="<no tag>" 32f08c3bdfSopenharmony_ci local cmd="<no cmd>" 33f08c3bdfSopenharmony_ci local msg="<no msg>" 34f08c3bdfSopenharmony_ci 35f08c3bdfSopenharmony_ci if [ $# -gt 0 ]; then 36f08c3bdfSopenharmony_ci cmd="$1" 37f08c3bdfSopenharmony_ci shift 38f08c3bdfSopenharmony_ci fi 39f08c3bdfSopenharmony_ci if [ $# -gt 0 ]; then 40f08c3bdfSopenharmony_ci tag="$1" 41f08c3bdfSopenharmony_ci shift 42f08c3bdfSopenharmony_ci fi 43f08c3bdfSopenharmony_ci if [ $# -gt 0 ]; then 44f08c3bdfSopenharmony_ci msg="$*" 45f08c3bdfSopenharmony_ci fi 46f08c3bdfSopenharmony_ci 47f08c3bdfSopenharmony_ci case "$cmd" in 48f08c3bdfSopenharmony_ci tst_resm|tst_brkm|tst_exit) ;; 49f08c3bdfSopenharmony_ci *) 50f08c3bdfSopenharmony_ci out_fd=2 51f08c3bdfSopenharmony_ci msg="(LTP log violation: Uknown LTP cmd: $cmd) $msg" 52f08c3bdfSopenharmony_ci ;; 53f08c3bdfSopenharmony_ci esac 54f08c3bdfSopenharmony_ci 55f08c3bdfSopenharmony_ci case "$tag" in 56f08c3bdfSopenharmony_ci TINFO) 57f08c3bdfSopenharmony_ci ;; 58f08c3bdfSopenharmony_ci TPASS) 59f08c3bdfSopenharmony_ci ((npassed++)) 60f08c3bdfSopenharmony_ci ;; 61f08c3bdfSopenharmony_ci TWARN) 62f08c3bdfSopenharmony_ci out_fd=2 63f08c3bdfSopenharmony_ci ;; 64f08c3bdfSopenharmony_ci TBROK) 65f08c3bdfSopenharmony_ci out_fd=2 66f08c3bdfSopenharmony_ci ;; 67f08c3bdfSopenharmony_ci TFAIL) 68f08c3bdfSopenharmony_ci ((nfailed++)) 69f08c3bdfSopenharmony_ci ;; 70f08c3bdfSopenharmony_ci *) 71f08c3bdfSopenharmony_ci out_fd=2 72f08c3bdfSopenharmony_ci msg="(LTP log violation: Uknown LTP log tag: $tag) $msg" 73f08c3bdfSopenharmony_ci ;; 74f08c3bdfSopenharmony_ci esac 75f08c3bdfSopenharmony_ci 76f08c3bdfSopenharmony_ci #echo "LTP log: $cmd ${TCID} ${TST_COUNT}/${TST_TOTAL}: $tag $msg" 1>&$out_fd 77f08c3bdfSopenharmony_ci echo "${TCID} ${TST_COUNT}/${TST_TOTAL}: $tag $msg" 1>&$out_fd 78f08c3bdfSopenharmony_ci} 79f08c3bdfSopenharmony_ci 80f08c3bdfSopenharmony_cifunction tst_resm () 81f08c3bdfSopenharmony_ci{ 82f08c3bdfSopenharmony_ci tst_func "tst_resm" "$@" 83f08c3bdfSopenharmony_ci} 84f08c3bdfSopenharmony_ci 85f08c3bdfSopenharmony_cifunction tst_brkm () 86f08c3bdfSopenharmony_ci{ 87f08c3bdfSopenharmony_ci tst_func "tst_brkm" "$@" 88f08c3bdfSopenharmony_ci} 89f08c3bdfSopenharmony_ci 90f08c3bdfSopenharmony_cifunction tst_exit () 91f08c3bdfSopenharmony_ci{ 92f08c3bdfSopenharmony_ci tst_func "tst_exit" "$@" 93f08c3bdfSopenharmony_ci if ((nfailed > 0)); then 94f08c3bdfSopenharmony_ci exit 1 95f08c3bdfSopenharmony_ci else 96f08c3bdfSopenharmony_ci exit 0 97f08c3bdfSopenharmony_ci fi 98f08c3bdfSopenharmony_ci} 99f08c3bdfSopenharmony_ci 100f08c3bdfSopenharmony_ciexport -f tst_func tst_resm tst_brkm tst_exit 101f08c3bdfSopenharmony_ciexport TCID TST_COUNT TST_TOTAL 102