-
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.
test: Add test for option "linkmode"
Signed-off-by: Eugene Loh <eugene.loh@oracle.com> Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
- Loading branch information
Showing
2 changed files
with
56 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,17 @@ | ||
try | ||
Linux version | ||
|
||
try -xlinkmode=static | ||
Linux version | ||
|
||
try -xlinkmode=kernel | ||
Linux version | ||
|
||
try -xlinkmode=foo | ||
try -xlinkmode=dynamic | ||
try -xlinkmode=dynamic -xknodefs | ||
Linux version | ||
|
||
-- @@stderr -- | ||
dtrace: failed to set -x linkmode: Invalid value for specified option | ||
dtrace: invalid probe specifier BEGIN { trace((string)`linux_banner); exit(0); }: relocation remains against kernel symbol vmlinux`linux_banner (offset {ptr}) |
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,39 @@ | ||
#!/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. | ||
# | ||
|
||
# @@nosort | ||
|
||
dtrace=$1 | ||
|
||
function mytest() { | ||
echo try $1 | ||
$dtrace $1 -qn 'BEGIN { trace((string)`linux_banner); exit(0); }' | cut -c-14 | ||
} | ||
|
||
# Test different link modes. | ||
# - (default) should be the same as "kernel" | ||
# - "static" means that all symbols are static | ||
# - "dynamic" means that all symbols are dynamic | ||
# - "kernel" means that kernel symbols are static while user symbols are dynamic | ||
# - "foo" would be unrecognized | ||
|
||
# But no DTrace (even Solaris) supported userspace symbol resolving. | ||
# So (default), "static", and "kernel" should all be the same. | ||
# They should all work. | ||
mytest " " | ||
mytest "-xlinkmode=static" | ||
mytest "-xlinkmode=kernel" | ||
|
||
# These should not work. | ||
mytest "-xlinkmode=foo" | ||
mytest "-xlinkmode=dynamic" | ||
|
||
# This should work. | ||
mytest "-xlinkmode=dynamic -xknodefs" | ||
|
||
exit 0 |