t_crt0.sh revision 1.2 1 1.2 joerg # $NetBSD: t_crt0.sh,v 1.2 2010/07/28 13:51:38 joerg Exp $
2 1.1 jmmv #
3 1.1 jmmv # Copyright (c) 2008 The NetBSD Foundation, Inc.
4 1.1 jmmv # All rights reserved.
5 1.1 jmmv #
6 1.1 jmmv # Redistribution and use in source and binary forms, with or without
7 1.1 jmmv # modification, are permitted provided that the following conditions
8 1.1 jmmv # are met:
9 1.1 jmmv # 1. Redistributions of source code must retain the above copyright
10 1.1 jmmv # notice, this list of conditions and the following disclaimer.
11 1.1 jmmv # 2. Redistributions in binary form must reproduce the above copyright
12 1.1 jmmv # notice, this list of conditions and the following disclaimer in the
13 1.1 jmmv # documentation and/or other materials provided with the distribution.
14 1.1 jmmv #
15 1.1 jmmv # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
16 1.1 jmmv # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17 1.1 jmmv # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18 1.1 jmmv # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
19 1.1 jmmv # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 1.1 jmmv # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 1.1 jmmv # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 1.1 jmmv # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 1.1 jmmv # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 1.1 jmmv # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 1.1 jmmv # POSSIBILITY OF SUCH DAMAGE.
26 1.1 jmmv #
27 1.1 jmmv
28 1.2 joerg atf_test_case initfini1
29 1.2 joerg initfini1_head()
30 1.1 jmmv {
31 1.1 jmmv atf_set "descr" "Checks support for init/fini sections"
32 1.1 jmmv atf_set "use.fs" "true"
33 1.1 jmmv }
34 1.2 joerg initfini1_body()
35 1.1 jmmv {
36 1.1 jmmv cat >expout <<EOF
37 1.2 joerg constructor executed
38 1.2 joerg main executed
39 1.2 joerg destructor executed
40 1.1 jmmv EOF
41 1.1 jmmv
42 1.2 joerg atf_check -o file:expout "$(atf_get_srcdir)/h_initfini1"
43 1.2 joerg }
44 1.2 joerg
45 1.2 joerg atf_test_case initfini2
46 1.2 joerg initfini2_head()
47 1.2 joerg {
48 1.2 joerg atf_set "descr" "Checks support for init/fini sections in static binaries"
49 1.2 joerg atf_set "use.fs" "true"
50 1.2 joerg }
51 1.2 joerg initfini2_body()
52 1.2 joerg {
53 1.2 joerg cat >expout <<EOF
54 1.2 joerg constructor executed
55 1.2 joerg main executed
56 1.2 joerg destructor executed
57 1.2 joerg EOF
58 1.2 joerg
59 1.2 joerg atf_check -o file:expout "$(atf_get_srcdir)/h_initfini2"
60 1.2 joerg }
61 1.2 joerg
62 1.2 joerg atf_test_case initfini3
63 1.2 joerg initfini3_head()
64 1.2 joerg {
65 1.2 joerg atf_set "descr" "Checks support for init/fini sections in dlopen"
66 1.2 joerg atf_set "use.fs" "true"
67 1.2 joerg }
68 1.2 joerg initfini3_body()
69 1.2 joerg {
70 1.2 joerg cat >expout <<EOF
71 1.2 joerg constructor executed
72 1.2 joerg main started
73 1.2 joerg constructor2 executed
74 1.2 joerg main after dlopen
75 1.2 joerg destructor2 executed
76 1.2 joerg main terminated
77 1.2 joerg destructor executed
78 1.2 joerg EOF
79 1.2 joerg
80 1.2 joerg atf_check -o file:expout "$(atf_get_srcdir)/h_initfini3"
81 1.1 jmmv }
82 1.1 jmmv
83 1.1 jmmv atf_init_test_cases()
84 1.1 jmmv {
85 1.2 joerg atf_add_test_case initfini1
86 1.2 joerg atf_add_test_case initfini2
87 1.2 joerg atf_add_test_case initfini3
88 1.1 jmmv }
89