1*d2a70789SRichard Lowe#! /usr/bin/ksh 2*d2a70789SRichard Lowe# 3*d2a70789SRichard Lowe# 4*d2a70789SRichard Lowe# This file and its contents are supplied under the terms of the 5*d2a70789SRichard Lowe# Common Development and Distribution License ("CDDL"), version 1.0. 6*d2a70789SRichard Lowe# You may only use this file in accordance with the terms of version 7*d2a70789SRichard Lowe# 1.0 of the CDDL. 8*d2a70789SRichard Lowe# 9*d2a70789SRichard Lowe# A full copy of the text of the CDDL should have accompanied this 10*d2a70789SRichard Lowe# source. A copy of the CDDL is also available via the Internet at 11*d2a70789SRichard Lowe# http://www.illumos.org/license/CDDL. 12*d2a70789SRichard Lowe# 13*d2a70789SRichard Lowe 14*d2a70789SRichard Lowe# 15*d2a70789SRichard Lowe# Copyright 2015, Richard Lowe. 16*d2a70789SRichard Lowe# 17*d2a70789SRichard Lowe 18*d2a70789SRichard Lowecd /tmp; 19*d2a70789SRichard Lowe 20*d2a70789SRichard Lowecleanup() { 21*d2a70789SRichard Lowe rm /tmp/output.$$ 22*d2a70789SRichard Lowe rm /tmp/expected.$$ 23*d2a70789SRichard Lowe} 24*d2a70789SRichard Lowe 25*d2a70789SRichard Lowetrap cleanup EXIT 26*d2a70789SRichard Lowe 27*d2a70789SRichard Lowecat > /tmp/expected.$$ <<EOF 28*d2a70789SRichard Lowe^psecflags\(0x[0-9A-F]+, PSF_INHERIT, \{ PROC_SEC_ASLR, 0x0, 0x0, B_FALSE \}\) = 0$ 29*d2a70789SRichard LoweEOF 30*d2a70789SRichard Lowe 31*d2a70789SRichard Lowetruss -t psecflags /usr/bin/psecflags -s current,aslr -e ls \ 32*d2a70789SRichard Lowe >/dev/null 2>output.$$ 33*d2a70789SRichard Lowe 34*d2a70789SRichard Loweif ! grep -qEf /tmp/expected.$$ /tmp/output.$$; then 35*d2a70789SRichard Lowe echo "truss: failed" 36*d2a70789SRichard Lowe echo "output:" 37*d2a70789SRichard Lowe sed -e 's/^/ /' output.$$ 38*d2a70789SRichard Lowe echo "should match:" 39*d2a70789SRichard Lowe sed -e 's/^/ /' expected.$$ 40*d2a70789SRichard Lowe exit 1; 41*d2a70789SRichard Lowefi 42*d2a70789SRichard Lowe 43*d2a70789SRichard Loweexit 0 44