From 3c14034e3dfd23aea9e830e7aa7be5f1acaa8410 Mon Sep 17 00:00:00 2001 From: Frank Rowand Date: Tue, 1 May 2012 19:45:44 -0700 Subject: rt-tests: cyclictest warn of interaction between '-a', '--smp', and '--numa' The '-a' option is always ignored if --smp or --numa is specified. Fix the warning message to not depend on --smp or --numa occuring first. Signed-off-by: Frank Rowand Tested-by: Darren Hart Signed-off-by: Clark Williams --- src/cyclictest/cyclictest.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c index 92df82b..f2566cc 100644 --- a/src/cyclictest/cyclictest.c +++ b/src/cyclictest/cyclictest.c @@ -957,10 +957,11 @@ static char *policyname(int policy) static void process_options (int argc, char *argv[]) { int error = 0; + int option_affinity = 0; int max_cpus = sysconf(_SC_NPROCESSORS_CONF); for (;;) { - int option_index = 0; + int option_index = 0; /** Options for getopt */ static struct option long_options[] = { {"affinity", optional_argument, NULL, 'a'}, @@ -1008,10 +1009,9 @@ static void process_options (int argc, char *argv[]) break; switch (c) { case 'a': - if (smp) { - warn("-a ignored due to --smp\n"); + option_affinity = 1; + if (smp || numa) break; - } if (optarg != NULL) { affinity = atoi(optarg); setaffinity = AFFINITY_SPECIFIED; @@ -1121,6 +1121,14 @@ static void process_options (int argc, char *argv[]) } } + if (option_affinity) { + if (smp) { + warn("-a ignored due to --smp\n"); + } else if (numa) { + warn("-a ignored due to --numa\n"); + } + } + if (setaffinity == AFFINITY_SPECIFIED) { if (affinity < 0) error = 1; -- cgit 1.2.3-korg