CVS commit: src/tests/usr.bin/cc
Module Name:src Committed By: mrg Date: Sat Feb 9 02:36:28 UTC 2019 Modified Files: src/tests/usr.bin/cc: t_hello.sh Log Message: fix hello_profile's hello_profile_head function name. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/cc/t_hello.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/usr.bin/cc/t_hello.sh diff -u src/tests/usr.bin/cc/t_hello.sh:1.7 src/tests/usr.bin/cc/t_hello.sh:1.8 --- src/tests/usr.bin/cc/t_hello.sh:1.7 Mon Sep 3 21:54:57 2018 +++ src/tests/usr.bin/cc/t_hello.sh Sat Feb 9 02:36:28 2019 @@ -1,4 +1,4 @@ -# $NetBSD: t_hello.sh,v 1.7 2018/09/03 21:54:57 maya Exp $ +# $NetBSD: t_hello.sh,v 1.8 2019/02/09 02:36:28 mrg Exp $ # # Copyright (c) 2011 The NetBSD Foundation, Inc. # All rights reserved. @@ -32,7 +32,7 @@ hello_head() { } atf_test_case hello_profile -hello_head() { +hello_profile_head() { atf_set "descr" "compile and run \"hello world\" with profiling option" atf_set "require.progs" "cc" }
CVS commit: src/tests/usr.bin/cc
Module Name:src Committed By: mrg Date: Sat Feb 9 02:36:28 UTC 2019 Modified Files: src/tests/usr.bin/cc: t_hello.sh Log Message: fix hello_profile's hello_profile_head function name. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/cc/t_hello.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/usr.bin/cc
Module Name:src Committed By: mrg Date: Sat Feb 9 00:13:19 UTC 2019 Modified Files: src/tests/usr.bin/cc: t_ubsan_int_add_overflow.sh t_ubsan_int_divzero.sh t_ubsan_int_neg_overflow.sh t_ubsan_int_sub_overflow.sh t_ubsan_vla_out_of_bounds.sh Log Message: add $NetBSD$ tags. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/cc/t_ubsan_int_add_overflow.sh \ src/tests/usr.bin/cc/t_ubsan_int_divzero.sh \ src/tests/usr.bin/cc/t_ubsan_int_neg_overflow.sh \ src/tests/usr.bin/cc/t_ubsan_int_sub_overflow.sh cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/cc/t_ubsan_vla_out_of_bounds.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/usr.bin/cc
Module Name:src Committed By: mrg Date: Sat Feb 9 00:12:14 UTC 2019 Modified Files: src/tests/usr.bin/cc: Makefile Added Files: src/tests/usr.bin/cc: t_libgomp.sh Log Message: add very simple test that you can link -fopenmp. currently fails, but should work soon... To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/cc/Makefile cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/cc/t_libgomp.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/usr.bin/cc/Makefile diff -u src/tests/usr.bin/cc/Makefile:1.6 src/tests/usr.bin/cc/Makefile:1.7 --- src/tests/usr.bin/cc/Makefile:1.6 Tue Jan 29 19:59:10 2019 +++ src/tests/usr.bin/cc/Makefile Sat Feb 9 00:12:14 2019 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.6 2019/01/29 19:59:10 mgorny Exp $ +# $NetBSD: Makefile,v 1.7 2019/02/09 00:12:14 mrg Exp $ .include @@ -23,6 +23,7 @@ TESTS_SH= # TESTS_SH+= $(ASAN_TESTS) TESTS_SH+= $(UBSAN_TESTS) TESTS_SH+= t_hello +TESTS_SH+= t_libgomp .for test in ${ASAN_TESTS} TESTS_SH_SRC_${test}= asan_common.subr ${test}.sh Added files: Index: src/tests/usr.bin/cc/t_libgomp.sh diff -u /dev/null src/tests/usr.bin/cc/t_libgomp.sh:1.1 --- /dev/null Sat Feb 9 00:12:14 2019 +++ src/tests/usr.bin/cc/t_libgomp.sh Sat Feb 9 00:12:14 2019 @@ -0,0 +1,50 @@ +# $NetBSD: t_libgomp.sh,v 1.1 2019/02/09 00:12:14 mrg Exp $ +# +# Copyright (c) 2019 Matthew R. Green +# 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. +# 3. The name of the author may not be used to endorse or promote products +#derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 libgomp +libgomp_head() { + atf_set "descr" "compile and hello world with -fopenmp" + atf_set "require.progs" "cc" +} + +libgomp_body() { + cat > hello.c << EOF +#include +#include +int main(void) {printf("hello world\n");exit(0);} +EOF + atf_check -s exit:0 -o ignore -e ignore cc -fopenmp -o hellogomp hello.c + atf_check -s exit:0 -o inline:"hello world\n" ./hellogomp +} + +atf_init_test_cases() +{ + + atf_add_test_case libgomp +}
CVS commit: src/tests/usr.bin/cc
Module Name:src Committed By: mrg Date: Sat Feb 9 00:13:19 UTC 2019 Modified Files: src/tests/usr.bin/cc: t_ubsan_int_add_overflow.sh t_ubsan_int_divzero.sh t_ubsan_int_neg_overflow.sh t_ubsan_int_sub_overflow.sh t_ubsan_vla_out_of_bounds.sh Log Message: add $NetBSD$ tags. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/cc/t_ubsan_int_add_overflow.sh \ src/tests/usr.bin/cc/t_ubsan_int_divzero.sh \ src/tests/usr.bin/cc/t_ubsan_int_neg_overflow.sh \ src/tests/usr.bin/cc/t_ubsan_int_sub_overflow.sh cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/cc/t_ubsan_vla_out_of_bounds.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/usr.bin/cc/t_ubsan_int_add_overflow.sh diff -u src/tests/usr.bin/cc/t_ubsan_int_add_overflow.sh:1.4 src/tests/usr.bin/cc/t_ubsan_int_add_overflow.sh:1.5 --- src/tests/usr.bin/cc/t_ubsan_int_add_overflow.sh:1.4 Tue Jan 29 19:59:10 2019 +++ src/tests/usr.bin/cc/t_ubsan_int_add_overflow.sh Sat Feb 9 00:13:19 2019 @@ -1,3 +1,5 @@ +# $NetBSD: t_ubsan_int_add_overflow.sh,v 1.5 2019/02/09 00:13:19 mrg Exp $ +# # Copyright (c) 2018, 2019 The NetBSD Foundation, Inc. # All rights reserved. # Index: src/tests/usr.bin/cc/t_ubsan_int_divzero.sh diff -u src/tests/usr.bin/cc/t_ubsan_int_divzero.sh:1.4 src/tests/usr.bin/cc/t_ubsan_int_divzero.sh:1.5 --- src/tests/usr.bin/cc/t_ubsan_int_divzero.sh:1.4 Tue Jan 29 19:59:10 2019 +++ src/tests/usr.bin/cc/t_ubsan_int_divzero.sh Sat Feb 9 00:13:19 2019 @@ -1,3 +1,5 @@ +# $NetBSD: t_ubsan_int_divzero.sh,v 1.5 2019/02/09 00:13:19 mrg Exp $ +# # Copyright (c) 2018, 2019 The NetBSD Foundation, Inc. # All rights reserved. # Index: src/tests/usr.bin/cc/t_ubsan_int_neg_overflow.sh diff -u src/tests/usr.bin/cc/t_ubsan_int_neg_overflow.sh:1.4 src/tests/usr.bin/cc/t_ubsan_int_neg_overflow.sh:1.5 --- src/tests/usr.bin/cc/t_ubsan_int_neg_overflow.sh:1.4 Tue Jan 29 19:59:10 2019 +++ src/tests/usr.bin/cc/t_ubsan_int_neg_overflow.sh Sat Feb 9 00:13:19 2019 @@ -1,3 +1,5 @@ +# $NetBSD: t_ubsan_int_neg_overflow.sh,v 1.5 2019/02/09 00:13:19 mrg Exp $ +# # Copyright (c) 2018, 2019 The NetBSD Foundation, Inc. # All rights reserved. # Index: src/tests/usr.bin/cc/t_ubsan_int_sub_overflow.sh diff -u src/tests/usr.bin/cc/t_ubsan_int_sub_overflow.sh:1.4 src/tests/usr.bin/cc/t_ubsan_int_sub_overflow.sh:1.5 --- src/tests/usr.bin/cc/t_ubsan_int_sub_overflow.sh:1.4 Tue Jan 29 19:59:10 2019 +++ src/tests/usr.bin/cc/t_ubsan_int_sub_overflow.sh Sat Feb 9 00:13:19 2019 @@ -1,3 +1,5 @@ +# $NetBSD: t_ubsan_int_sub_overflow.sh,v 1.5 2019/02/09 00:13:19 mrg Exp $ +# # Copyright (c) 2018, 2019 The NetBSD Foundation, Inc. # All rights reserved. # Index: src/tests/usr.bin/cc/t_ubsan_vla_out_of_bounds.sh diff -u src/tests/usr.bin/cc/t_ubsan_vla_out_of_bounds.sh:1.5 src/tests/usr.bin/cc/t_ubsan_vla_out_of_bounds.sh:1.6 --- src/tests/usr.bin/cc/t_ubsan_vla_out_of_bounds.sh:1.5 Tue Jan 29 19:59:10 2019 +++ src/tests/usr.bin/cc/t_ubsan_vla_out_of_bounds.sh Sat Feb 9 00:13:19 2019 @@ -1,3 +1,5 @@ +# $NetBSD: t_ubsan_vla_out_of_bounds.sh,v 1.6 2019/02/09 00:13:19 mrg Exp $ +# # Copyright (c) 2018, 2019 The NetBSD Foundation, Inc. # All rights reserved. #
CVS commit: src/tests/usr.bin/cc
Module Name:src Committed By: mrg Date: Sat Feb 9 00:12:14 UTC 2019 Modified Files: src/tests/usr.bin/cc: Makefile Added Files: src/tests/usr.bin/cc: t_libgomp.sh Log Message: add very simple test that you can link -fopenmp. currently fails, but should work soon... To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/cc/Makefile cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/cc/t_libgomp.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/usr.bin/cc
Module Name:src Committed By: mgorny Date: Tue Jan 29 19:59:10 UTC 2019 Modified Files: src/tests/usr.bin/cc: Makefile t_ubsan_int_add_overflow.sh t_ubsan_int_divzero.sh t_ubsan_int_neg_overflow.sh t_ubsan_int_sub_overflow.sh t_ubsan_vla_out_of_bounds.sh Added Files: src/tests/usr.bin/cc: ubsan_common.subr Log Message: Move common UBSAN test case code into ubsan_common.subr Reviewed by To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/cc/Makefile cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/cc/t_ubsan_int_add_overflow.sh \ src/tests/usr.bin/cc/t_ubsan_int_divzero.sh \ src/tests/usr.bin/cc/t_ubsan_int_neg_overflow.sh \ src/tests/usr.bin/cc/t_ubsan_int_sub_overflow.sh cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/cc/t_ubsan_vla_out_of_bounds.sh cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/cc/ubsan_common.subr Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/usr.bin/cc/Makefile diff -u src/tests/usr.bin/cc/Makefile:1.5 src/tests/usr.bin/cc/Makefile:1.6 --- src/tests/usr.bin/cc/Makefile:1.5 Tue Jan 29 19:56:37 2019 +++ src/tests/usr.bin/cc/Makefile Tue Jan 29 19:59:10 2019 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.5 2019/01/29 19:56:37 mgorny Exp $ +# $NetBSD: Makefile,v 1.6 2019/01/29 19:59:10 mgorny Exp $ .include @@ -12,17 +12,23 @@ ASAN_TESTS+= t_asan_off_by_one ASAN_TESTS+= t_asan_poison ASAN_TESTS+= t_asan_uaf +UBSAN_TESTS= # +UBSAN_TESTS+= t_ubsan_int_add_overflow +UBSAN_TESTS+= t_ubsan_int_neg_overflow +UBSAN_TESTS+= t_ubsan_vla_out_of_bounds +UBSAN_TESTS+= t_ubsan_int_sub_overflow +UBSAN_TESTS+= t_ubsan_int_divzero + TESTS_SH= # TESTS_SH+= $(ASAN_TESTS) -TESTS_SH+= t_ubsan_int_add_overflow -TESTS_SH+= t_ubsan_int_sub_overflow -TESTS_SH+= t_ubsan_int_neg_overflow -TESTS_SH+= t_ubsan_int_divzero -TESTS_SH+= t_ubsan_vla_out_of_bounds +TESTS_SH+= $(UBSAN_TESTS) TESTS_SH+= t_hello .for test in ${ASAN_TESTS} TESTS_SH_SRC_${test}= asan_common.subr ${test}.sh .endfor +.for test in ${UBSAN_TESTS} +TESTS_SH_SRC_${test}= ubsan_common.subr ${test}.sh +.endfor .include Index: src/tests/usr.bin/cc/t_ubsan_int_add_overflow.sh diff -u src/tests/usr.bin/cc/t_ubsan_int_add_overflow.sh:1.3 src/tests/usr.bin/cc/t_ubsan_int_add_overflow.sh:1.4 --- src/tests/usr.bin/cc/t_ubsan_int_add_overflow.sh:1.3 Mon Jul 16 07:25:58 2018 +++ src/tests/usr.bin/cc/t_ubsan_int_add_overflow.sh Tue Jan 29 19:59:10 2019 @@ -1,4 +1,4 @@ -# Copyright (c) 2018 The NetBSD Foundation, Inc. +# Copyright (c) 2018, 2019 The NetBSD Foundation, Inc. # All rights reserved. # # This code is derived from software contributed to The NetBSD Foundation @@ -26,172 +26,23 @@ # POSSIBILITY OF SUCH DAMAGE. # -test_target() -{ - SUPPORT='n' - if ! echo __GNUC__ | cc -E - | grep -q __GNUC__; then - SUPPORT='y' - fi - - if ! echo __clang__ | cc -E - | grep -q __clang__; then - SUPPORT='y' - fi -} - -atf_test_case int_add_overflow -int_add_overflow_head() { - atf_set "descr" "Test Undefined Behavior for int addition overflows" - atf_set "require.progs" "cc" -} - -atf_test_case int_add_overflow_profile -int_add_overflow_profile_head() { - atf_set "descr" "Test Undefined Behavior for int addition overflows with profiling option" - atf_set "require.progs" "cc" -} -atf_test_case int_add_overflow_pic -int_add_overflow_pic_head() { - atf_set "descr" "Test Undefined Behavior for int addition overflows with position independent code (PIC) flag" - atf_set "require.progs" "cc" -} -atf_test_case int_add_overflow_pie -int_add_overflow_pie_head() { - atf_set "descr" "Test Undefined Behavior for int addition overflows with position independent execution (PIE) flag" - atf_set "require.progs" "cc" -} -atf_test_case int_add_overflow32 -int_add_overflow32_head() { - atf_set "descr" "Test Undefined Behavior for int addition overflows in NetBSD_32 emulation" - atf_set "require.progs" "cc file diff cat" -} - - -int_add_overflow_body(){ - cat > test.c << EOF -#include -#include -#include -int main(int argc, char **argv) {volatile int l = INT_MAX; l+=argc; return l;} -EOF - - cc -fsanitize=undefined -o test test.c - atf_check -e match:"signed integer overflow" ./test -} - -int_add_overflow_profile_body(){ - cat > test.c << EOF +UBSAN_CODE=' #include #include #include -int main(int argc, char **argv) {volatile int l = INT_MAX; l+=argc; return l;} -EOF - - cc -fsanitize=undefined -o test -pg test.c - atf_check -e match:"signed integer overflow" ./test -} - -int_add_overflow_pic_body(){ - cat > test.c << EOF -#include -#include int help(int); -int main(int argc, char **argv) {volatile int k = help(argc); return k;} -EOF - - cat > pic.c << EOF -#include -#include -#include +#ifndef PIC_MAIN int help(int count) {volatile int l = INT_MAX; l+= count; return l;} -EOF - - cc -fsanitize=undefined -fPIC -shared -o libtest.so pic.c - cc -o test test.c
CVS commit: src/tests/usr.bin/cc
Module Name:src Committed By: mgorny Date: Tue Jan 29 19:59:10 UTC 2019 Modified Files: src/tests/usr.bin/cc: Makefile t_ubsan_int_add_overflow.sh t_ubsan_int_divzero.sh t_ubsan_int_neg_overflow.sh t_ubsan_int_sub_overflow.sh t_ubsan_vla_out_of_bounds.sh Added Files: src/tests/usr.bin/cc: ubsan_common.subr Log Message: Move common UBSAN test case code into ubsan_common.subr Reviewed by To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/cc/Makefile cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/cc/t_ubsan_int_add_overflow.sh \ src/tests/usr.bin/cc/t_ubsan_int_divzero.sh \ src/tests/usr.bin/cc/t_ubsan_int_neg_overflow.sh \ src/tests/usr.bin/cc/t_ubsan_int_sub_overflow.sh cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/cc/t_ubsan_vla_out_of_bounds.sh cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/cc/ubsan_common.subr Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/usr.bin/cc
Module Name:src Committed By: mgorny Date: Tue Jan 29 19:56:38 UTC 2019 Modified Files: src/tests/usr.bin/cc: Makefile t_asan_double_free.sh t_asan_global_buffer_overflow.sh t_asan_heap_overflow.sh t_asan_off_by_one.sh t_asan_poison.sh t_asan_uaf.sh Added Files: src/tests/usr.bin/cc: asan_common.subr Log Message: Move common ASAN test case code into asan_common.subr Reviewed by To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/cc/Makefile cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/cc/asan_common.subr cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/cc/t_asan_double_free.sh \ src/tests/usr.bin/cc/t_asan_global_buffer_overflow.sh \ src/tests/usr.bin/cc/t_asan_heap_overflow.sh \ src/tests/usr.bin/cc/t_asan_off_by_one.sh \ src/tests/usr.bin/cc/t_asan_poison.sh src/tests/usr.bin/cc/t_asan_uaf.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/usr.bin/cc/Makefile diff -u src/tests/usr.bin/cc/Makefile:1.4 src/tests/usr.bin/cc/Makefile:1.5 --- src/tests/usr.bin/cc/Makefile:1.4 Wed May 2 18:46:05 2018 +++ src/tests/usr.bin/cc/Makefile Tue Jan 29 19:56:37 2019 @@ -1,16 +1,19 @@ -# $NetBSD: Makefile,v 1.4 2018/05/02 18:46:05 kamil Exp $ +# $NetBSD: Makefile,v 1.5 2019/01/29 19:56:37 mgorny Exp $ .include TESTSDIR= ${TESTSBASE}/usr.bin/cc +ASAN_TESTS= # +ASAN_TESTS+= t_asan_double_free +ASAN_TESTS+= t_asan_global_buffer_overflow +ASAN_TESTS+= t_asan_heap_overflow +ASAN_TESTS+= t_asan_off_by_one +ASAN_TESTS+= t_asan_poison +ASAN_TESTS+= t_asan_uaf + TESTS_SH= # -TESTS_SH+= t_asan_double_free -TESTS_SH+= t_asan_global_buffer_overflow -TESTS_SH+= t_asan_heap_overflow -TESTS_SH+= t_asan_off_by_one -TESTS_SH+= t_asan_poison -TESTS_SH+= t_asan_uaf +TESTS_SH+= $(ASAN_TESTS) TESTS_SH+= t_ubsan_int_add_overflow TESTS_SH+= t_ubsan_int_sub_overflow TESTS_SH+= t_ubsan_int_neg_overflow @@ -18,4 +21,8 @@ TESTS_SH+= t_ubsan_int_divzero TESTS_SH+= t_ubsan_vla_out_of_bounds TESTS_SH+= t_hello +.for test in ${ASAN_TESTS} +TESTS_SH_SRC_${test}= asan_common.subr ${test}.sh +.endfor + .include Index: src/tests/usr.bin/cc/t_asan_double_free.sh diff -u src/tests/usr.bin/cc/t_asan_double_free.sh:1.2 src/tests/usr.bin/cc/t_asan_double_free.sh:1.3 --- src/tests/usr.bin/cc/t_asan_double_free.sh:1.2 Mon Jul 16 07:25:58 2018 +++ src/tests/usr.bin/cc/t_asan_double_free.sh Tue Jan 29 19:56:37 2019 @@ -1,6 +1,6 @@ -# $NetBSD: t_asan_double_free.sh,v 1.2 2018/07/16 07:25:58 kamil Exp $ +# $NetBSD: t_asan_double_free.sh,v 1.3 2019/01/29 19:56:37 mgorny Exp $ # -# Copyright (c) 2018 The NetBSD Foundation, Inc. +# Copyright (c) 2018, 2019 The NetBSD Foundation, Inc. # All rights reserved. # # This code is derived from software contributed to The NetBSD Foundation @@ -28,184 +28,22 @@ # POSSIBILITY OF SUCH DAMAGE. # -SUPPORT='n' -test_target() { - if uname -m | grep -q "amd64"; then - SUPPORT='y' - fi - - if uname -m | grep -q "i386"; then - SUPPORT='y' - fi -} - -atf_test_case double_free -double_free_head() { - atf_set "descr" "compile and run \"Double Free example\"" - atf_set "require.progs" "cc paxctl" -} - -atf_test_case double_free_profile -double_free_profile_head() { - atf_set "descr" "compile and run \"Double Free example\" with profiling option" - atf_set "require.progs" "cc paxctl" -} - -atf_test_case double_free_pic -double_free_pic_head() { - atf_set "descr" "compile and run PIC \"Double Free example\"" - atf_set "require.progs" "cc paxctl" -} - -atf_test_case double_free_pie -double_free_pie_head() { - atf_set "descr" "compile and run position independent (PIE) \"Double Free example\"" - atf_set "require.progs" "cc paxctl" -} - -atf_test_case double_free32 -double_free32_head() { - atf_set "descr" "compile and run \"Double Free example\" for/in netbsd32 emulation" - atf_set "require.progs" "cc paxctl file diff cat" -} - -atf_test_case target_not_supported -target_not_supported_head() -{ - atf_set "descr" "Test forced skip" -} - -double_free_body() { - cat > test.c << EOF -#include -#include -#include -void foo(int index) { char *x = (char*)malloc(10 * sizeof(char)); memset(x, 0, 10); free(x); free(x - index); } -int main(int argc, char **argv) { foo(argc - 1); printf("CHECK\n"); exit(0); } -EOF - cc -fsanitize=address -o test test.c - paxctl +a test - atf_check -s not-exit:0 -o not-match:"CHECK\n" -e match:"double-free" ./test -} - -double_free_profile_body() { - cat > test.c << EOF -#include -#include -#include -void foo(int index) { char *x = (char*)malloc(10 * sizeof(char)); memset(x, 0, 10); free(x); free(x - index); } -int main(int argc, char **argv) { foo(argc - 1); printf("CHECK\n"); exit(0); } -EOF - cc -fsanitize=address -o test -pg test.c - paxctl +a test - atf_check -s not-exit:0 -o not-match:"CHECK\n" -e match:"double-free" ./test -} - -double_free_pic_body() { - cat > test.c << EOF -#include
CVS commit: src/tests/usr.bin/cc
Module Name:src Committed By: mgorny Date: Tue Jan 29 19:56:38 UTC 2019 Modified Files: src/tests/usr.bin/cc: Makefile t_asan_double_free.sh t_asan_global_buffer_overflow.sh t_asan_heap_overflow.sh t_asan_off_by_one.sh t_asan_poison.sh t_asan_uaf.sh Added Files: src/tests/usr.bin/cc: asan_common.subr Log Message: Move common ASAN test case code into asan_common.subr Reviewed by To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/cc/Makefile cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/cc/asan_common.subr cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/cc/t_asan_double_free.sh \ src/tests/usr.bin/cc/t_asan_global_buffer_overflow.sh \ src/tests/usr.bin/cc/t_asan_heap_overflow.sh \ src/tests/usr.bin/cc/t_asan_off_by_one.sh \ src/tests/usr.bin/cc/t_asan_poison.sh src/tests/usr.bin/cc/t_asan_uaf.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/usr.bin/cc
Module Name:src Committed By: maya Date: Mon Sep 3 21:54:57 UTC 2018 Modified Files: src/tests/usr.bin/cc: t_hello.sh Log Message: amend test case to also check for -fprofile-generate (clang also supports this flag) PR toolchain/53567 To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/cc/t_hello.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/usr.bin/cc
Module Name:src Committed By: maya Date: Mon Sep 3 21:54:57 UTC 2018 Modified Files: src/tests/usr.bin/cc: t_hello.sh Log Message: amend test case to also check for -fprofile-generate (clang also supports this flag) PR toolchain/53567 To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/tests/usr.bin/cc/t_hello.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/usr.bin/cc/t_hello.sh diff -u src/tests/usr.bin/cc/t_hello.sh:1.6 src/tests/usr.bin/cc/t_hello.sh:1.7 --- src/tests/usr.bin/cc/t_hello.sh:1.6 Wed May 31 11:08:35 2017 +++ src/tests/usr.bin/cc/t_hello.sh Mon Sep 3 21:54:57 2018 @@ -1,4 +1,4 @@ -# $NetBSD: t_hello.sh,v 1.6 2017/05/31 11:08:35 martin Exp $ +# $NetBSD: t_hello.sh,v 1.7 2018/09/03 21:54:57 maya Exp $ # # Copyright (c) 2011 The NetBSD Foundation, Inc. # All rights reserved. @@ -73,6 +73,8 @@ int main(void) {printf("hello world\n"); EOF atf_check -s exit:0 -o ignore -e ignore cc -o hello -pg test.c atf_check -s exit:0 -o inline:"hello world\n" ./hello + atf_check -s exit:0 -o ignore -e ignore cc -o hello2 -fprofile-generate test.c + atf_check -s exit:0 -o inline:"hello world\n" ./hello2 } hello_pic_body() {
CVS commit: src/tests/usr.bin/cc
Module Name:src Committed By: kamil Date: Mon Jul 16 07:25:58 UTC 2018 Modified Files: src/tests/usr.bin/cc: t_asan_double_free.sh t_asan_global_buffer_overflow.sh t_asan_heap_overflow.sh t_asan_off_by_one.sh t_asan_poison.sh t_asan_uaf.sh t_ubsan_int_add_overflow.sh t_ubsan_int_divzero.sh t_ubsan_int_neg_overflow.sh t_ubsan_int_sub_overflow.sh t_ubsan_vla_out_of_bounds.sh Log Message: Disable profile and compat 32-bit tests cc sanitizer tests These tests are known to be faulty. These fatures aren't ready. They tend to break to unrelated changes to the codebase and require. Base Clang and GCC are in general dated to use with sanitizers as these features are being fixed on HEAD versions of both compilers (mostly Clang). To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/cc/t_asan_double_free.sh \ src/tests/usr.bin/cc/t_asan_global_buffer_overflow.sh \ src/tests/usr.bin/cc/t_asan_heap_overflow.sh \ src/tests/usr.bin/cc/t_asan_off_by_one.sh \ src/tests/usr.bin/cc/t_asan_poison.sh src/tests/usr.bin/cc/t_asan_uaf.sh cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/cc/t_ubsan_int_add_overflow.sh \ src/tests/usr.bin/cc/t_ubsan_int_divzero.sh \ src/tests/usr.bin/cc/t_ubsan_int_neg_overflow.sh \ src/tests/usr.bin/cc/t_ubsan_int_sub_overflow.sh cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/cc/t_ubsan_vla_out_of_bounds.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/usr.bin/cc/t_asan_double_free.sh diff -u src/tests/usr.bin/cc/t_asan_double_free.sh:1.1 src/tests/usr.bin/cc/t_asan_double_free.sh:1.2 --- src/tests/usr.bin/cc/t_asan_double_free.sh:1.1 Wed Apr 4 23:51:35 2018 +++ src/tests/usr.bin/cc/t_asan_double_free.sh Mon Jul 16 07:25:58 2018 @@ -1,4 +1,4 @@ -# $NetBSD: t_asan_double_free.sh,v 1.1 2018/04/04 23:51:35 kamil Exp $ +# $NetBSD: t_asan_double_free.sh,v 1.2 2018/07/16 07:25:58 kamil Exp $ # # Copyright (c) 2018 The NetBSD Foundation, Inc. # All rights reserved. @@ -201,10 +201,10 @@ atf_init_test_cases() } atf_add_test_case double_free - atf_add_test_case double_free_profile +# atf_add_test_case double_free_profile atf_add_test_case double_free_pic atf_add_test_case double_free_pie - atf_add_test_case double_free32 +# atf_add_test_case double_free32 # static option not supported # -static and -fsanitize=address can't be used together for compilation # (gcc version 5.4.0 and clang 7.1) tested on April 2nd 2018. Index: src/tests/usr.bin/cc/t_asan_global_buffer_overflow.sh diff -u src/tests/usr.bin/cc/t_asan_global_buffer_overflow.sh:1.1 src/tests/usr.bin/cc/t_asan_global_buffer_overflow.sh:1.2 --- src/tests/usr.bin/cc/t_asan_global_buffer_overflow.sh:1.1 Wed Apr 4 23:51:35 2018 +++ src/tests/usr.bin/cc/t_asan_global_buffer_overflow.sh Mon Jul 16 07:25:58 2018 @@ -1,4 +1,4 @@ -# $NetBSD: t_asan_global_buffer_overflow.sh,v 1.1 2018/04/04 23:51:35 kamil Exp $ +# $NetBSD: t_asan_global_buffer_overflow.sh,v 1.2 2018/07/16 07:25:58 kamil Exp $ # # Copyright (c) 2018 The NetBSD Foundation, Inc. # All rights reserved. @@ -201,10 +201,10 @@ atf_init_test_cases() } atf_add_test_case global_buffer_overflow - atf_add_test_case global_buffer_overflow_profile +# atf_add_test_case global_buffer_overflow_profile atf_add_test_case global_buffer_overflow_pic atf_add_test_case global_buffer_overflow_pie - atf_add_test_case global_buffer_overflow32 +# atf_add_test_case global_buffer_overflow32 # static option not supported # -static and -fsanitize=address can't be used together for compilation # (gcc version 5.4.0 and clang 7.1) tested on April 2nd 2018. Index: src/tests/usr.bin/cc/t_asan_heap_overflow.sh diff -u src/tests/usr.bin/cc/t_asan_heap_overflow.sh:1.1 src/tests/usr.bin/cc/t_asan_heap_overflow.sh:1.2 --- src/tests/usr.bin/cc/t_asan_heap_overflow.sh:1.1 Wed Apr 4 23:51:35 2018 +++ src/tests/usr.bin/cc/t_asan_heap_overflow.sh Mon Jul 16 07:25:58 2018 @@ -1,4 +1,4 @@ -# $NetBSD: t_asan_heap_overflow.sh,v 1.1 2018/04/04 23:51:35 kamil Exp $ +# $NetBSD: t_asan_heap_overflow.sh,v 1.2 2018/07/16 07:25:58 kamil Exp $ # # Copyright (c) 2018 The NetBSD Foundation, Inc. # All rights reserved. @@ -202,10 +202,10 @@ atf_init_test_cases() } atf_add_test_case heap_overflow - atf_add_test_case heap_overflow_profile +# atf_add_test_case heap_overflow_profile atf_add_test_case heap_overflow_pic atf_add_test_case heap_overflow_pie - atf_add_test_case heap_overflow32 +# atf_add_test_case heap_overflow32 # static option not supported # -static and -fsanitize=address can't be used together for compilation # (gcc version 5.4.0 and clang 7.1) tested on April 2nd 2018. Index: src/tests/usr.bin/cc/t_asan_off_by_one.sh diff -u src/tests/usr.bin/cc/t_asan_off_by_one.sh:1.1 src/tests/usr.bin/cc/t_asan_off_by_one.sh:1.2 ---
CVS commit: src/tests/usr.bin/cc
Module Name:src Committed By: kamil Date: Mon Jul 16 07:25:58 UTC 2018 Modified Files: src/tests/usr.bin/cc: t_asan_double_free.sh t_asan_global_buffer_overflow.sh t_asan_heap_overflow.sh t_asan_off_by_one.sh t_asan_poison.sh t_asan_uaf.sh t_ubsan_int_add_overflow.sh t_ubsan_int_divzero.sh t_ubsan_int_neg_overflow.sh t_ubsan_int_sub_overflow.sh t_ubsan_vla_out_of_bounds.sh Log Message: Disable profile and compat 32-bit tests cc sanitizer tests These tests are known to be faulty. These fatures aren't ready. They tend to break to unrelated changes to the codebase and require. Base Clang and GCC are in general dated to use with sanitizers as these features are being fixed on HEAD versions of both compilers (mostly Clang). To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/cc/t_asan_double_free.sh \ src/tests/usr.bin/cc/t_asan_global_buffer_overflow.sh \ src/tests/usr.bin/cc/t_asan_heap_overflow.sh \ src/tests/usr.bin/cc/t_asan_off_by_one.sh \ src/tests/usr.bin/cc/t_asan_poison.sh src/tests/usr.bin/cc/t_asan_uaf.sh cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/cc/t_ubsan_int_add_overflow.sh \ src/tests/usr.bin/cc/t_ubsan_int_divzero.sh \ src/tests/usr.bin/cc/t_ubsan_int_neg_overflow.sh \ src/tests/usr.bin/cc/t_ubsan_int_sub_overflow.sh cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/cc/t_ubsan_vla_out_of_bounds.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/usr.bin/cc
Module Name:src Committed By: kamil Date: Fri May 4 12:26:53 UTC 2018 Modified Files: src/tests/usr.bin/cc: t_ubsan_vla_out_of_bounds.sh Log Message: Explain VLA in t_ubsan_vla_out_of_bounds.sh (ATF test) VLA - Variable Length Array Requested by To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/cc/t_ubsan_vla_out_of_bounds.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/usr.bin/cc
Module Name:src Committed By: kamil Date: Fri May 4 12:26:53 UTC 2018 Modified Files: src/tests/usr.bin/cc: t_ubsan_vla_out_of_bounds.sh Log Message: Explain VLA in t_ubsan_vla_out_of_bounds.sh (ATF test) VLA - Variable Length Array Requested by To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/cc/t_ubsan_vla_out_of_bounds.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/usr.bin/cc/t_ubsan_vla_out_of_bounds.sh diff -u src/tests/usr.bin/cc/t_ubsan_vla_out_of_bounds.sh:1.2 src/tests/usr.bin/cc/t_ubsan_vla_out_of_bounds.sh:1.3 --- src/tests/usr.bin/cc/t_ubsan_vla_out_of_bounds.sh:1.2 Fri May 4 10:44:24 2018 +++ src/tests/usr.bin/cc/t_ubsan_vla_out_of_bounds.sh Fri May 4 12:26:53 2018 @@ -40,28 +40,28 @@ test_target() atf_test_case vla_out_of_bounds vla_out_of_bounds_head() { - atf_set "descr" "Test Undefined Behavior for vla out of bounds" + atf_set "descr" "Test Undefined Behavior for vla (Variable Length Array) out of bounds" atf_set "require.progs" "cc" } atf_test_case vla_out_of_bounds_profile vla_out_of_bounds_profile_head() { - atf_set "descr" "Test Undefined Behavior for vla out of bounds with profiling option" + atf_set "descr" "Test Undefined Behavior for vla (Variable Length Array) out of bounds with profiling option" atf_set "require.progs" "cc" } atf_test_case vla_out_of_bounds_pic vla_out_of_bounds_pic_head() { - atf_set "descr" "Test Undefined Behavior for vla out of bounds with position independent code (PIC) flag" + atf_set "descr" "Test Undefined Behavior for vla (Variable Length Array) out of bounds with position independent code (PIC) flag" atf_set "require.progs" "cc" } atf_test_case vla_out_of_bounds_pie vla_out_of_bounds_pie_head() { - atf_set "descr" "Test Undefined Behavior for vla out of bounds with position independent execution (PIE) flag" + atf_set "descr" "Test Undefined Behavior for vla (Variable Length Array) out of bounds with position independent execution (PIE) flag" atf_set "require.progs" "cc" } atf_test_case vla_out_of_bounds32 vla_out_of_bounds32_head() { - atf_set "descr" "Test Undefined Behavior for vla out of bounds in NetBSD_32 emulation" + atf_set "descr" "Test Undefined Behavior for vla (Variable Length Array) out of bounds in NetBSD_32 emulation" atf_set "require.progs" "cc file diff cat" }
CVS commit: src/tests/usr.bin/cc
Module Name:src Committed By: martin Date: Fri May 4 10:44:24 UTC 2018 Modified Files: src/tests/usr.bin/cc: t_ubsan_int_add_overflow.sh t_ubsan_int_divzero.sh t_ubsan_int_neg_overflow.sh t_ubsan_int_sub_overflow.sh t_ubsan_vla_out_of_bounds.sh Log Message: Use more formal speech in messages To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/cc/t_ubsan_int_add_overflow.sh \ src/tests/usr.bin/cc/t_ubsan_int_divzero.sh \ src/tests/usr.bin/cc/t_ubsan_int_neg_overflow.sh \ src/tests/usr.bin/cc/t_ubsan_int_sub_overflow.sh \ src/tests/usr.bin/cc/t_ubsan_vla_out_of_bounds.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/usr.bin/cc/t_ubsan_int_add_overflow.sh diff -u src/tests/usr.bin/cc/t_ubsan_int_add_overflow.sh:1.1 src/tests/usr.bin/cc/t_ubsan_int_add_overflow.sh:1.2 --- src/tests/usr.bin/cc/t_ubsan_int_add_overflow.sh:1.1 Wed May 2 18:46:05 2018 +++ src/tests/usr.bin/cc/t_ubsan_int_add_overflow.sh Fri May 4 10:44:24 2018 @@ -156,11 +156,11 @@ EOF file -b ./md32 > ./ftype32 file -b ./md64 > ./ftype64 if diff ./ftype32 ./ftype64 >/dev/null; then - atf_fail "Generated binz ain't no different" + atf_fail "Generated 32bit binaries do not differ from 64bit ones" fi - echo "32bit Binz on this platform are:" + echo "32bit binaries on this platform are:" cat ./ftype32 - echo "64bit Binz are on the other hand:" + echo "64bit binaries are on the other hand:" cat ./ftype64 atf_check -e match:"signed integer overflow" ./md32 Index: src/tests/usr.bin/cc/t_ubsan_int_divzero.sh diff -u src/tests/usr.bin/cc/t_ubsan_int_divzero.sh:1.1 src/tests/usr.bin/cc/t_ubsan_int_divzero.sh:1.2 --- src/tests/usr.bin/cc/t_ubsan_int_divzero.sh:1.1 Wed May 2 18:46:05 2018 +++ src/tests/usr.bin/cc/t_ubsan_int_divzero.sh Fri May 4 10:44:24 2018 @@ -150,11 +150,11 @@ EOF file -b ./md32 > ./ftype32 file -b ./md64 > ./ftype64 if diff ./ftype32 ./ftype64 >/dev/null; then - atf_fail "Generated binz ain't no different" + atf_fail "Generated 32bit binaries do not differ from 64bit ones" fi - echo "32bit Binz on this platform are:" + echo "32bit binaries on this platform are:" cat ./ftype32 - echo "64bit Binz are on the other hand:" + echo "64bit binaries are on the other hand:" cat ./ftype64 atf_check -s signal:8 -e match:"division by zero" ./md32 Index: src/tests/usr.bin/cc/t_ubsan_int_neg_overflow.sh diff -u src/tests/usr.bin/cc/t_ubsan_int_neg_overflow.sh:1.1 src/tests/usr.bin/cc/t_ubsan_int_neg_overflow.sh:1.2 --- src/tests/usr.bin/cc/t_ubsan_int_neg_overflow.sh:1.1 Wed May 2 18:46:05 2018 +++ src/tests/usr.bin/cc/t_ubsan_int_neg_overflow.sh Fri May 4 10:44:24 2018 @@ -156,11 +156,11 @@ EOF file -b ./md32 > ./ftype32 file -b ./md64 > ./ftype64 if diff ./ftype32 ./ftype64 >/dev/null; then - atf_fail "Generated binz ain't no different" + atf_fail "Generated 32bit binaries do not differ from 64bit ones" fi - echo "32bit Binz on this platform are:" + echo "32bit binaries on this platform are:" cat ./ftype32 - echo "64bit Binz are on the other hand:" + echo "64bit binaries are on the other hand:" cat ./ftype64 atf_check -e match:"negation of" ./md32 Index: src/tests/usr.bin/cc/t_ubsan_int_sub_overflow.sh diff -u src/tests/usr.bin/cc/t_ubsan_int_sub_overflow.sh:1.1 src/tests/usr.bin/cc/t_ubsan_int_sub_overflow.sh:1.2 --- src/tests/usr.bin/cc/t_ubsan_int_sub_overflow.sh:1.1 Wed May 2 18:46:05 2018 +++ src/tests/usr.bin/cc/t_ubsan_int_sub_overflow.sh Fri May 4 10:44:24 2018 @@ -156,11 +156,11 @@ EOF file -b ./md32 > ./ftype32 file -b ./md64 > ./ftype64 if diff ./ftype32 ./ftype64 >/dev/null; then - atf_fail "Generated binz ain't no different" + atf_fail "Generated 32bit binaries do not differ from 64bit ones" fi - echo "32bit Binz on this platform are:" + echo "32bit binaries on this platform are:" cat ./ftype32 - echo "64bit Binz are on the other hand:" + echo "64bit binaries are on the other hand:" cat ./ftype64 atf_check -s ignore -e match:"signed integer overflow" ./md32 Index: src/tests/usr.bin/cc/t_ubsan_vla_out_of_bounds.sh diff -u src/tests/usr.bin/cc/t_ubsan_vla_out_of_bounds.sh:1.1 src/tests/usr.bin/cc/t_ubsan_vla_out_of_bounds.sh:1.2 --- src/tests/usr.bin/cc/t_ubsan_vla_out_of_bounds.sh:1.1 Wed May 2 18:46:05 2018 +++ src/tests/usr.bin/cc/t_ubsan_vla_out_of_bounds.sh Fri May 4 10:44:24 2018 @@ -153,11 +153,11 @@ EOF file -b ./md32 > ./ftype32 file -b ./md64 > ./ftype64 if diff ./ftype32 ./ftype64 >/dev/null; then - atf_fail "Generated binz ain't no different" + atf_fail "Generated 32bit binaries do not differ from 64bit ones" fi - echo "32bit Binz on this platform are:" + echo "32bit binaries on this platform are:" cat ./ftype32 - echo "64bit Binz are on the other hand:" + echo "64bit binaries are on the other hand:" cat ./ftype64 atf_check -e match:"out
CVS commit: src/tests/usr.bin/cc
Module Name:src Committed By: martin Date: Fri May 4 10:44:24 UTC 2018 Modified Files: src/tests/usr.bin/cc: t_ubsan_int_add_overflow.sh t_ubsan_int_divzero.sh t_ubsan_int_neg_overflow.sh t_ubsan_int_sub_overflow.sh t_ubsan_vla_out_of_bounds.sh Log Message: Use more formal speech in messages To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/cc/t_ubsan_int_add_overflow.sh \ src/tests/usr.bin/cc/t_ubsan_int_divzero.sh \ src/tests/usr.bin/cc/t_ubsan_int_neg_overflow.sh \ src/tests/usr.bin/cc/t_ubsan_int_sub_overflow.sh \ src/tests/usr.bin/cc/t_ubsan_vla_out_of_bounds.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/usr.bin/cc
Module Name:src Committed By: martin Date: Wed May 31 11:08:35 UTC 2017 Modified Files: src/tests/usr.bin/cc: t_hello.sh Log Message: In the -m32 test, additionally test profiled binaries. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/cc/t_hello.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/usr.bin/cc/t_hello.sh diff -u src/tests/usr.bin/cc/t_hello.sh:1.5 src/tests/usr.bin/cc/t_hello.sh:1.6 --- src/tests/usr.bin/cc/t_hello.sh:1.5 Thu May 18 10:29:47 2017 +++ src/tests/usr.bin/cc/t_hello.sh Wed May 31 11:08:35 2017 @@ -1,4 +1,4 @@ -# $NetBSD: t_hello.sh,v 1.5 2017/05/18 10:29:47 martin Exp $ +# $NetBSD: t_hello.sh,v 1.6 2017/05/31 11:08:35 martin Exp $ # # Copyright (c) 2011 The NetBSD Foundation, Inc. # All rights reserved. @@ -149,6 +149,16 @@ EOF atf_check -s exit:0 -o ignore -e ignore cc -o hello -m32 \ -static test.c atf_check -s exit:0 -o inline:"hello static world\n" ./hello + + # and another test with profile 32bit binaries + cat > test.c << EOF +#include +#include +int main(void) {printf("hello 32bit profile world\n");exit(0);} +EOF + atf_check -s exit:0 -o ignore -e ignore cc -o hello -m32 \ + -pg test.c + atf_check -s exit:0 -o inline:"hello 32bit profile world\n" ./hello } atf_init_test_cases()
CVS commit: src/tests/usr.bin/cc
Module Name:src Committed By: martin Date: Wed May 31 11:08:35 UTC 2017 Modified Files: src/tests/usr.bin/cc: t_hello.sh Log Message: In the -m32 test, additionally test profiled binaries. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/cc/t_hello.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/usr.bin/cc
Module Name:src Committed By: kamil Date: Sat May 13 23:51:39 UTC 2017 Modified Files: src/tests/usr.bin/cc: t_hello.sh Log Message: Correct hellp_pic ATF test in usr.bin/cc Drop "-dPIC", this is misspelled "-DPIC" option for libtool. Enhance code example to be more pedantic. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/cc/t_hello.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/usr.bin/cc
Module Name:src Committed By: kamil Date: Sat May 13 23:51:39 UTC 2017 Modified Files: src/tests/usr.bin/cc: t_hello.sh Log Message: Correct hellp_pic ATF test in usr.bin/cc Drop "-dPIC", this is misspelled "-DPIC" option for libtool. Enhance code example to be more pedantic. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/cc/t_hello.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/usr.bin/cc/t_hello.sh diff -u src/tests/usr.bin/cc/t_hello.sh:1.3 src/tests/usr.bin/cc/t_hello.sh:1.4 --- src/tests/usr.bin/cc/t_hello.sh:1.3 Sun Apr 3 14:41:30 2016 +++ src/tests/usr.bin/cc/t_hello.sh Sat May 13 23:51:39 2017 @@ -1,4 +1,4 @@ -# $NetBSD: t_hello.sh,v 1.3 2016/04/03 14:41:30 gson Exp $ +# $NetBSD: t_hello.sh,v 1.4 2017/05/13 23:51:39 kamil Exp $ # # Copyright (c) 2011 The NetBSD Foundation, Inc. # All rights reserved. @@ -62,15 +62,16 @@ EOF hello_pic_body() { cat > test.c << EOF #include +int callpic(void); int main(void) {callpic();exit(0);} EOF cat > pic.c << EOF #include -int callpic(void) {printf("hello world\n");} +int callpic(void) {printf("hello world\n");return 0;} EOF atf_check -s exit:0 -o ignore -e ignore \ - cc -fPIC -dPIC -shared -o libtest.so pic.c + cc -fPIC -shared -o libtest.so pic.c atf_check -s exit:0 -o ignore -e ignore \ cc -o hello test.c -L. -ltest
CVS commit: src/tests/usr.bin/cc
Module Name:src Committed By: gson Date: Sun Apr 3 14:41:30 UTC 2016 Modified Files: src/tests/usr.bin/cc: t_hello.sh Log Message: Fix typo To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/cc/t_hello.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/usr.bin/cc/t_hello.sh diff -u src/tests/usr.bin/cc/t_hello.sh:1.2 src/tests/usr.bin/cc/t_hello.sh:1.3 --- src/tests/usr.bin/cc/t_hello.sh:1.2 Sat Jul 21 12:30:55 2012 +++ src/tests/usr.bin/cc/t_hello.sh Sun Apr 3 14:41:30 2016 @@ -1,4 +1,4 @@ -# $NetBSD: t_hello.sh,v 1.2 2012/07/21 12:30:55 martin Exp $ +# $NetBSD: t_hello.sh,v 1.3 2016/04/03 14:41:30 gson Exp $ # # Copyright (c) 2011 The NetBSD Foundation, Inc. # All rights reserved. @@ -39,7 +39,7 @@ hello_pic_head() { atf_test_case hello_pie hello_pie_head() { - atf_set "descr" "compile and run position independend (PIE) \"hello world\"" + atf_set "descr" "compile and run position independent (PIE) \"hello world\"" atf_set "require.progs" "cc" }
CVS commit: src/tests/usr.bin/cc
Module Name:src Committed By: gson Date: Sun Apr 3 14:41:30 UTC 2016 Modified Files: src/tests/usr.bin/cc: t_hello.sh Log Message: Fix typo To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/cc/t_hello.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/tests/usr.bin/cc
Module Name:src Committed By: martin Date: Sat Jul 21 12:30:55 UTC 2012 Modified Files: src/tests/usr.bin/cc: t_hello.sh Log Message: Add a test case that (if gcc supports it on the current arch) to compile a PIE binary and see if we can run it. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/cc/t_hello.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/usr.bin/cc/t_hello.sh diff -u src/tests/usr.bin/cc/t_hello.sh:1.1 src/tests/usr.bin/cc/t_hello.sh:1.2 --- src/tests/usr.bin/cc/t_hello.sh:1.1 Sat Mar 17 17:15:29 2012 +++ src/tests/usr.bin/cc/t_hello.sh Sat Jul 21 12:30:55 2012 @@ -1,4 +1,4 @@ -# $NetBSD: t_hello.sh,v 1.1 2012/03/17 17:15:29 jruoho Exp $ +# $NetBSD: t_hello.sh,v 1.2 2012/07/21 12:30:55 martin Exp $ # # Copyright (c) 2011 The NetBSD Foundation, Inc. # All rights reserved. @@ -37,6 +37,12 @@ hello_pic_head() { atf_set require.progs cc } +atf_test_case hello_pie +hello_pie_head() { + atf_set descr compile and run position independend (PIE) \hello world\ + atf_set require.progs cc +} + atf_test_case hello32 hello32_head() { atf_set descr compile and run \hello world\ for/in netbsd32 emulation @@ -72,6 +78,20 @@ EOF atf_check -s exit:0 -o inline:hello world\n ./hello } +hello_pie_body() { + # check whether this arch supports -pie + if ! cc -pie -dM -E - /dev/null 2/dev/null /dev/null; then + atf_skip cc -pie not supported on this architecture + fi + cat test.c EOF +#include stdio.h +#include stdlib.h +int main(void) {printf(hello world\n);exit(0);} +EOF + atf_check -s exit:0 -o ignore -e ignore cc -fpie -pie -o hello test.c + atf_check -s exit:0 -o inline:hello world\n ./hello +} + hello32_body() { # check whether this arch is 64bit if ! cc -dM -E - /dev/null | fgrep -q _LP64; then @@ -119,5 +139,6 @@ atf_init_test_cases() atf_add_test_case hello atf_add_test_case hello_pic + atf_add_test_case hello_pie atf_add_test_case hello32 }
CVS commit: src/tests/usr.bin/cc
Module Name:src Committed By: martin Date: Sat Jul 21 12:30:55 UTC 2012 Modified Files: src/tests/usr.bin/cc: t_hello.sh Log Message: Add a test case that (if gcc supports it on the current arch) to compile a PIE binary and see if we can run it. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/cc/t_hello.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.