Improve weaver test to count zeros vs '-1' values.

This isn't fixing a known issue, but more preparing for a potential
PSX mechanism error.

Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
This commit is contained in:
Andrew G. Morgan 2025-03-02 14:24:25 -08:00
parent 4b1d6d6332
commit 7be690ed8c
2 changed files with 4 additions and 4 deletions

View File

@ -39,7 +39,7 @@ int main(int argc, char **argv)
}
th[i] = weaver_thread();
int got = weaver_waitforit(i+1);
int want = (i&1) ? i+1 : 0;
int want = (i&1) ? (3*(i+1)) : (2*(i+1));
printf("for %ld weaver.so launched threads, total=%d, wanted=%d\n",
i+1, got, want);
if (got != want) {

View File

@ -26,7 +26,7 @@ static void *run_thread(void *ignored)
}
if (trigger == 1) {
counter++;
total += prctl(PR_GET_KEEPCAPS, 0, 0, 0, 0, 0);
total += prctl(PR_GET_KEEPCAPS, 0, 0, 0, 0, 0)+2;
primed--;
while (trigger == 1) {
pthread_cond_signal(&cond);
@ -100,8 +100,8 @@ SO_MAIN(int argc, char **argv) {
for (i = 0; i < N_THREADS; i++) {
pthread_join(arr[i], NULL);
}
if (n != 5) {
printf("FAILED: got=%d, want=5\n", n);
if (n != 25) {
printf("FAILED: got=%d, want=25\n", n);
exit(1);
}
printf("PASSED\n");