8699 Want NIC transceiver visibility
[unleashed.git] / usr / src / test / util-tests / tests / libsff / libsff.ksh
blobd9974bc10c541a8a14e1b7dea246f3d0e81a7c85
1 #! /usr/bin/ksh
4 # This file and its contents are supplied under the terms of the
5 # Common Development and Distribution License ("CDDL"), version 1.0.
6 # You may only use this file in accordance with the terms of version
7 # 1.0 of the CDDL.
9 # A full copy of the text of the CDDL should have accompanied this
10 # source. A copy of the CDDL is also available via the Internet at
11 # http://www.illumos.org/license/CDDL.
15 # Copyright (c) 2017, Joyent, Inc.
19 # Run all of the various libsff tests.
22 unalias -a
23 sff_arg0=$(basename $0)
24 sff_origwd=
25 sff_root=
26 sff_tests="8472 br compliance conn enc ident lengths opts strings wave"
27 sff_tests="$sff_tests 8636_diag 8636_extspec 8636_tech 8636_temp einval efault"
28 sff_outfile="/tmp/$sff_arg0.out.$$"
30 fatal()
32 typeset msg="$*"
33 [[ -z "$msg" ]] && msg="failed"
34 echo "TEST FAILED: $sff_arg0: $msg" >&2
35 rm -f $sff_outfile
36 exit 1
39 sff_origwd=$PWD
40 cd $(dirname $0) || fatal "failed to cd to test root"
41 sff_root=$PWD
42 cd $dt_origwd || fatal "failed to return to original dir"
44 for t in $sff_tests; do
45 difffile=
46 testfile=$sff_root/libsff_$t
48 if ! $testfile > $sff_outfile; then
49 fatal "failed to run $testfile"
52 if [[ -f $testfile.out ]]; then
53 if ! diff $testfile.out $sff_outfile >/dev/null; then
54 fatal "$t results differ from expected values"
57 printf "TEST PASSED: libsff_%s\n" $t
58 done
60 rm -f $sff_outfile || fatal "failed to remove output file"
61 exit 0