Hello,
I would like to share two observations - 
1. Is it necessary to initialize  nrcpus = 2 anymore?
2. Another problem may happen in the code below where waitpid is called - 
    for (i = 0; i < nrcpus; i++) {
                int status;
                waitpid(pids[i], &status, 0);
                if (status != 0) {
                        fprintf(stderr, "test for cpu %d has failed\n", i);
                        ret = 1;
                }
        }
   Since for offline cpus, no child process is created, now these cpus pid[i]'s will be zero (due to calloc). This will change the meaning of waitpid function as man page says - 
    pid 0  -    meaning wait for any child process whose process group ID is equal to that of the calling process.
  I think a check should be added before waitpid call - 
    if (pids[i] != 0)
            waitpid(pids[i], &status, 0);