OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2012 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 #include "native_client/src/include/build_config.h" | 7 #include "native_client/src/include/build_config.h" |
8 #include "native_client/src/shared/platform/aligned_malloc.h" | 8 #include "native_client/src/shared/platform/aligned_malloc.h" |
9 #include "native_client/src/shared/platform/nacl_host_desc.h" | 9 #include "native_client/src/shared/platform/nacl_host_desc.h" |
10 #include "native_client/src/shared/platform/nacl_log.h" | 10 #include "native_client/src/shared/platform/nacl_log.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 // valid desc at pos 4 | 109 // valid desc at pos 4 |
110 NaClAppSetDesc(&app, 4, io_desc); | 110 NaClAppSetDesc(&app, 4, io_desc); |
111 ret_desc = NaClAppGetDesc(&app, 4); | 111 ret_desc = NaClAppGetDesc(&app, 4); |
112 ASSERT_TRUE(NULL != ret_desc); | 112 ASSERT_TRUE(NULL != ret_desc); |
113 | 113 |
114 // never set a desc at pos 10 | 114 // never set a desc at pos 10 |
115 ret_desc = NaClAppGetDesc(&app, 10); | 115 ret_desc = NaClAppGetDesc(&app, 10); |
116 ASSERT_TRUE(NULL == ret_desc); | 116 ASSERT_TRUE(NULL == ret_desc); |
117 } | 117 } |
118 | 118 |
119 // create service socket | |
120 TEST_F(SelLdrTest, CreateServiceSocket) { | |
121 struct NaClApp app; | |
122 int ret_code; | |
123 | |
124 ret_code = NaClAppCtor(&app); | |
125 ASSERT_EQ(1, ret_code); | |
126 | |
127 // CreateServiceSocket sets the app service_port to a service port | |
128 // desc and service_address to a service | |
129 ASSERT_TRUE(NULL == app.service_port); | |
130 ASSERT_TRUE(NULL == app.service_address); | |
131 NaClCreateServiceSocket(&app); | |
132 ASSERT_TRUE(NULL != app.service_port); | |
133 ASSERT_TRUE(NULL != app.service_address); | |
134 } | |
135 | |
136 // add and remove operations on the threads table | 119 // add and remove operations on the threads table |
137 // Remove thread from an empty table is tested in a death test. | 120 // Remove thread from an empty table is tested in a death test. |
138 // TODO(tuduce): specify the death test name when checking in. | 121 // TODO(tuduce): specify the death test name when checking in. |
139 TEST_F(SelLdrTest, ThreadTableTest) { | 122 TEST_F(SelLdrTest, ThreadTableTest) { |
140 struct NaClApp app; | 123 struct NaClApp app; |
141 struct NaClAppThread nat, *appt=&nat; | 124 struct NaClAppThread nat, *appt=&nat; |
142 int ret_code; | 125 int ret_code; |
143 | 126 |
144 ret_code = NaClAppCtor(&app); | 127 ret_code = NaClAppCtor(&app); |
145 ASSERT_EQ(1, ret_code); | 128 ASSERT_EQ(1, ret_code); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 NaClAlignedMalloc(sizeof(*natp), __alignof(struct NaClAppThread)); | 248 NaClAlignedMalloc(sizeof(*natp), __alignof(struct NaClAppThread)); |
266 ASSERT_TRUE(natp); | 249 ASSERT_TRUE(natp); |
267 // We use "volatile" in an attempt to prevent the compiler from | 250 // We use "volatile" in an attempt to prevent the compiler from |
268 // optimizing away our assertion based on the compiler's own | 251 // optimizing away our assertion based on the compiler's own |
269 // knowledge of the alignment of the struct it allocated. | 252 // knowledge of the alignment of the struct it allocated. |
270 volatile uintptr_t addr = (uintptr_t) &natp->user.gs_segment; | 253 volatile uintptr_t addr = (uintptr_t) &natp->user.gs_segment; |
271 ASSERT_EQ((int) (addr % 64), 0); | 254 ASSERT_EQ((int) (addr % 64), 0); |
272 NaClAlignedFree(natp); | 255 NaClAlignedFree(natp); |
273 } | 256 } |
274 #endif | 257 #endif |
OLD | NEW |