xref: /illumos-gate/usr/src/test/header-tests/tests/cxx-symbols/setup.ksh (revision f9db9ff779c49e6c6c53004fb478ca21c4cbdb57)
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	case $arg in
34	-d|-D)
35		debug="$debug $arg"
36		;;
37	-f)
38		force="-f"
39		;;
40	esac
41done
42
43if [[ -d "$dir/../../cfg/cxx-symbols" ]] ; then
44	STF_SUITE="$dir/../.."
45else
46	STF_SUITE=/opt/header-tests
47fi
48export STF_SUITE
49
50driver=$STF_SUITE/tests/common/symbol_test
51envcfg=$STF_SUITE/cfg/cxx-symbols-env.cfg
52symcfg=$STF_SUITE/cfg/cxx-symbols/${prog}.cfg
53
54# Special handling for "setup".  Just run ... -C
55if [[ $prog == setup ]]; then
56	envcfg="-C"
57	symcfg=
58fi
59
60# Determine which ISA widths this system supports.
61isa=$(/usr/bin/isainfo)
62case $isa in
63amd64*)		mlist="32 64" ;;
64sparcv9*)	mlist="32 64" ;;
65aarch64*)	mlist="64" ;;
66*)
67	print "ERROR: Unknown ISA: $isa" >&2
68	exit 1
69	;;
70esac
71
72[[ -n $debug ]] && set -x
73for m in $mlist
74do
75	$driver $debug $force --lang c++ -m${m} $envcfg $symcfg
76	rc=$?
77	[[ -n "$force" ]] || [[ $rc == 0 ]] || exit $rc
78done
79exit 0
80