Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(331)

Side by Side Diff: tests/toolchain/synchronization_cpp11.cc

Issue 639113003: Add nacl-clang testing to SCons (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« tests/threads/race_test.c ('K') | « tests/toolchain/nacl.scons ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The Native Client Authors. All rights reserved. 2 * Copyright (c) 2013 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 /* 7 /*
8 * This test ensures that the PNaCl backends can deal with C++11 8 * This test ensures that the PNaCl backends can deal with C++11
9 * synchronization primitives as would be written by regular users, 9 * synchronization primitives as would be written by regular users,
10 * including PNaCl's ABI stabilization and target lowering. 10 * including PNaCl's ABI stabilization and target lowering.
(...skipping 28 matching lines...) Expand all
39 39
40 40
41 /* 41 /*
42 * ATOMIC_*_LOCK_FREE 42 * ATOMIC_*_LOCK_FREE
43 * 43 *
44 * These macros must be compile-time constants, and for PNaCl the value 44 * These macros must be compile-time constants, and for PNaCl the value
45 * should be 1, which means that the corresponding type may be 45 * should be 1, which means that the corresponding type may be
46 * lock-free: we can't guarantee that all our platforms are lock-free. 46 * lock-free: we can't guarantee that all our platforms are lock-free.
47 */ 47 */
48 void test_lock_free_macros() { 48 void test_lock_free_macros() {
49 #if defined(__pnacl__)
49 static_assert(ATOMIC_BOOL_LOCK_FREE == 1, "should be compile-time 1"); 50 static_assert(ATOMIC_BOOL_LOCK_FREE == 1, "should be compile-time 1");
50 static_assert(ATOMIC_CHAR_LOCK_FREE == 1, "should be compile-time 1"); 51 static_assert(ATOMIC_CHAR_LOCK_FREE == 1, "should be compile-time 1");
51 static_assert(ATOMIC_CHAR16_T_LOCK_FREE == 1, "should be compile-time 1"); 52 static_assert(ATOMIC_CHAR16_T_LOCK_FREE == 1, "should be compile-time 1");
52 static_assert(ATOMIC_CHAR32_T_LOCK_FREE == 1, "should be compile-time 1"); 53 static_assert(ATOMIC_CHAR32_T_LOCK_FREE == 1, "should be compile-time 1");
53 static_assert(ATOMIC_WCHAR_T_LOCK_FREE == 1, "should be compile-time 1"); 54 static_assert(ATOMIC_WCHAR_T_LOCK_FREE == 1, "should be compile-time 1");
54 static_assert(ATOMIC_SHORT_LOCK_FREE == 1, "should be compile-time 1"); 55 static_assert(ATOMIC_SHORT_LOCK_FREE == 1, "should be compile-time 1");
55 static_assert(ATOMIC_INT_LOCK_FREE == 1, "should be compile-time 1"); 56 static_assert(ATOMIC_INT_LOCK_FREE == 1, "should be compile-time 1");
56 static_assert(ATOMIC_LONG_LOCK_FREE == 1, "should be compile-time 1"); 57 static_assert(ATOMIC_LONG_LOCK_FREE == 1, "should be compile-time 1");
57 static_assert(ATOMIC_LLONG_LOCK_FREE == 1, "should be compile-time 1"); 58 static_assert(ATOMIC_LLONG_LOCK_FREE == 1, "should be compile-time 1");
58 static_assert(ATOMIC_POINTER_LOCK_FREE == 1, "should be compile-time 1"); 59 static_assert(ATOMIC_POINTER_LOCK_FREE == 1, "should be compile-time 1");
60 #elif defined(__x86_64__) || defined(__i386__) || defined(__arm__)
61 static_assert(ATOMIC_BOOL_LOCK_FREE == 2, "should be compile-time 2");
62 static_assert(ATOMIC_CHAR_LOCK_FREE == 2, "should be compile-time 2");
63 static_assert(ATOMIC_CHAR16_T_LOCK_FREE == 2, "should be compile-time 2");
64 static_assert(ATOMIC_CHAR32_T_LOCK_FREE == 2, "should be compile-time 2");
65 static_assert(ATOMIC_WCHAR_T_LOCK_FREE == 2, "should be compile-time 2");
66 static_assert(ATOMIC_SHORT_LOCK_FREE == 2, "should be compile-time 2");
67 static_assert(ATOMIC_INT_LOCK_FREE == 2, "should be compile-time 2");
68 static_assert(ATOMIC_LONG_LOCK_FREE == 2, "should be compile-time 2");
69 static_assert(ATOMIC_LLONG_LOCK_FREE == 2, "should be compile-time 2");
70 static_assert(ATOMIC_POINTER_LOCK_FREE == 2, "should be compile-time 2");
jvoung (off chromium) 2014/10/08 22:40:23 #else ... // TODO other architectures like mips.
Derek Schuff 2014/10/09 16:55:42 Done. Yeah there may well never be a non-pnacl mip
71 #endif
59 } 72 }
60 73
61 #define TEST_IS_LOCK_FREE(TYPE) do { \ 74 #define TEST_IS_LOCK_FREE(TYPE) do { \
62 CHECK_EQ(std::atomic<TYPE>().is_lock_free(), true, \ 75 CHECK_EQ(std::atomic<TYPE>().is_lock_free(), true, \
63 "expected lock-free for `" STR(TYPE) "`"); \ 76 "expected lock-free for `" STR(TYPE) "`"); \
64 } while (0) 77 } while (0)
65 78
66 void test_is_lock_free() { 79 void test_is_lock_free() {
67 TEST_IS_LOCK_FREE(bool); 80 TEST_IS_LOCK_FREE(bool);
68 // Table 145. 81 // Table 145.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 // - std::atomic and their functions (including is_lock_free). 123 // - std::atomic and their functions (including is_lock_free).
111 // - std::atomic_flag. 124 // - std::atomic_flag.
112 // - std::atomic_thread_fence (atomic_signal_fence currently unsupported). 125 // - std::atomic_thread_fence (atomic_signal_fence currently unsupported).
113 // - 6 memory orders. 126 // - 6 memory orders.
114 127
115 int main() { 128 int main() {
116 test_lock_free_macros(); 129 test_lock_free_macros();
117 test_is_lock_free(); 130 test_is_lock_free();
118 return 0; 131 return 0;
119 } 132 }
OLDNEW
« tests/threads/race_test.c ('K') | « tests/toolchain/nacl.scons ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698