Module Name: src
Committed By: uebayasi
Date: Sat Nov 15 03:22:29 UTC 2014
Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/usr.bin/ld: t_section.sh
Removed Files:
src/tests/usr.bin/ld: t_orphan.sh
Log Message:
Merge tests.
To generate a diff of this commit:
cvs rdiff -u -r1.599 -r1.600 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.2 -r0 src/tests/usr.bin/ld/t_orphan.sh
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/ld/t_section.sh
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.599 src/distrib/sets/lists/tests/mi:1.600
--- src/distrib/sets/lists/tests/mi:1.599 Fri Nov 14 16:21:12 2014
+++ src/distrib/sets/lists/tests/mi Sat Nov 15 03:22:29 2014
@@ -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
Index: src/tests/usr.bin/ld/t_section.sh
diff -u src/tests/usr.bin/ld/t_section.sh:1.2 src/tests/usr.bin/ld/t_section.sh:1.3
--- src/tests/usr.bin/ld/t_section.sh:1.2 Fri Nov 14 16:20:42 2014
+++ src/tests/usr.bin/ld/t_section.sh Sat Nov 15 03:22:29 2014
@@ -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 @@ EOF
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
}