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 2015, Richard Lowe. 16# 17 18cd /tmp; 19 20cleanup() { 21 rm /tmp/output.$$ 22 rm /tmp/expected.$$ 23} 24 25trap cleanup EXIT 26 27cat > /tmp/expected.$$ <<EOF 28^psecflags\(0x[0-9A-F]+, PSF_INHERIT, \{ PROC_SEC_ASLR, 0x0, 0x0, B_FALSE \}\) = 0$ 29EOF 30 31truss -t psecflags /usr/bin/psecflags -s current,aslr -e ls \ 32 >/dev/null 2>output.$$ 33 34if ! grep -qEf /tmp/expected.$$ /tmp/output.$$; then 35 echo "truss: failed" 36 echo "output:" 37 sed -e 's/^/ /' output.$$ 38 echo "should match:" 39 sed -e 's/^/ /' expected.$$ 40 exit 1; 41fi 42 43exit 0 44