tst.ELFGenerationWithO.d.ksh revision 178476
1259694Spfg#!/bin/ksh -p 2259694Spfg# 3259694Spfg# CDDL HEADER START 4259694Spfg# 5259694Spfg# The contents of this file are subject to the terms of the 6259694Spfg# Common Development and Distribution License (the "License"). 7259694Spfg# You may not use this file except in compliance with the License. 8259694Spfg# 9259694Spfg# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10260932Spfg# or http://www.opensolaris.org/os/licensing. 11260932Spfg# See the License for the specific language governing permissions 12260932Spfg# and limitations under the License. 13260932Spfg# 14260932Spfg# When distributing Covered Code, include this CDDL HEADER in each 15260932Spfg# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16260932Spfg# If applicable, add the following below this CDDL HEADER, with the 17260932Spfg# fields enclosed by brackets "[]" replaced with your own identifying 18260932Spfg# information: Portions Copyright [yyyy] [name of copyright owner] 19260932Spfg# 20260932Spfg# CDDL HEADER END 21260074Spfg# 22260074Spfg 23260074Spfg# 24260074Spfg# Copyright 2006 Sun Microsystems, Inc. All rights reserved. 25260074Spfg# Use is subject to license terms. 26260074Spfg# 27260074Spfg 28258428Spfg#ident "%Z%%M% %I% %E% SMI" 29258428Spfg 30258428Spfg## 31258428Spfg# 32258428Spfg# ASSERTION: 33258428Spfg# Using -G option with dtrace utility produces an ELF file containing a 34258428Spfg# DTrace program. The output file can be named as required using the 35258428Spfg# -o option in conjunction with the -G option. 36258428Spfg# 37258428Spfg# SECTION: dtrace Utility/-G Option; 38258428Spfg# dtrace Utility/-o Option 39259947Spfg# 40259947Spfg## 41259947Spfg 42259947Spfgscript() 43260932Spfg{ 44260932Spfg $dtrace -G -o outputFile -s /dev/stdin <<EOF 45260932Spfg BEGIN 46260932Spfg { 47260932Spfg printf("This test should compile.\n"); 48259947Spfg exit(0); 49259947Spfg } 50259947SpfgEOF 51259947Spfg} 52260230Spfg 53260230Spfgif [ $# != 1 ]; then 54260230Spfg echo expected one argument: '<'dtrace-path'>' 55260230Spfg exit 2 56260230Spfgfi 57260230Spfg 58259694Spfgdtrace=$1 59259694Spfg 60259694Spfgscript 61259694Spfgstatus=$? 62259694Spfg 63259694Spfgif [ "$status" -ne 0 ]; then 64259694Spfg echo $tst: dtrace failed 65258428Spfg exit $status 66258428Spfgfi 67258428Spfg 68258428Spfgif [ ! -a "outputFile" ]; then 69260074Spfg echo $tst: file not generated 70258428Spfg exit 1 71260074Spfgfi 72260074Spfg 73260074Spfg/usr/bin/rm -f "outputFile" 74260074Spfgexit 0 75260074Spfg