Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Test __start_xxx/__stop_xxx symbol generation.



details:   https://anonhg.NetBSD.org/src/rev/02bed496030a
branches:  trunk
changeset: 333697:02bed496030a
user:      uebayasi <uebayasi%NetBSD.org@localhost>
date:      Fri Nov 14 13:30:48 2014 +0000

description:
Test __start_xxx/__stop_xxx symbol generation.

diffstat:

 distrib/sets/lists/tests/mi   |   3 +-
 tests/usr.bin/ld/Makefile     |   5 ++-
 tests/usr.bin/ld/t_section.sh |  48 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 53 insertions(+), 3 deletions(-)

diffs (85 lines):

diff -r ff8ef919321e -r 02bed496030a distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Fri Nov 14 12:02:20 2014 +0000
+++ b/distrib/sets/lists/tests/mi       Fri Nov 14 13:30:48 2014 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.597 2014/11/14 09:03:39 uebayasi Exp $
+# $NetBSD: mi,v 1.598 2014/11/14 13:30:48 uebayasi Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -3467,6 +3467,7 @@
 ./usr/tests/usr.bin/ld/Atffile                 tests-usr.bin-tests     atf
 ./usr/tests/usr.bin/ld/Kyuafile                        tests-usr.bin-tests     atf,kyua
 ./usr/tests/usr.bin/ld/t_script                        tests-usr.bin-tests     atf
+./usr/tests/usr.bin/ld/t_section               tests-usr.bin-tests     atf
 ./usr/tests/usr.bin/m4                         tests-usr.bin-tests
 ./usr/tests/usr.bin/m4/Atffile                 tests-usr.bin-tests     atf
 ./usr/tests/usr.bin/m4/Kyuafile                        tests-usr.bin-tests     atf,kyua
diff -r ff8ef919321e -r 02bed496030a tests/usr.bin/ld/Makefile
--- a/tests/usr.bin/ld/Makefile Fri Nov 14 12:02:20 2014 +0000
+++ b/tests/usr.bin/ld/Makefile Fri Nov 14 13:30:48 2014 +0000
@@ -1,9 +1,10 @@
-# $NetBSD: Makefile,v 1.1 2014/11/14 09:03:39 uebayasi Exp $
+# $NetBSD: Makefile,v 1.2 2014/11/14 13:30:48 uebayasi Exp $
 
 .include <bsd.own.mk>
 
 TESTSDIR=      ${TESTSBASE}/usr.bin/ld
 
-TESTS_SH=      t_script
+TESTS_SH=      t_script \
+               t_section
 
 .include <bsd.test.mk>
diff -r ff8ef919321e -r 02bed496030a tests/usr.bin/ld/t_section.sh
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/ld/t_section.sh     Fri Nov 14 13:30:48 2014 +0000
@@ -0,0 +1,48 @@
+#      $NetBSD: t_section.sh,v 1.1 2014/11/14 13:30:48 uebayasi Exp $
+#
+# Copyright (c) 2014 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+atf_test_case startstop
+startstop_head() {
+       atf_set "descr" "check if __start_*/__stop_* symbols are generated"
+       atf_set "require.progs" "cc"
+}
+
+startstop_body() {
+       cat > test.c << EOF
+#include <sys/cdefs.h>
+int i __section("hoge");
+extern int __start_hoge[], __stop_hoge[];
+int main = __start_hoge[0] + __stop_hoge[0];
+EOF
+       atf_check -s exit:0 -o ignore -e ignore cc -o test test.c
+}
+
+atf_init_test_cases()
+{
+
+       atf_add_test_case startstop
+}



Home | Main Index | Thread Index | Old Index