t_call_once.sh revision 1.1.2.2 1 1.1.2.2 pgoyette # $NetBSD: t_call_once.sh,v 1.1.2.2 2018/03/30 06:20:16 pgoyette Exp $
2 1.1.2.2 pgoyette #
3 1.1.2.2 pgoyette # Copyright (c) 2018 The NetBSD Foundation, Inc.
4 1.1.2.2 pgoyette # All rights reserved.
5 1.1.2.2 pgoyette #
6 1.1.2.2 pgoyette # Redistribution and use in source and binary forms, with or without
7 1.1.2.2 pgoyette # modification, are permitted provided that the following conditions
8 1.1.2.2 pgoyette # are met:
9 1.1.2.2 pgoyette # 1. Redistributions of source code must retain the above copyright
10 1.1.2.2 pgoyette # notice, this list of conditions and the following disclaimer.
11 1.1.2.2 pgoyette # 2. Redistributions in binary form must reproduce the above copyright
12 1.1.2.2 pgoyette # notice, this list of conditions and the following disclaimer in the
13 1.1.2.2 pgoyette # documentation and/or other materials provided with the distribution.
14 1.1.2.2 pgoyette #
15 1.1.2.2 pgoyette # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
16 1.1.2.2 pgoyette # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17 1.1.2.2 pgoyette # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18 1.1.2.2 pgoyette # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
19 1.1.2.2 pgoyette # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 1.1.2.2 pgoyette # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 1.1.2.2 pgoyette # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 1.1.2.2 pgoyette # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 1.1.2.2 pgoyette # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 1.1.2.2 pgoyette # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 1.1.2.2 pgoyette # POSSIBILITY OF SUCH DAMAGE.
26 1.1.2.2 pgoyette #
27 1.1.2.2 pgoyette
28 1.1.2.2 pgoyette atf_test_case call_once
29 1.1.2.2 pgoyette call_once_head() {
30 1.1.2.2 pgoyette atf_set "descr" "compile and run std::call_once"
31 1.1.2.2 pgoyette atf_set "require.progs" "c++"
32 1.1.2.2 pgoyette }
33 1.1.2.2 pgoyette
34 1.1.2.2 pgoyette atf_test_case call_once_profile
35 1.1.2.2 pgoyette call_once_profile_head() {
36 1.1.2.2 pgoyette atf_set "descr" "compile and run std::call_once with profiling option"
37 1.1.2.2 pgoyette atf_set "require.progs" "c++"
38 1.1.2.2 pgoyette }
39 1.1.2.2 pgoyette
40 1.1.2.2 pgoyette atf_test_case call_once_pic
41 1.1.2.2 pgoyette call_once_pic_head() {
42 1.1.2.2 pgoyette atf_set "descr" "compile and run PIC std::call_once"
43 1.1.2.2 pgoyette atf_set "require.progs" "c++"
44 1.1.2.2 pgoyette }
45 1.1.2.2 pgoyette
46 1.1.2.2 pgoyette atf_test_case call_once_pic_32
47 1.1.2.2 pgoyette call_once_pic_32_head() {
48 1.1.2.2 pgoyette atf_set "descr" "compile and run 32-bit PIC std::call_once"
49 1.1.2.2 pgoyette atf_set "require.progs" "c++"
50 1.1.2.2 pgoyette }
51 1.1.2.2 pgoyette
52 1.1.2.2 pgoyette atf_test_case call_once_pic_profile
53 1.1.2.2 pgoyette call_once_pic_head() {
54 1.1.2.2 pgoyette atf_set "descr" "compile and run PIC std::call_once with profiling flag"
55 1.1.2.2 pgoyette atf_set "require.progs" "c++"
56 1.1.2.2 pgoyette }
57 1.1.2.2 pgoyette
58 1.1.2.2 pgoyette atf_test_case call_once_pic_profile_32
59 1.1.2.2 pgoyette call_once_pic_profile_32_head() {
60 1.1.2.2 pgoyette atf_set "descr" "compile and run 32-bit PIC std::call_once with profiling flag"
61 1.1.2.2 pgoyette atf_set "require.progs" "c++"
62 1.1.2.2 pgoyette }
63 1.1.2.2 pgoyette
64 1.1.2.2 pgoyette atf_test_case call_once_profile_32
65 1.1.2.2 pgoyette call_once_profile_32_head() {
66 1.1.2.2 pgoyette atf_set "descr" "compile and run 32-bit std::call_once with profiling flag"
67 1.1.2.2 pgoyette atf_set "require.progs" "c++"
68 1.1.2.2 pgoyette }
69 1.1.2.2 pgoyette
70 1.1.2.2 pgoyette atf_test_case call_once_pie
71 1.1.2.2 pgoyette call_once_pie_head() {
72 1.1.2.2 pgoyette atf_set "descr" "compile and run position independent (PIE) std::call_once"
73 1.1.2.2 pgoyette atf_set "require.progs" "c++"
74 1.1.2.2 pgoyette }
75 1.1.2.2 pgoyette
76 1.1.2.2 pgoyette atf_test_case call_once_32
77 1.1.2.2 pgoyette call_once_32_head() {
78 1.1.2.2 pgoyette atf_set "descr" "compile and run std::call_once for/in netbsd32 emulation"
79 1.1.2.2 pgoyette atf_set "require.progs" "c++ file diff cat"
80 1.1.2.2 pgoyette }
81 1.1.2.2 pgoyette
82 1.1.2.2 pgoyette atf_test_case call_once_static
83 1.1.2.2 pgoyette call_once_static_head() {
84 1.1.2.2 pgoyette atf_set "descr" "compile and run std::call_once with static flag"
85 1.1.2.2 pgoyette atf_set "require.progs" "c++"
86 1.1.2.2 pgoyette }
87 1.1.2.2 pgoyette
88 1.1.2.2 pgoyette call_once_body() {
89 1.1.2.2 pgoyette cat > test.cpp << EOF
90 1.1.2.2 pgoyette #include <cstdio>
91 1.1.2.2 pgoyette #include <thread>
92 1.1.2.2 pgoyette #include <mutex>
93 1.1.2.2 pgoyette std::once_flag flag;
94 1.1.2.2 pgoyette int main(void) {
95 1.1.2.2 pgoyette std::call_once(flag, [](){ printf("hello, world!\n"); });
96 1.1.2.2 pgoyette return 0;
97 1.1.2.2 pgoyette }
98 1.1.2.2 pgoyette EOF
99 1.1.2.2 pgoyette atf_check -s exit:0 -o ignore -e ignore c++ -o call_once test.cpp -pthread
100 1.1.2.2 pgoyette atf_check -s exit:0 -o inline:"hello, world!\n" ./call_once
101 1.1.2.2 pgoyette }
102 1.1.2.2 pgoyette
103 1.1.2.2 pgoyette call_once_profile_body() {
104 1.1.2.2 pgoyette atf_expect_fail "profiling option doesn't work now"
105 1.1.2.2 pgoyette cat > test.cpp << EOF
106 1.1.2.2 pgoyette #include <cstdio>
107 1.1.2.2 pgoyette #include <thread>
108 1.1.2.2 pgoyette #include <mutex>
109 1.1.2.2 pgoyette std::once_flag flag;
110 1.1.2.2 pgoyette int main(void) {
111 1.1.2.2 pgoyette std::call_once(flag, [](){ printf("hello, world!\n"); });
112 1.1.2.2 pgoyette return 0;
113 1.1.2.2 pgoyette }
114 1.1.2.2 pgoyette EOF
115 1.1.2.2 pgoyette atf_check -s exit:0 -o ignore -e ignore c++ -pg -o call_once test.cpp -pthread
116 1.1.2.2 pgoyette atf_check -s exit:0 -o inline:"hello, world!\n" ./call_once
117 1.1.2.2 pgoyette }
118 1.1.2.2 pgoyette
119 1.1.2.2 pgoyette call_once_profile_32_body() {
120 1.1.2.2 pgoyette atf_expect_fail "profiling option doesn't work now"
121 1.1.2.2 pgoyette # check whether this arch is 64bit
122 1.1.2.2 pgoyette if ! c++ -dM -E - < /dev/null | fgrep -q _LP64; then
123 1.1.2.2 pgoyette atf_skip "this is not a 64 bit architecture"
124 1.1.2.2 pgoyette fi
125 1.1.2.2 pgoyette if ! c++ -m32 -dM -E - < /dev/null 2>/dev/null > ./def32; then
126 1.1.2.2 pgoyette atf_skip "c++ -m32 not supported on this architecture"
127 1.1.2.2 pgoyette else
128 1.1.2.2 pgoyette if fgrep -q _LP64 ./def32; then
129 1.1.2.2 pgoyette atf_fail "c++ -m32 does not generate netbsd32 binaries"
130 1.1.2.2 pgoyette fi
131 1.1.2.2 pgoyette fi
132 1.1.2.2 pgoyette
133 1.1.2.2 pgoyette cat > test.cpp << EOF
134 1.1.2.2 pgoyette #include <cstdio>
135 1.1.2.2 pgoyette #include <thread>
136 1.1.2.2 pgoyette #include <mutex>
137 1.1.2.2 pgoyette std::once_flag flag;
138 1.1.2.2 pgoyette int main(void) {
139 1.1.2.2 pgoyette std::call_once(flag, [](){ printf("hello, world!\n"); });
140 1.1.2.2 pgoyette return 0;
141 1.1.2.2 pgoyette }
142 1.1.2.2 pgoyette EOF
143 1.1.2.2 pgoyette atf_check -s exit:0 -o ignore -e ignore c++ -m32 -pg -o call_once test.cpp -pthread
144 1.1.2.2 pgoyette atf_check -s exit:0 -o inline:"hello, world!\n" ./call_once
145 1.1.2.2 pgoyette atf_expect_fail "The combination of 32-bit and profiling should be fail"
146 1.1.2.2 pgoyette }
147 1.1.2.2 pgoyette
148 1.1.2.2 pgoyette call_once_pic_body() {
149 1.1.2.2 pgoyette cat > test.cpp << EOF
150 1.1.2.2 pgoyette #include <stdlib.h>
151 1.1.2.2 pgoyette int callpic(void);
152 1.1.2.2 pgoyette int main(void) {callpic();exit(0);}
153 1.1.2.2 pgoyette EOF
154 1.1.2.2 pgoyette cat > pic.cpp << EOF
155 1.1.2.2 pgoyette #include <cstdio>
156 1.1.2.2 pgoyette #include <thread>
157 1.1.2.2 pgoyette #include <mutex>
158 1.1.2.2 pgoyette std::once_flag flag;
159 1.1.2.2 pgoyette int callpic(void) {
160 1.1.2.2 pgoyette std::call_once(flag, [](){ printf("hello, world!\n"); });
161 1.1.2.2 pgoyette return 0;
162 1.1.2.2 pgoyette }
163 1.1.2.2 pgoyette EOF
164 1.1.2.2 pgoyette
165 1.1.2.2 pgoyette atf_check -s exit:0 -o ignore -e ignore \
166 1.1.2.2 pgoyette c++ -fPIC -shared -o libtest.so pic.cpp
167 1.1.2.2 pgoyette atf_check -s exit:0 -o ignore -e ignore \
168 1.1.2.2 pgoyette c++ -o call_once test.cpp -L. -ltest -pthread
169 1.1.2.2 pgoyette
170 1.1.2.2 pgoyette export LD_LIBRARY_PATH=.
171 1.1.2.2 pgoyette atf_check -s exit:0 -o inline:"hello, world!\n" ./call_once
172 1.1.2.2 pgoyette }
173 1.1.2.2 pgoyette
174 1.1.2.2 pgoyette call_once_pic_32_body() {
175 1.1.2.2 pgoyette # check whether this arch is 64bit
176 1.1.2.2 pgoyette if ! c++ -dM -E - < /dev/null | fgrep -q _LP64; then
177 1.1.2.2 pgoyette atf_skip "this is not a 64 bit architecture"
178 1.1.2.2 pgoyette fi
179 1.1.2.2 pgoyette if ! c++ -m32 -dM -E - < /dev/null 2>/dev/null > ./def32; then
180 1.1.2.2 pgoyette atf_skip "c++ -m32 not supported on this architecture"
181 1.1.2.2 pgoyette else
182 1.1.2.2 pgoyette if fgrep -q _LP64 ./def32; then
183 1.1.2.2 pgoyette atf_fail "c++ -m32 does not generate netbsd32 binaries"
184 1.1.2.2 pgoyette fi
185 1.1.2.2 pgoyette fi
186 1.1.2.2 pgoyette
187 1.1.2.2 pgoyette cat > test.cpp << EOF
188 1.1.2.2 pgoyette #include <stdlib.h>
189 1.1.2.2 pgoyette int callpic(void);
190 1.1.2.2 pgoyette int main(void) {callpic();exit(0);}
191 1.1.2.2 pgoyette EOF
192 1.1.2.2 pgoyette cat > pic.cpp << EOF
193 1.1.2.2 pgoyette #include <cstdio>
194 1.1.2.2 pgoyette #include <thread>
195 1.1.2.2 pgoyette #include <mutex>
196 1.1.2.2 pgoyette std::once_flag flag;
197 1.1.2.2 pgoyette int callpic(void) {
198 1.1.2.2 pgoyette std::call_once(flag, [](){ printf("hello, world!\n"); });
199 1.1.2.2 pgoyette return 0;
200 1.1.2.2 pgoyette }
201 1.1.2.2 pgoyette EOF
202 1.1.2.2 pgoyette
203 1.1.2.2 pgoyette atf_check -s exit:0 -o ignore -e ignore \
204 1.1.2.2 pgoyette c++ -m32 -fPIC -shared -o libtest.so pic.cpp
205 1.1.2.2 pgoyette atf_check -s exit:0 -o ignore -e ignore \
206 1.1.2.2 pgoyette c++ -m32 -o call_once test.cpp -L. -ltest -pthread
207 1.1.2.2 pgoyette
208 1.1.2.2 pgoyette export LD_LIBRARY_PATH=.
209 1.1.2.2 pgoyette atf_check -s exit:0 -o inline:"hello, world!\n" ./call_once
210 1.1.2.2 pgoyette }
211 1.1.2.2 pgoyette
212 1.1.2.2 pgoyette call_once_pic_profile_body() {
213 1.1.2.2 pgoyette atf_expect_fail "profiling option doesn't work now"
214 1.1.2.2 pgoyette cat > test.cpp << EOF
215 1.1.2.2 pgoyette #include <stdlib.h>
216 1.1.2.2 pgoyette int callpic(void);
217 1.1.2.2 pgoyette int main(void) {callpic();exit(0);}
218 1.1.2.2 pgoyette EOF
219 1.1.2.2 pgoyette cat > pic.cpp << EOF
220 1.1.2.2 pgoyette #include <cstdio>
221 1.1.2.2 pgoyette #include <thread>
222 1.1.2.2 pgoyette #include <mutex>
223 1.1.2.2 pgoyette std::once_flag flag;
224 1.1.2.2 pgoyette int callpic(void) {
225 1.1.2.2 pgoyette std::call_once(flag, [](){ printf("hello, world!\n"); });
226 1.1.2.2 pgoyette return 0;
227 1.1.2.2 pgoyette }
228 1.1.2.2 pgoyette EOF
229 1.1.2.2 pgoyette
230 1.1.2.2 pgoyette atf_check -s exit:0 -o ignore -e ignore \
231 1.1.2.2 pgoyette c++ -pg -fPIC -shared -o libtest.so pic.cpp
232 1.1.2.2 pgoyette atf_check -s exit:0 -o ignore -e ignore \
233 1.1.2.2 pgoyette c++ -pg -o call_once test.cpp -L. -ltest -pthread
234 1.1.2.2 pgoyette
235 1.1.2.2 pgoyette export LD_LIBRARY_PATH=.
236 1.1.2.2 pgoyette atf_check -s exit:0 -o inline:"hello, world!\n" ./call_once
237 1.1.2.2 pgoyette }
238 1.1.2.2 pgoyette
239 1.1.2.2 pgoyette call_once_pic_profile_32_body() {
240 1.1.2.2 pgoyette atf_expect_fail "profiling option doesn't work now"
241 1.1.2.2 pgoyette # check whether this arch is 64bit
242 1.1.2.2 pgoyette if ! c++ -dM -E - < /dev/null | fgrep -q _LP64; then
243 1.1.2.2 pgoyette atf_skip "this is not a 64 bit architecture"
244 1.1.2.2 pgoyette fi
245 1.1.2.2 pgoyette if ! c++ -m32 -dM -E - < /dev/null 2>/dev/null > ./def32; then
246 1.1.2.2 pgoyette atf_skip "c++ -m32 not supported on this architecture"
247 1.1.2.2 pgoyette else
248 1.1.2.2 pgoyette if fgrep -q _LP64 ./def32; then
249 1.1.2.2 pgoyette atf_fail "c++ -m32 does not generate netbsd32 binaries"
250 1.1.2.2 pgoyette fi
251 1.1.2.2 pgoyette fi
252 1.1.2.2 pgoyette
253 1.1.2.2 pgoyette cat > test.cpp << EOF
254 1.1.2.2 pgoyette #include <stdlib.h>
255 1.1.2.2 pgoyette int callpic(void);
256 1.1.2.2 pgoyette int main(void) {callpic();exit(0);}
257 1.1.2.2 pgoyette EOF
258 1.1.2.2 pgoyette cat > pic.cpp << EOF
259 1.1.2.2 pgoyette #include <cstdio>
260 1.1.2.2 pgoyette #include <thread>
261 1.1.2.2 pgoyette #include <mutex>
262 1.1.2.2 pgoyette std::once_flag flag;
263 1.1.2.2 pgoyette int callpic(void) {
264 1.1.2.2 pgoyette std::call_once(flag, [](){ printf("hello, world!\n"); });
265 1.1.2.2 pgoyette return 0;
266 1.1.2.2 pgoyette }
267 1.1.2.2 pgoyette EOF
268 1.1.2.2 pgoyette
269 1.1.2.2 pgoyette atf_check -s exit:0 -o ignore -e ignore \
270 1.1.2.2 pgoyette c++ -m32 -pg -fPIC -shared -o libtest.so pic.cpp
271 1.1.2.2 pgoyette atf_check -s exit:0 -o ignore -e ignore \
272 1.1.2.2 pgoyette c++ -m32 -pg -o call_once test.cpp -L. -ltest -pthread
273 1.1.2.2 pgoyette
274 1.1.2.2 pgoyette export LD_LIBRARY_PATH=.
275 1.1.2.2 pgoyette atf_check -s exit:0 -o inline:"hello, world!\n" ./call_once
276 1.1.2.2 pgoyette }
277 1.1.2.2 pgoyette
278 1.1.2.2 pgoyette call_once_pie_body() {
279 1.1.2.2 pgoyette # check whether this arch supports -pie
280 1.1.2.2 pgoyette if ! c++ -pie -dM -E - < /dev/null 2>/dev/null >/dev/null; then
281 1.1.2.2 pgoyette atf_skip "c++ -pie not supported on this architecture"
282 1.1.2.2 pgoyette fi
283 1.1.2.2 pgoyette cat > test.cpp << EOF
284 1.1.2.2 pgoyette #include <cstdio>
285 1.1.2.2 pgoyette #include <thread>
286 1.1.2.2 pgoyette #include <mutex>
287 1.1.2.2 pgoyette std::once_flag flag;
288 1.1.2.2 pgoyette int main(void) {
289 1.1.2.2 pgoyette std::call_once(flag, [](){ printf("hello, world!\n"); });
290 1.1.2.2 pgoyette return 0;
291 1.1.2.2 pgoyette }
292 1.1.2.2 pgoyette EOF
293 1.1.2.2 pgoyette atf_check -s exit:0 -o ignore -e ignore c++ -fpie -pie -o call_once test.cpp -pthread
294 1.1.2.2 pgoyette atf_check -s exit:0 -o inline:"hello, world!\n" ./call_once
295 1.1.2.2 pgoyette }
296 1.1.2.2 pgoyette
297 1.1.2.2 pgoyette call_once_32_body() {
298 1.1.2.2 pgoyette # check whether this arch is 64bit
299 1.1.2.2 pgoyette if ! c++ -dM -E - < /dev/null | fgrep -q _LP64; then
300 1.1.2.2 pgoyette atf_skip "this is not a 64 bit architecture"
301 1.1.2.2 pgoyette fi
302 1.1.2.2 pgoyette if ! c++ -m32 -dM -E - < /dev/null 2>/dev/null > ./def32; then
303 1.1.2.2 pgoyette atf_skip "c++ -m32 not supported on this architecture"
304 1.1.2.2 pgoyette else
305 1.1.2.2 pgoyette if fgrep -q _LP64 ./def32; then
306 1.1.2.2 pgoyette atf_fail "c++ -m32 does not generate netbsd32 binaries"
307 1.1.2.2 pgoyette fi
308 1.1.2.2 pgoyette fi
309 1.1.2.2 pgoyette
310 1.1.2.2 pgoyette cat > test.cpp << EOF
311 1.1.2.2 pgoyette #include <cstdio>
312 1.1.2.2 pgoyette #include <thread>
313 1.1.2.2 pgoyette #include <mutex>
314 1.1.2.2 pgoyette std::once_flag flag;
315 1.1.2.2 pgoyette int main(void) {
316 1.1.2.2 pgoyette std::call_once(flag, [](){ printf("hello, world!\n"); });
317 1.1.2.2 pgoyette return 0;
318 1.1.2.2 pgoyette }
319 1.1.2.2 pgoyette EOF
320 1.1.2.2 pgoyette atf_check -s exit:0 -o ignore -e ignore c++ -o call_once_32 -m32 test.cpp -pthread
321 1.1.2.2 pgoyette atf_check -s exit:0 -o ignore -e ignore c++ -o call_once_64 test.cpp -pthread
322 1.1.2.2 pgoyette file -b ./call_once_32 > ./ftype32
323 1.1.2.2 pgoyette file -b ./call_once_64 > ./ftype64
324 1.1.2.2 pgoyette if diff ./ftype32 ./ftype64 >/dev/null; then
325 1.1.2.2 pgoyette atf_fail "generated binaries do not differ"
326 1.1.2.2 pgoyette fi
327 1.1.2.2 pgoyette echo "32bit binaries on this platform are:"
328 1.1.2.2 pgoyette cat ./ftype32
329 1.1.2.2 pgoyette echo "While native (64bit) binaries are:"
330 1.1.2.2 pgoyette cat ./ftype64
331 1.1.2.2 pgoyette atf_check -s exit:0 -o inline:"hello, world!\n" ./call_once_32
332 1.1.2.2 pgoyette
333 1.1.2.2 pgoyette # do another test with static 32bit binaries
334 1.1.2.2 pgoyette cat > test.cpp << EOF
335 1.1.2.2 pgoyette #include <cstdio>
336 1.1.2.2 pgoyette #include <thread>
337 1.1.2.2 pgoyette #include <mutex>
338 1.1.2.2 pgoyette std::once_flag flag;
339 1.1.2.2 pgoyette int main(void) {
340 1.1.2.2 pgoyette std::call_once(flag, [](){ printf("hello, world!\n"); });
341 1.1.2.2 pgoyette return 0;
342 1.1.2.2 pgoyette }
343 1.1.2.2 pgoyette EOF
344 1.1.2.2 pgoyette atf_check -s exit:0 -o ignore -e ignore c++ -o call_once -m32 -pthread \
345 1.1.2.2 pgoyette -static test.cpp
346 1.1.2.2 pgoyette atf_check -s exit:0 -o inline:"hello, world!\n" ./call_once
347 1.1.2.2 pgoyette }
348 1.1.2.2 pgoyette
349 1.1.2.2 pgoyette call_once_static_body() {
350 1.1.2.2 pgoyette cat > test.cpp << EOF
351 1.1.2.2 pgoyette #include <cstdio>
352 1.1.2.2 pgoyette #include <thread>
353 1.1.2.2 pgoyette #include <mutex>
354 1.1.2.2 pgoyette std::once_flag flag;
355 1.1.2.2 pgoyette int main(void) {
356 1.1.2.2 pgoyette std::call_once(flag, [](){ printf("hello, world!\n"); });
357 1.1.2.2 pgoyette return 0;
358 1.1.2.2 pgoyette }
359 1.1.2.2 pgoyette EOF
360 1.1.2.2 pgoyette atf_check -s exit:0 -o ignore -e ignore c++ -static -o call_once test.cpp -pthread
361 1.1.2.2 pgoyette atf_check -s exit:0 -o inline:"hello, world!\n" ./call_once
362 1.1.2.2 pgoyette }
363 1.1.2.2 pgoyette
364 1.1.2.2 pgoyette atf_init_test_cases()
365 1.1.2.2 pgoyette {
366 1.1.2.2 pgoyette
367 1.1.2.2 pgoyette atf_add_test_case call_once
368 1.1.2.2 pgoyette atf_add_test_case call_once_profile
369 1.1.2.2 pgoyette atf_add_test_case call_once_pic
370 1.1.2.2 pgoyette atf_add_test_case call_once_pie
371 1.1.2.2 pgoyette atf_add_test_case call_once_32
372 1.1.2.2 pgoyette atf_add_test_case call_once_static
373 1.1.2.2 pgoyette atf_add_test_case call_once_pic_32
374 1.1.2.2 pgoyette atf_add_test_case call_once_pic_profile
375 1.1.2.2 pgoyette atf_add_test_case call_once_pic_profile_32
376 1.1.2.2 pgoyette atf_add_test_case call_once_profile_32
377 1.1.2.2 pgoyette }
378