de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore#!/usr/bin/ksh
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore#
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore#
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore# This file and its contents are supplied under the terms of the
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore# Common Development and Distribution License ("CDDL"), version 1.0.
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore# You may only use this file in accordance with the terms of version
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore# 1.0 of the CDDL.
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore#
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore# A full copy of the text of the CDDL should have accompanied this
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore# source. A copy of the CDDL is also available via the Internet at
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore# http://www.illumos.org/license/CDDL.
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore#
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore#
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore# Copyright 2014 Garrett D'Amore <garrett@damore.org>
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore#
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amoreexport STF_SUITE=/opt/libc-tests
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore# First we set $dir to dirname $0, using efficient ksh builtins.
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amorecase $0 in
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore*/*)
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore dir=${0%/*}
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore prog=${0##*/}
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore ;;
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore*)
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore dir=.
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore prog=${0}
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore ;;
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amoreesac
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amorecfg=symbols/${prog%.ksh}.cfg
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amoreif [[ ! -f ${cfg} && $cfg == symbols/setup.cfg ]]
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amorethen
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore # compiler check only
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore cfg=-C
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amorefi
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amoreprog=symbols_test
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amorefor a in $*
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amoredo
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore if [[ $a == "-d" ]]
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore then
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore debug=yes
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore fi
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amoredone
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore# We look for architecture specific versions of the program,
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore# searching in several candidate directories. We run each one as
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore# we find it.
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amorefor f in $(/usr/bin/isainfo)
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amoredo
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore found=
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore [[ -n $debug ]] && print "Checking for arch $f:"
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore for p in \
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore ${dir}/${prog}.${f} \
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore ${dir}/${f}/${prog}.${f} \
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore ${dir}/${f}/${prog}
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore do
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore [[ -n $found ]] && continue
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore [[ -n $debug ]] && print -n " $p"
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore if [[ -f $p ]]; then
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore [[ -n $debug ]] && print " FOUND"
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore [[ -n $debug ]] && print "Executing $p $* ${cfg}"
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore found=yes
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore $p $* ${cfg} || exit 1
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore else
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore [[ -n $debug ]] && print
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore fi
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore done
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amore [[ -z $found ]] && [[ -n $debug ]] && print "NOT PRESENT"
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amoredone
de572d98af8238405c5d1292a788b1a85b0c68ebGarrett D'Amoreexit 0