-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Eugene Loh <eugene.loh@oracle.com> Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
- Loading branch information
Showing
4 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Oracle Linux DTrace. | ||
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. | ||
* Licensed under the Universal Permissive License v 1.0 as shown at | ||
* http://oss.oracle.com/licenses/upl. | ||
*/ | ||
|
||
/* | ||
* ASSERTION: Option modpath cannot be used from within a D program. | ||
* | ||
* SECTION: Options and Tunables/Consumer Options | ||
*/ | ||
|
||
#pragma D option modpath=/nonexistent/directory | ||
|
||
BEGIN | ||
{ | ||
exit(0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-- @@stderr -- | ||
dtrace: failed to compile script test/unittest/options/err.D_PRAGMA_OPTSET.modpath.d: [D_PRAGMA_OPTSET] line 14: failed to set option 'modpath' to '/nonexistent/directory': Option cannot be used from within a D program |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FUNCTION:NAME | ||
:BEGIN | ||
|
||
sanity check on DTrace passed | ||
DTrace correctly fails when modpath is an empty directory | ||
FUNCTION:NAME | ||
:BEGIN | ||
|
||
DTrace works with modpath and a linked CTF archive | ||
-- @@stderr -- | ||
dtrace: description 'BEGIN ' matched 1 probe | ||
dtrace: description 'BEGIN ' matched 1 probe | ||
dtrace: could not enable tracing: Module does not contain any CTF data | ||
dtrace: description 'BEGIN ' matched 1 probe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/bash | ||
# | ||
# Oracle Linux DTrace. | ||
# Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. | ||
# Licensed under the Universal Permissive License v 1.0 as shown at | ||
# http://oss.oracle.com/licenses/upl. | ||
# | ||
|
||
dtrace=$1 | ||
|
||
DIRNAME="$tmpdir/modpath.$$.$RANDOM" | ||
mkdir -p $DIRNAME | ||
cd $DIRNAME | ||
|
||
# create the directory where the CTF archive will end up | ||
mkdir -p mydirectory/kernel | ||
|
||
# sanity check that DTrace works | ||
$dtrace $dt_flags -n 'BEGIN {exit(0)}' | ||
if [ $? -ne 0 ]; then | ||
echo ERROR: sanity check on DTrace failed | ||
exit 1 | ||
else | ||
echo sanity check on DTrace passed | ||
fi | ||
|
||
# verify that modpath directs us to the (empty) directory | ||
$dtrace $dt_flags -xmodpath=mydirectory -n 'BEGIN {exit(0)}' | ||
if [ $? -ne 0 ]; then | ||
echo DTrace correctly fails when modpath is an empty directory | ||
else | ||
echo ERROR: DTrace unexpectedly passes with modpath set to empty directory | ||
exit 1 | ||
fi | ||
|
||
# link a CTF archive to our directory | ||
ln -s /lib/modules/$(uname -r)/kernel/vmlinux.ctfa mydirectory/kernel/vmlinux.ctfa | ||
|
||
# verify that modpath now works | ||
$dtrace $dt_flags -xmodpath=mydirectory -n 'BEGIN {exit(0)}' | ||
if [ $? -ne 0 ]; then | ||
echo ERROR: DTrace somehow fails | ||
exit 1 | ||
else | ||
echo DTrace works with modpath and a linked CTF archive | ||
exit 0 | ||
fi |