projects
/
urcu.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
tests: only include syscall.h on linux systems
[urcu.git]
/
tests
/
test_uatomic.c
diff --git
a/tests/test_uatomic.c
b/tests/test_uatomic.c
index c0f36fe5f90f5e346be54befc1f93b09b2050b50..692060bcdf175763e2290c6c207d7d66366928c9 100644
(file)
--- a/
tests/test_uatomic.c
+++ b/
tests/test_uatomic.c
@@
-1,21
+1,10
@@
#include <stdio.h>
#include <assert.h>
#include <stdio.h>
#include <assert.h>
-
-#define UATOMIC_NO_LINK_ERROR
-#include <urcu/uatomic_arch.h>
-
-#if (defined(__i386__) || defined(__x86_64__))
-#define HAS_ATOMIC_BYTE
-#define HAS_ATOMIC_SHORT
-#endif
+#include <urcu/uatomic.h>
struct testvals {
struct testvals {
-#ifdef HAS_ATOMIC_BYTE
unsigned char c;
unsigned char c;
-#endif
-#ifdef HAS_ATOMIC_SHORT
unsigned short s;
unsigned short s;
-#endif
unsigned int i;
unsigned long l;
};
unsigned int i;
unsigned long l;
};
@@
-44,20
+33,24
@@
do { \
assert(uatomic_read(ptr) == 23); \
uatomic_dec(ptr); \
assert(uatomic_read(ptr) == 22); \
assert(uatomic_read(ptr) == 23); \
uatomic_dec(ptr); \
assert(uatomic_read(ptr) == 22); \
- v = uatomic_add_return(ptr, 100); \
- assert(v == 122); \
+ v = uatomic_add_return(ptr, 74); \
+ assert(v == 96); \
+ assert(uatomic_read(ptr) == 96); \
+ uatomic_or(ptr, 58); \
assert(uatomic_read(ptr) == 122); \
v = uatomic_sub_return(ptr, 1); \
assert(v == 121); \
assert(uatomic_read(ptr) == 121); \
assert(uatomic_read(ptr) == 122); \
v = uatomic_sub_return(ptr, 1); \
assert(v == 121); \
assert(uatomic_read(ptr) == 121); \
+ uatomic_and(ptr, 129); \
+ assert(uatomic_read(ptr) == 1); \
} while (0)
int main(int argc, char **argv)
{
} while (0)
int main(int argc, char **argv)
{
-#ifdef HAS_ATOMIC_BYTE
+#ifdef
UATOMIC_
HAS_ATOMIC_BYTE
do_test(&vals.c);
#endif
do_test(&vals.c);
#endif
-#ifdef HAS_ATOMIC_SHORT
+#ifdef
UATOMIC_
HAS_ATOMIC_SHORT
do_test(&vals.s);
#endif
do_test(&vals.i);
do_test(&vals.s);
#endif
do_test(&vals.i);
This page took
0.024946 seconds
and
4
git commands to generate.