selftests: breakpoints: fix computation of test plan
authorPaolo Bonzini <pbonzini@redhat.com>
Tue, 23 Jun 2020 00:15:43 +0000 (20:15 -0400)
committerShuah Khan <skhan@linuxfoundation.org>
Mon, 6 Jul 2020 21:47:24 +0000 (15:47 -0600)
The computation of the test plan uses the available_cpus bitset
before calling sched_getaffinity to fill it in.  The resulting
plan is bogus, fix it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/selftests/breakpoints/step_after_suspend_test.c

index b3ead29c60894fcf3fc3c70510e27c99e0cb0c83..983ee6182e25aa21f604da91f6b17f71c170611b 100644 (file)
@@ -183,6 +183,10 @@ int main(int argc, char **argv)
                }
        }
 
+       err = sched_getaffinity(0, sizeof(available_cpus), &available_cpus);
+       if (err < 0)
+               ksft_exit_fail_msg("sched_getaffinity() failed\n");
+
        for (cpu = 0; cpu < CPU_SETSIZE; cpu++) {
                if (!CPU_ISSET(cpu, &available_cpus))
                        continue;
@@ -193,10 +197,6 @@ int main(int argc, char **argv)
        if (do_suspend)
                suspend();
 
-       err = sched_getaffinity(0, sizeof(available_cpus), &available_cpus);
-       if (err < 0)
-               ksft_exit_fail_msg("sched_getaffinity() failed\n");
-
        for (cpu = 0; cpu < CPU_SETSIZE; cpu++) {
                bool test_success;