Skip to content

Commit

Permalink
test: XFAIL lockmem test if rawtp-arg-type uses CTF
Browse files Browse the repository at this point in the history
To get rawtp arg types, we rely on CTF.  If CTF info is not available,
we fall back on a "trial and error" method simply for the number of args.
But we signal to the user if the trial-and-error method is failing due
to lockmem limits.

This test checked for that failure mode.  The test was skipped if
lockmem limits are not observed on the test system.

Skip the test also if CTF info *IS* available.

Signed-off-by: Eugene Loh <eugene.loh@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
  • Loading branch information
euloh authored and kvanhees committed Jan 30, 2024
1 parent 17b2a47 commit 4fff0c4
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 3 deletions.
4 changes: 4 additions & 0 deletions test/unittest/providers/rawtp/err.lockmem-too-low.r
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dtrace: invalid probe specifier rawtp:::sched_process_fork: Cannot retrieve argument count:
The kernel locked-memory limit is possibly too low. Set a
higher limit with the DTrace option '-xlockmem=N'. Or, use
'ulimit -l N' (Kbytes). Or, make N the string 'unlimited'.
37 changes: 34 additions & 3 deletions test/unittest/providers/rawtp/err.lockmem-too-low.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
#!/bin/bash
#
# Oracle Linux DTrace.
# Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
# 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.
#

# The mechanism for discovering rawtp arg types relies first on CTF.
# If CTF information is not available, we fall back to a "trial-and-error"
# method, which really only tells us the number of args. And that
# method simply cannot work if trials error due to lockmem limits.
# If lockmem limits are encountered, we want to signal that problem to the
# user.
#
# This test checks that failure mode. Therefore, two conditions
# must be met for this test to work. First, lockmem limits must be
# respected. Second, no CTF information should be available, so that
# the trial-and-error method will be invoked.

dtrace=$1

# Determine whether the system respects setting the lockmem limit as root.
Expand All @@ -16,9 +28,28 @@ if $dtrace -xlockmem=1 -n 'BEGIN { exit(0); }' &> /dev/null; then
fi

$dtrace -xlockmem=1 -lvn rawtp:::sched_process_fork |& \
awk '{ print; }
awk 'BEGIN {
err = 0; # lockmem error messages
CTF = 0; # arg types indicating CTF info
try = 0; # arg types indicating trial-and-error
}
{ print; }
/Cannot retrieve argument count/ { err++; }
/lockmem/ { err++; }
END { exit(err == 2 ? 1 : 0); }'
/^ *args\[[01]\]: struct task_struct \*$/ { CTF++ }
/^ *args\[[01]\]: uint64_t$/ { try++ }
END {
# Skip this test if CTF info was found.
if (err == 0 && CTF == 2 && try == 0) exit(67);
# Report the expected fail if error message is found.
if (err == 2 && CTF == 0 && try == 0) exit(1);
# Indicate the expected fail did not occur.
exit(0);
}'

exit $?

0 comments on commit 4fff0c4

Please sign in to comment.