tests: test_glibc_thread_support: Add bigger load.
authorRobin Hack <hack.robin@gmail.com>
Fri, 26 Sep 2014 14:19:09 +0000 (16:19 +0200)
committerAndreas Schneider <asn@samba.org>
Mon, 6 Oct 2014 14:16:12 +0000 (16:16 +0200)
This can help (and helped) with revealing race conditions.

Signed-off-by: Robin Hack <hack.robin@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
tests/test_glibc_thread_support.c

index 0f0a39942a25db23c59ddb796956aa24a359d5a9..a4baf06b6abacf30635161423e9e2f81453aaeb4 100644 (file)
@@ -19,7 +19,7 @@
 #include <syscall.h>
 #endif
 
-#define NUM_THREADS 3
+#define NUM_THREADS 10
 
 struct parm {
        int id;
@@ -32,14 +32,17 @@ static void *syscall_setreuid(void *arg)
 {
        long int rc;
        uid_t u;
+       uid_t ru;
 
        (void) arg; /* unused */
 
-       rc = syscall(SYS_setreuid, -1, 0);
-       assert_int_equal(rc, 0);
-
-       u = geteuid();
-       assert_int_equal(u, 0);
+       /* This load can help with revealing race conditions. */
+       for (ru = 0; ru < 2048; ++ru) {
+               rc = syscall(SYS_setreuid, -1, ru);
+               assert_int_equal(rc, 0);
+               u = geteuid();
+               assert_int_equal(u, ru);
+       }
 
        return NULL;
 }