xref: /illumos-gate/usr/src/test/header-tests/tests/c-symbols/setup.ksh (revision ac2250cb76bb32944fd2c8a3ba2cd3f79747748d)
1#!/usr/bin/ksh
2#
3#
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.
8#
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.
12#
13
14#
15# Copyright 2014 Garrett D'Amore <garrett@damore.org>
16# Copyright 2026 Gordon W. Ross
17#
18
19# First get $dir and $prog
20case $0 in
21*/*)
22	dir=${0%/*}
23	prog=${0##*/}
24	;;
25*)
26	dir=.
27	prog=${0}
28	;;
29esac
30
31for arg in $*
32do
33	if [[ $arg == "-d" ]]
34	then
35		debug="-d"
36	fi
37done
38
39if [[ -d "$dir/../../cfg/c-symbols" ]] ; then
40	STF_SUITE="$dir/../.."
41else
42	STF_SUITE=/opt/header-tests
43fi
44export STF_SUITE
45
46driver=$STF_SUITE/tests/common/symbol_test
47envcfg=$STF_SUITE/cfg/c-symbols-env.cfg
48symcfg=$STF_SUITE/cfg/c-symbols/${prog}.cfg
49
50# Special handling for "setup".  Just run ... -C
51if [[ $prog == setup ]]; then
52	envcfg="-C"
53	symcfg=
54fi
55
56# Determine which ISA widths this system supports.
57isa=$(/usr/bin/isainfo)
58case $isa in
59amd64*)		mlist="32 64" ;;
60sparcv9*)	mlist="32 64" ;;
61aarch64*)	mlist="64" ;;
62*)
63	print "ERROR: Unknown ISA: $isa" >&2
64	exit 1
65	;;
66esac
67
68[[ -n $debug ]] && set -x
69for m in $mlist
70do
71	$driver $debug --lang c -m${m} $envcfg $symcfg || exit 1
72done
73exit 0
74