Source-Changes-HG archive

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

[src/trunk]: src Merge tests.



details:   https://anonhg.NetBSD.org/src/rev/f839f831abe7
branches:  trunk
changeset: 333720:f839f831abe7
user:      uebayasi <uebayasi%NetBSD.org@localhost>
date:      Sat Nov 15 03:22:29 2014 +0000

description:
Merge tests.

diffstat:

 distrib/sets/lists/tests/mi   |   4 +-
 tests/usr.bin/ld/Makefile     |   5 +-
 tests/usr.bin/ld/t_orphan.sh  |  77 -------------------------------------------
 tests/usr.bin/ld/t_section.sh |  55 ++++++++++++++++++++++++++++++-
 4 files changed, 58 insertions(+), 83 deletions(-)

diffs (193 lines):

diff -r 0cbc02596334 -r f839f831abe7 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Sat Nov 15 03:10:01 2014 +0000
+++ b/distrib/sets/lists/tests/mi       Sat Nov 15 03:22:29 2014 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.599 2014/11/14 16:21:12 uebayasi Exp $
+# $NetBSD: mi,v 1.600 2014/11/15 03:22:29 uebayasi Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -3466,7 +3466,7 @@
 ./usr/tests/usr.bin/ld                         tests-usr.bin-tests
 ./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_orphan                        tests-usr.bin-tests     atf
+./usr/tests/usr.bin/ld/t_orphan                        tests-obsolete  obsolete,atf
 ./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
diff -r 0cbc02596334 -r f839f831abe7 tests/usr.bin/ld/Makefile
--- a/tests/usr.bin/ld/Makefile Sat Nov 15 03:10:01 2014 +0000
+++ b/tests/usr.bin/ld/Makefile Sat Nov 15 03:22:29 2014 +0000
@@ -1,11 +1,10 @@
-# $NetBSD: Makefile,v 1.3 2014/11/14 16:21:12 uebayasi Exp $
+# $NetBSD: Makefile,v 1.4 2014/11/15 03:23:11 uebayasi Exp $
 
 .include <bsd.own.mk>
 
 TESTSDIR=      ${TESTSBASE}/usr.bin/ld
 
-TESTS_SH=      t_orphan \
-               t_script \
+TESTS_SH=      t_script \
                t_section
 
 .include <bsd.test.mk>
diff -r 0cbc02596334 -r f839f831abe7 tests/usr.bin/ld/t_orphan.sh
--- a/tests/usr.bin/ld/t_orphan.sh      Sat Nov 15 03:10:01 2014 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-#      $NetBSD: t_orphan.sh,v 1.2 2014/11/14 16:29:03 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 orphan
-orphan_head() {
-       atf_set "descr" "check orphan section placement"
-       atf_set "require.progs" "cc" "readelf" "grep"
-}
-
-orphan_body() {
-       cat > test.c << EOF
-#include <sys/cdefs.h>
-/* read-only orphan */
-const char a[] __section("hoge") = "hoge";
-/* read-write orphan */
-char b[] __section("fuga") = { 'f', 'u', 'g', 'a', '\0' };
-/* .data */
-int c = 123;
-/* .bss */
-int d = 0;
-/* .text */
-int main(void) { return 0; }
-EOF
-       atf_check -s exit:0 -o ignore -e ignore cc -o test test.c
-       readelf -S test |
-       grep ' \.text\| hoge\| \.data\| fuga\| \.bss' >test.secs
-       {
-               # Read-only orphan sections are placed after well-known
-               # read-only sections (.text, .rodata) but before .data.
-               match ".text" &&
-               match "hoge" &&
-               # Read-write orphan sections are placed after well-known
-               # read-write sections (.data) but before .bss.
-               match ".data" &&
-               match "fuga" &&
-               match ".bss" &&
-               :
-       } < test.secs
-       atf_check test "$?" -eq 0
-}
-
-match() {
-       read line
-       case "$line" in
-       *"$1"*) return 0;
-       esac
-       return 1
-}
-
-atf_init_test_cases()
-{
-       atf_add_test_case orphan
-}
diff -r 0cbc02596334 -r f839f831abe7 tests/usr.bin/ld/t_section.sh
--- a/tests/usr.bin/ld/t_section.sh     Sat Nov 15 03:10:01 2014 +0000
+++ b/tests/usr.bin/ld/t_section.sh     Sat Nov 15 03:22:29 2014 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: t_section.sh,v 1.2 2014/11/14 16:20:42 uebayasi Exp $
+#      $NetBSD: t_section.sh,v 1.3 2014/11/15 03:22:29 uebayasi Exp $
 #
 # Copyright (c) 2014 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -25,6 +25,8 @@
 # POSSIBILITY OF SUCH DAMAGE.
 #
 
+################################################################################
+
 atf_test_case startstop
 startstop_head() {
        atf_set "descr" "check if __start_*/__stop_* symbols are generated"
@@ -41,7 +43,58 @@
        atf_check -s exit:0 -o ignore -e ignore cc -o test test.c
 }
 
+################################################################################
+
+atf_test_case orphan
+orphan_head() {
+       atf_set "descr" "check orphan section placement"
+       atf_set "require.progs" "cc" "readelf" "grep"
+}
+
+orphan_body() {
+       cat > test.c << EOF
+#include <sys/cdefs.h>
+/* read-only orphan */
+const char a[] __section("hoge") = "hoge";
+/* read-write orphan */
+char b[] __section("fuga") = { 'f', 'u', 'g', 'a', '\0' };
+/* .data */
+int c = 123;
+/* .bss */
+int d = 0;
+/* .text */
+int main(void) { return 0; }
+EOF
+       atf_check -s exit:0 -o ignore -e ignore cc -o test test.c
+       readelf -S test |
+       grep ' \.text\| hoge\| \.data\| fuga\| \.bss' >test.secs
+       {
+               # Read-only orphan sections are placed after well-known
+               # read-only sections (.text, .rodata) but before .data.
+               match ".text" &&
+               match "hoge" &&
+               # Read-write orphan sections are placed after well-known
+               # read-write sections (.data) but before .bss.
+               match ".data" &&
+               match "fuga" &&
+               match ".bss" &&
+               :
+       } < test.secs
+       atf_check test "$?" -eq 0
+}
+
+match() {
+       read line
+       case "$line" in
+       *"$1"*) return 0;
+       esac
+       return 1
+}
+
+################################################################################
+
 atf_init_test_cases()
 {
        atf_add_test_case startstop
+       atf_add_test_case orphan
 }



Home | Main Index | Thread Index | Old Index