From 633be9a87b19a698d8287cafeabf68fc72535d1c Mon Sep 17 00:00:00 2001
From: Alexandre Abadie <alexandre.abadie@inria.fr>
Date: Sun, 29 Oct 2017 11:50:13 +0100
Subject: [PATCH] tests/pthread_cooperation: small improvements

---
 tests/pthread_cooperation/main.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/tests/pthread_cooperation/main.c b/tests/pthread_cooperation/main.c
index b011596581..8ab28ad522 100644
--- a/tests/pthread_cooperation/main.c
+++ b/tests/pthread_cooperation/main.c
@@ -23,6 +23,8 @@
 
 #define NUM_THREADS 12
 
+#define FACTORIAL_EXPECTED (479001600UL)
+
 pthread_t ths[NUM_THREADS];
 
 pthread_mutex_t mtx;
@@ -49,6 +51,7 @@ void *run(void *parameter)
 
 int main(void)
 {
+    puts("START");
     pthread_attr_t th_attr;
     pthread_attr_init(&th_attr);
     pthread_mutex_init(&mtx, NULL);
@@ -59,19 +62,21 @@ int main(void)
     }
 
     for (int i = 0; i < NUM_THREADS; ++i) {
-        printf("join\n");
+        printf("join thread %d\n", (i + 1));
         pthread_join(ths[i], NULL);
     }
 
     printf("Factorial: %d\n", storage);
 
-    if (storage != 479001600) {
-        puts("[!!!] Error, expected: 12!= 479001600.");
-    }
-
     pthread_mutex_destroy(&mtx);
     pthread_attr_destroy(&th_attr);
 
-    puts("finished");
+    if (storage == FACTORIAL_EXPECTED) {
+        puts("SUCCESS");
+    }
+    else {
+        puts("FAILURE: Error, expected: 12!= 479001600.");
+    }
+
     return 0;
 }
-- 
GitLab