xref: /illumos-gate/usr/src/cmd/dtrace/test/tst/i86xpv/xdt/tst.basic.ksh (revision 121d13daefbeb0546d0d9c6ef16c753aa6890290)
1c7158ae9Stariq#
2c7158ae9Stariq# CDDL HEADER START
3c7158ae9Stariq#
4c7158ae9Stariq# The contents of this file are subject to the terms of the
5c7158ae9Stariq# Common Development and Distribution License (the "License").
6c7158ae9Stariq# You may not use this file except in compliance with the License.
7c7158ae9Stariq#
8c7158ae9Stariq# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9c7158ae9Stariq# or http://www.opensolaris.org/os/licensing.
10c7158ae9Stariq# See the License for the specific language governing permissions
11c7158ae9Stariq# and limitations under the License.
12c7158ae9Stariq#
13c7158ae9Stariq# When distributing Covered Code, include this CDDL HEADER in each
14c7158ae9Stariq# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15c7158ae9Stariq# If applicable, add the following below this CDDL HEADER, with the
16c7158ae9Stariq# fields enclosed by brackets "[]" replaced with your own identifying
17c7158ae9Stariq# information: Portions Copyright [yyyy] [name of copyright owner]
18c7158ae9Stariq#
19c7158ae9Stariq# CDDL HEADER END
20c7158ae9Stariq#
21c7158ae9Stariq
22c7158ae9Stariq#
23*121d13daSFrank Van Der Linden# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24c7158ae9Stariq# Use is subject to license terms.
25c7158ae9Stariq#
26c7158ae9Stariq
27c7158ae9Stariq#
28c7158ae9Stariq# ASSERTION: Make sure that we can map in and read the Xen trace buffers.
29c7158ae9Stariq#
30c7158ae9Stariq
31c7158ae9Stariqif [ $# != 1 ]; then
32c7158ae9Stariq	echo expected one argument: '<'dtrace-path'>'
33c7158ae9Stariq	exit 2
34c7158ae9Stariqfi
35c7158ae9Stariq
36c7158ae9Stariq#
37c7158ae9Stariq# Do not fail the test in a domU
38c7158ae9Stariq#
39c7158ae9Stariqif [ ! -c /dev/xen/privcmd ]; then
40c7158ae9Stariq	exit 0
41c7158ae9Stariqfi
42c7158ae9Stariq
43c7158ae9Stariqdtrace=$1
44c7158ae9Stariq
45c7158ae9Stariqscript()
46c7158ae9Stariq{
47c7158ae9Stariq	$dtrace -qs /dev/stdin <<EOF
48c7158ae9Stariq	xdt:sched::on-cpu
49*121d13daSFrank Van Der Linden	/arg0 == 0/
50c7158ae9Stariq	{
51c7158ae9Stariq		self->on++;
52c7158ae9Stariq	}
53c7158ae9Stariq
54c7158ae9Stariq	xdt:sched::off-cpu
55*121d13daSFrank Van Der Linden	/arg0 == 0 && self->on/
56c7158ae9Stariq	{
57c7158ae9Stariq		self->off++;
58c7158ae9Stariq	}
59c7158ae9Stariq
60c7158ae9Stariq	xdt:sched::off-cpu
61c7158ae9Stariq	/self->on > 50 && self->off > 50/
62c7158ae9Stariq	{
63c7158ae9Stariq		exit(0);
64c7158ae9Stariq	}
65c7158ae9Stariq
66c7158ae9Stariq	profile:::tick-1sec
67c7158ae9Stariq	/n++ > 10/
68c7158ae9Stariq	{
69c7158ae9Stariq		exit(1);
70c7158ae9Stariq	}
71c7158ae9StariqEOF
72c7158ae9Stariq}
73c7158ae9Stariq
74c7158ae9Stariqscript
75c7158ae9Stariqstatus=$?
76c7158ae9Stariq
77c7158ae9Stariqexit $status
78