Skip to content

Commit

Permalink
selftests: fuxex: Report a unique test name per run of futex_requeue_pi
Browse files Browse the repository at this point in the history
The futex_requeue_pi test program is run a number of times with different
options to provide multiple test cases. Currently every time it runs it
reports the result with a consistent string, meaning that automated systems
parsing the TAP output from a test run have difficulty in distinguishing
which test is which.

The parameters used for the test are already logged as part of the test
output, let's use the same format to roll them into the test name that we
use with KTAP so that automated systems can follow the results of the
individual cases that get run.

Signed-off-by: Mark Brown <broonie@kernel.org>
Acked-by: Davidlohr Bueso <dave@stgolabs.net>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
  • Loading branch information
Mark Brown authored and Shuah Khan committed Feb 19, 2024
1 parent 345e8ab commit f17d8a8
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tools/testing/selftests/futex/functional/futex_requeue_pi.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
*
*****************************************************************************/

#define _GNU_SOURCE

#include <errno.h>
#include <limits.h>
#include <pthread.h>
Expand Down Expand Up @@ -358,6 +360,7 @@ int unit_test(int broadcast, long lock, int third_party_owner, long timeout_ns)

int main(int argc, char *argv[])
{
const char *test_name;
int c, ret;

while ((c = getopt(argc, argv, "bchlot:v:")) != -1) {
Expand Down Expand Up @@ -397,13 +400,21 @@ int main(int argc, char *argv[])
"\tArguments: broadcast=%d locked=%d owner=%d timeout=%ldns\n",
broadcast, locked, owner, timeout_ns);

ret = asprintf(&test_name,
"%s broadcast=%d locked=%d owner=%d timeout=%ldns",
TEST_NAME, broadcast, locked, owner, timeout_ns);
if (ret < 0) {
ksft_print_msg("Failed to generate test name\n");
test_name = TEST_NAME;
}

/*
* FIXME: unit_test is obsolete now that we parse options and the
* various style of runs are done by run.sh - simplify the code and move
* unit_test into main()
*/
ret = unit_test(broadcast, locked, owner, timeout_ns);

print_result(TEST_NAME, ret);
print_result(test_name, ret);
return ret;
}

0 comments on commit f17d8a8

Please sign in to comment.