All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH v2 1/4] tst_atomic: make tst_atomic_inc take a signed integer
@ 2016-04-14  8:59 Jan Stancek
  2016-04-14  8:59 ` [LTP] [PATCH v2 2/4] m4: add a check for __sync_add_and_fetch Jan Stancek
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Jan Stancek @ 2016-04-14  8:59 UTC (permalink / raw)
  To: ltp

This is a preparation for upcoming patches, which add atomic_add_return(),
based on kernel function of same name. Kernel's atomic_t is int based,
so let's match that.

Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
 doc/test-writing-guidelines.txt |  2 +-
 include/tst_atomic.h            |  2 +-
 lib/newlib_tests/test08.c       |  2 +-
 lib/tst_test.c                  | 16 ++++++++--------
 4 files changed, 11 insertions(+), 11 deletions(-)

Changes in v2:
- fixed tst_atomic_inc return type
- fixed tst_exit printf flags

diff --git a/doc/test-writing-guidelines.txt b/doc/test-writing-guidelines.txt
index d0b14084c90b..c0ef33afd5bb 100644
--- a/doc/test-writing-guidelines.txt
+++ b/doc/test-writing-guidelines.txt
@@ -780,7 +780,7 @@ the user supplied cleanup to the test library.
 
 static void cleanup(void)
 {
-	static unsigned int flag;
+	static int flag;
 
 	if (tst_atomic_inc(&flag) != 1)
 		pthread_exit(NULL);
diff --git a/include/tst_atomic.h b/include/tst_atomic.h
index 75c713d38d2a..2ec9f91318ea 100644
--- a/include/tst_atomic.h
+++ b/include/tst_atomic.h
@@ -18,7 +18,7 @@
 #ifndef TST_ATOMIC_H__
 #define TST_ATOMIC_H__
 
-static inline unsigned int tst_atomic_inc(unsigned int *v)
+static inline int tst_atomic_inc(int *v)
 {
 	return __sync_add_and_fetch(v, 1);
 }
diff --git a/lib/newlib_tests/test08.c b/lib/newlib_tests/test08.c
index 8fefc182650d..0a2023119a71 100644
--- a/lib/newlib_tests/test08.c
+++ b/lib/newlib_tests/test08.c
@@ -35,7 +35,7 @@ static void setup(void)
 
 static void cleanup(void)
 {
-	static unsigned int flag;
+	static int flag;
 
 	/* Avoid subsequent threads to enter the cleanup */
 	if (tst_atomic_inc(&flag) != 1)
diff --git a/lib/tst_test.c b/lib/tst_test.c
index 37265fe50951..b8ec246414d1 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -43,10 +43,10 @@ static float duration = -1;
 static pid_t main_pid;
 
 struct results {
-	unsigned int passed;
-	unsigned int skipped;
-	unsigned int failed;
-	unsigned int warnings;
+	int passed;
+	int skipped;
+	int failed;
+	int warnings;
 };
 
 static struct results *results;
@@ -442,10 +442,10 @@ static void do_exit(void)
 	int ret = 0;
 
 	printf("\nSummary:\n");
-	printf("passed   %u\n", results->passed);
-	printf("failed   %u\n", results->failed);
-	printf("skipped  %u\n", results->skipped);
-	printf("warnings %u\n", results->warnings);
+	printf("passed   %d\n", results->passed);
+	printf("failed   %d\n", results->failed);
+	printf("skipped  %d\n", results->skipped);
+	printf("warnings %d\n", results->warnings);
 
 	if (results->failed)
 		ret |= TFAIL;
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-04-15 12:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-14  8:59 [LTP] [PATCH v2 1/4] tst_atomic: make tst_atomic_inc take a signed integer Jan Stancek
2016-04-14  8:59 ` [LTP] [PATCH v2 2/4] m4: add a check for __sync_add_and_fetch Jan Stancek
2016-04-14 14:33   ` Cyril Hrubis
2016-04-14  8:59 ` [LTP] [PATCH v2 3/4] tst_atomic: add atomic_add_return for x86/64, ppc/64 and s390/x Jan Stancek
2016-04-14 14:36   ` Cyril Hrubis
2016-04-15 12:08     ` Jan Stancek
2016-04-14  8:59 ` [LTP] [PATCH v2 4/4] tst_atomic: add test for tst_atomic_inc Jan Stancek
2016-04-14 14:43   ` Cyril Hrubis
2016-04-14 14:37 ` [LTP] [PATCH v2 1/4] tst_atomic: make tst_atomic_inc take a signed integer Cyril Hrubis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.