1 #!/usr/bin/ksh
2 #
3 # This file and its contents are supplied under the terms of the
4 # Common Development and Distribution License ("CDDL"), version 1.0.
5 # You may only use this file in accordance with the terms of version
6 # 1.0 of the CDDL.
7 #
8 # A full copy of the text of the CDDL should have accompanied this
9 # source. A copy of the CDDL is also available via the Internet at
10 # http://www.illumos.org/license/CDDL.
11 #
12
13 #
14 # Copyright 2018, Richard Lowe.
15 #
16
17 # Test that a simple use of linker-sets, that is, automatically generated start
18 # and end symbols for sections can be generated and used.
19
20 TESTDIR=$(dirname $0)
21
22 tmpdir=/tmp/test.$$
23 mkdir $tmpdir
24 cd $tmpdir
25
26 cleanup() {
27 cd /
28 rm -fr $tmpdir
29 }
30
31 trap 'cleanup' EXIT
32
33 # We expect any alternate linker to be in LD_ALTEXEC for us already
34 gcc -o simple ${TESTDIR}/simple-src.c -Wall -Wextra
35 if (( $? != 0 )); then
36 print -u2 "compilation of ${TESTDIR}/simple-src.c failed";
37 exit 1;
38 fi
39
40 ./simple > simple.$$.out 2>&1
41
42 if (( $? != 0 )); then
43 print -u2 "execution of ${TESTDIR}/simple-src.c failed";
44 exit 1;
45 fi
46
47 diff -u ${TESTDIR}/simple.out simple.$$.out
48 if (( $? != 0 )); then
49 print -u2 "${TESTDIR}/simple-src.c output mismatch"
50 exit 1;
51 fi