tests: Fix build on FreeBSD
authorEd Maste <emaste@freebsd.org>
Sat, 17 Aug 2013 20:40:11 +0000 (16:40 -0400)
committerBen Pfaff <blp@nicira.com>
Sat, 17 Aug 2013 22:19:05 +0000 (15:19 -0700)
Avoid relying on a non-portable implementation detail for atomic_flag
tests.  Per the standard, the only way to obtain the value of the flag
is via the return value from atomic_flag_test_and_set.

Signed-off-by: Ed Maste <emaste@freebsd.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
tests/test-atomic.c

index e9bd6bd..e6df1cd 100644 (file)
@@ -66,9 +66,9 @@ test_atomic_flag(void)
 {
     atomic_flag flag = ATOMIC_FLAG_INIT;
     ovs_assert(atomic_flag_test_and_set(&flag) == false);
-    ovs_assert(flag.b == true);
+    ovs_assert(atomic_flag_test_and_set(&flag) == true);
     atomic_flag_clear(&flag);
-    ovs_assert(flag.b == false);
+    ovs_assert(atomic_flag_test_and_set(&flag) == false);
 }
 
 int