xref: /onnv-gate/usr/src/cmd/dtrace/test/tst/i86xpv/xdt/tst.basic.ksh (revision 11270:47a962fe7b45)
16670Stariq#
26670Stariq# CDDL HEADER START
36670Stariq#
46670Stariq# The contents of this file are subject to the terms of the
56670Stariq# Common Development and Distribution License (the "License").
66670Stariq# You may not use this file except in compliance with the License.
76670Stariq#
86670Stariq# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
96670Stariq# or http://www.opensolaris.org/os/licensing.
106670Stariq# See the License for the specific language governing permissions
116670Stariq# and limitations under the License.
126670Stariq#
136670Stariq# When distributing Covered Code, include this CDDL HEADER in each
146670Stariq# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
156670Stariq# If applicable, add the following below this CDDL HEADER, with the
166670Stariq# fields enclosed by brackets "[]" replaced with your own identifying
176670Stariq# information: Portions Copyright [yyyy] [name of copyright owner]
186670Stariq#
196670Stariq# CDDL HEADER END
206670Stariq#
216670Stariq
226670Stariq#
23*11270SFrank.Vanderlinden@Sun.COM# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
246670Stariq# Use is subject to license terms.
256670Stariq#
266670Stariq
276670Stariq#
286670Stariq# ASSERTION: Make sure that we can map in and read the Xen trace buffers.
296670Stariq#
306670Stariq
316670Stariqif [ $# != 1 ]; then
326670Stariq	echo expected one argument: '<'dtrace-path'>'
336670Stariq	exit 2
346670Stariqfi
356670Stariq
366670Stariq#
376670Stariq# Do not fail the test in a domU
386670Stariq#
396670Stariqif [ ! -c /dev/xen/privcmd ]; then
406670Stariq	exit 0
416670Stariqfi
426670Stariq
436670Stariqdtrace=$1
446670Stariq
456670Stariqscript()
466670Stariq{
476670Stariq	$dtrace -qs /dev/stdin <<EOF
486670Stariq	xdt:sched::on-cpu
49*11270SFrank.Vanderlinden@Sun.COM	/arg0 == 0/
506670Stariq	{
516670Stariq		self->on++;
526670Stariq	}
536670Stariq
546670Stariq	xdt:sched::off-cpu
55*11270SFrank.Vanderlinden@Sun.COM	/arg0 == 0 && self->on/
566670Stariq	{
576670Stariq		self->off++;
586670Stariq	}
596670Stariq
606670Stariq	xdt:sched::off-cpu
616670Stariq	/self->on > 50 && self->off > 50/
626670Stariq	{
636670Stariq		exit(0);
646670Stariq	}
656670Stariq
666670Stariq	profile:::tick-1sec
676670Stariq	/n++ > 10/
686670Stariq	{
696670Stariq		exit(1);
706670Stariq	}
716670StariqEOF
726670Stariq}
736670Stariq
746670Stariqscript
756670Stariqstatus=$?
766670Stariq
776670Stariqexit $status
78