1*ce8560eeSMatt Barden#!/usr/bin/ksh 2*ce8560eeSMatt Barden 3*ce8560eeSMatt Barden# 4*ce8560eeSMatt Barden# This file and its contents are supplied under the terms of the 5*ce8560eeSMatt Barden# Common Development and Distribution License ("CDDL"), version 1.0. 6*ce8560eeSMatt Barden# You may only use this file in accordance with the terms of version 7*ce8560eeSMatt Barden# 1.0 of the CDDL. 8*ce8560eeSMatt Barden# 9*ce8560eeSMatt Barden# A full copy of the text of the CDDL should have accompanied this 10*ce8560eeSMatt Barden# source. A copy of the CDDL is also available via the Internet at 11*ce8560eeSMatt Barden# http://www.illumos.org/license/CDDL. 12*ce8560eeSMatt Barden# 13*ce8560eeSMatt Barden 14*ce8560eeSMatt Barden# 15*ce8560eeSMatt Barden# Copyright (c) 2012 by Delphix. All rights reserved. 16*ce8560eeSMatt Barden# Copyright 2020 Tintri by DDN, Inc. All rights reserved. 17*ce8560eeSMatt Barden# 18*ce8560eeSMatt Barden 19*ce8560eeSMatt Bardenexport MLRPC_TESTS="/opt/libmlrpc-tests" 20*ce8560eeSMatt Bardenrunner="/opt/test-runner/bin/run" 21*ce8560eeSMatt Barden 22*ce8560eeSMatt Bardenfunction fail 23*ce8560eeSMatt Barden{ 24*ce8560eeSMatt Barden echo $1 25*ce8560eeSMatt Barden exit ${2:-1} 26*ce8560eeSMatt Barden} 27*ce8560eeSMatt Barden 28*ce8560eeSMatt Bardenfunction find_runfile 29*ce8560eeSMatt Barden{ 30*ce8560eeSMatt Barden typeset distro= 31*ce8560eeSMatt Barden if [[ -f $MLRPC_TESTS/runfiles/default.run ]]; then 32*ce8560eeSMatt Barden distro=default 33*ce8560eeSMatt Barden fi 34*ce8560eeSMatt Barden 35*ce8560eeSMatt Barden [[ -n $distro ]] && echo $MLRPC_TESTS/runfiles/$distro.run 36*ce8560eeSMatt Barden} 37*ce8560eeSMatt Barden 38*ce8560eeSMatt Bardenwhile getopts c: c; do 39*ce8560eeSMatt Barden case $c in 40*ce8560eeSMatt Barden 'c') 41*ce8560eeSMatt Barden runfile=$OPTARG 42*ce8560eeSMatt Barden [[ -f $runfile ]] || fail "Cannot read file: $runfile" 43*ce8560eeSMatt Barden ;; 44*ce8560eeSMatt Barden esac 45*ce8560eeSMatt Bardendone 46*ce8560eeSMatt Bardenshift $((OPTIND - 1)) 47*ce8560eeSMatt Barden 48*ce8560eeSMatt Barden[[ -z $runfile ]] && runfile=$(find_runfile) 49*ce8560eeSMatt Barden[[ -z $runfile ]] && fail "Couldn't determine distro" 50*ce8560eeSMatt Barden 51*ce8560eeSMatt Barden$runner -c $runfile 52*ce8560eeSMatt Barden 53*ce8560eeSMatt Bardenexit $? 54