1*598f4ceeSGarrett D'Amore#!/usr/bin/ksh 2*598f4ceeSGarrett D'Amore 3*598f4ceeSGarrett D'Amore# 4*598f4ceeSGarrett D'Amore# This file and its contents are supplied under the terms of the 5*598f4ceeSGarrett D'Amore# Common Development and Distribution License ("CDDL"), version 1.0. 6*598f4ceeSGarrett D'Amore# You may only use this file in accordance with the terms of version 7*598f4ceeSGarrett D'Amore# 1.0 of the CDDL. 8*598f4ceeSGarrett D'Amore# 9*598f4ceeSGarrett D'Amore# A full copy of the text of the CDDL should have accompanied this 10*598f4ceeSGarrett D'Amore# source. A copy of the CDDL is also available via the Internet at 11*598f4ceeSGarrett D'Amore# http://www.illumos.org/license/CDDL. 12*598f4ceeSGarrett D'Amore# 13*598f4ceeSGarrett D'Amore 14*598f4ceeSGarrett D'Amore# 15*598f4ceeSGarrett D'Amore# Copyright (c) 2012 by Delphix. All rights reserved. 16*598f4ceeSGarrett D'Amore# Copyright 2014, OmniTI Computer Consulting, Inc. All rights reserved. 17*598f4ceeSGarrett D'Amore# Copyright 2014 Garrett D'Amore <garrett@damore.org> 18*598f4ceeSGarrett D'Amore# 19*598f4ceeSGarrett D'Amore 20*598f4ceeSGarrett D'Amoreexport MY_TESTS="/opt/util-tests" 21*598f4ceeSGarrett D'Amorerunner="/opt/test-runner/bin/run" 22*598f4ceeSGarrett D'Amore 23*598f4ceeSGarrett D'Amorefunction fail 24*598f4ceeSGarrett D'Amore{ 25*598f4ceeSGarrett D'Amore echo $1 26*598f4ceeSGarrett D'Amore exit ${2:-1} 27*598f4ceeSGarrett D'Amore} 28*598f4ceeSGarrett D'Amore 29*598f4ceeSGarrett D'Amorefunction find_runfile 30*598f4ceeSGarrett D'Amore{ 31*598f4ceeSGarrett D'Amore typeset distro= 32*598f4ceeSGarrett D'Amore if [[ -d /opt/delphix && -h /etc/delphix/version ]]; then 33*598f4ceeSGarrett D'Amore distro=delphix 34*598f4ceeSGarrett D'Amore elif [[ 0 -ne $(grep -c OpenIndiana /etc/release 2>/dev/null) ]]; then 35*598f4ceeSGarrett D'Amore distro=openindiana 36*598f4ceeSGarrett D'Amore elif [[ 0 -ne $(grep -c OmniOS /etc/release 2>/dev/null) ]]; then 37*598f4ceeSGarrett D'Amore distro=omnios 38*598f4ceeSGarrett D'Amore elif [[ -f $MY_TESTS/runfiles/default.run ]]; then 39*598f4ceeSGarrett D'Amore # optional catch-all 40*598f4ceeSGarrett D'Amore distro=default 41*598f4ceeSGarrett D'Amore fi 42*598f4ceeSGarrett D'Amore 43*598f4ceeSGarrett D'Amore [[ -n $distro ]] && echo $MY_TESTS/runfiles/$distro.run 44*598f4ceeSGarrett D'Amore} 45*598f4ceeSGarrett D'Amore 46*598f4ceeSGarrett D'Amorewhile getopts c: c; do 47*598f4ceeSGarrett D'Amore case $c in 48*598f4ceeSGarrett D'Amore 'c') 49*598f4ceeSGarrett D'Amore runfile=$OPTARG 50*598f4ceeSGarrett D'Amore [[ -f $runfile ]] || fail "Cannot read file: $runfile" 51*598f4ceeSGarrett D'Amore ;; 52*598f4ceeSGarrett D'Amore esac 53*598f4ceeSGarrett D'Amoredone 54*598f4ceeSGarrett D'Amoreshift $((OPTIND - 1)) 55*598f4ceeSGarrett D'Amore 56*598f4ceeSGarrett D'Amore[[ -z $runfile ]] && runfile=$(find_runfile) 57*598f4ceeSGarrett D'Amore[[ -z $runfile ]] && fail "Couldn't determine distro" 58*598f4ceeSGarrett D'Amore 59*598f4ceeSGarrett D'Amore$runner -c $runfile 60*598f4ceeSGarrett D'Amore 61*598f4ceeSGarrett D'Amoreexit $? 62