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

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: ncbray comment 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
« no previous file with comments | « 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");
71 # else
72 // TODO: Other architechtures, such as mips
73 #endif
59 } 74 }
60 75
61 #define TEST_IS_LOCK_FREE(TYPE) do { \ 76 #define TEST_IS_LOCK_FREE(TYPE) do { \
62 CHECK_EQ(std::atomic<TYPE>().is_lock_free(), true, \ 77 CHECK_EQ(std::atomic<TYPE>().is_lock_free(), true, \
63 "expected lock-free for `" STR(TYPE) "`"); \ 78 "expected lock-free for `" STR(TYPE) "`"); \
64 } while (0) 79 } while (0)
65 80
66 void test_is_lock_free() { 81 void test_is_lock_free() {
67 TEST_IS_LOCK_FREE(bool); 82 TEST_IS_LOCK_FREE(bool);
68 // Table 145. 83 // Table 145.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 // - std::atomic and their functions (including is_lock_free). 125 // - std::atomic and their functions (including is_lock_free).
111 // - std::atomic_flag. 126 // - std::atomic_flag.
112 // - std::atomic_thread_fence (atomic_signal_fence currently unsupported). 127 // - std::atomic_thread_fence (atomic_signal_fence currently unsupported).
113 // - 6 memory orders. 128 // - 6 memory orders.
114 129
115 int main() { 130 int main() {
116 test_lock_free_macros(); 131 test_lock_free_macros();
117 test_is_lock_free(); 132 test_is_lock_free();
118 return 0; 133 return 0;
119 } 134 }
OLDNEW
« no previous file with comments | « tests/toolchain/nacl.scons ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698