Module Name: src Committed By: riastradh Date: Sun Apr 28 01:21:27 UTC 2024
Modified Files: src/distrib/sets/lists/debug: mi src/distrib/sets/lists/tests: mi src/etc/mtree: NetBSD.dist.tests Added Files: src/tests/lib/libstdc++: Makefile h_cin_nosync.cc t_sync_with_stdio.sh Log Message: libstdc++: Add test for PR lib/58206, sync_with_stdio busted. To generate a diff of this commit: cvs rdiff -u -r1.432 -r1.433 src/distrib/sets/lists/debug/mi cvs rdiff -u -r1.1312 -r1.1313 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.203 -r1.204 src/etc/mtree/NetBSD.dist.tests cvs rdiff -u -r0 -r1.1 src/tests/lib/libstdc++/Makefile \ src/tests/lib/libstdc++/h_cin_nosync.cc \ src/tests/lib/libstdc++/t_sync_with_stdio.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/debug/mi diff -u src/distrib/sets/lists/debug/mi:1.432 src/distrib/sets/lists/debug/mi:1.433 --- src/distrib/sets/lists/debug/mi:1.432 Tue Apr 23 07:33:24 2024 +++ src/distrib/sets/lists/debug/mi Sun Apr 28 01:21:26 2024 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.432 2024/04/23 07:33:24 martin Exp $ +# $NetBSD: mi,v 1.433 2024/04/28 01:21:26 riastradh Exp $ ./etc/mtree/set.debug comp-sys-root ./usr/lib comp-sys-usr compatdir ./usr/lib/i18n/libBIG5_g.a comp-c-debuglib debuglib @@ -2390,6 +2390,7 @@ ./usr/libdata/debug/usr/tests/lib/librumphijack/h_netget.debug tests-lib-debug debug,atf,rump ./usr/libdata/debug/usr/tests/lib/libskey/t_algorithms.debug tests-lib-debug debug,atf,skey,compattestfile ./usr/libdata/debug/usr/tests/lib/libsljit/h_sljit.debug tests-lib-debug debug,atf,sljit,compattestfile +./usr/libdata/debug/usr/tests/lib/libstdc++/h_cin_nosync.debug tests-lib-tests compattestfile,atf ./usr/libdata/debug/usr/tests/lib/libtre/h_regex_att.debug tests-obsolete obsolete,compattestfile ./usr/libdata/debug/usr/tests/lib/libtre/t_exhaust.debug tests-lib-debug debug,atf,compattestfile ./usr/libdata/debug/usr/tests/lib/libtre/t_regex_att.debug tests-lib-debug debug,atf,compattestfile Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.1312 src/distrib/sets/lists/tests/mi:1.1313 --- src/distrib/sets/lists/tests/mi:1.1312 Mon Apr 22 07:24:22 2024 +++ src/distrib/sets/lists/tests/mi Sun Apr 28 01:21:26 2024 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1312 2024/04/22 07:24:22 pho Exp $ +# $NetBSD: mi,v 1.1313 2024/04/28 01:21:26 riastradh Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -151,6 +151,7 @@ ./usr/libdata/debug/usr/tests/lib/librumphijack tests-lib-debug compattestfile,atf ./usr/libdata/debug/usr/tests/lib/libskey tests-lib-debug compattestfile,atf ./usr/libdata/debug/usr/tests/lib/libsljit tests-lib-debug compattestfile,atf +./usr/libdata/debug/usr/tests/lib/libstdc++ tests-lib-debug compattestfile,atf ./usr/libdata/debug/usr/tests/lib/libtre tests-lib-debug compattestfile,atf ./usr/libdata/debug/usr/tests/lib/libusbhid tests-lib-debug compattestfile,atf ./usr/libdata/debug/usr/tests/lib/libutil tests-lib-debug compattestfile,atf @@ -4091,6 +4092,11 @@ ./usr/tests/lib/libsljit/Kyuafile tests-lib-tests compattestfile,atf,sljit,kyua ./usr/tests/lib/libsljit/h_sljit tests-lib-tests compattestfile,atf,sljit ./usr/tests/lib/libsljit/t_sljit tests-lib-tests compattestfile,atf,sljit +./usr/tests/lib/libstdc++ tests-lib-tests compattestfile,atf +./usr/tests/lib/libstdc++/Atffile tests-lib-tests compattestfile,atf +./usr/tests/lib/libstdc++/Kyuafile tests-lib-tests compattestfile,atf,kyua +./usr/tests/lib/libstdc++/h_cin_nosync tests-lib-tests compattestfile,atf +./usr/tests/lib/libstdc++/t_sync_with_stdio tests-lib-tests compattestfile,atf ./usr/tests/lib/libtre tests-lib-tests compattestfile,atf ./usr/tests/lib/libtre/Atffile tests-lib-tests compattestfile,atf ./usr/tests/lib/libtre/Kyuafile tests-lib-tests compattestfile,atf,kyua Index: src/etc/mtree/NetBSD.dist.tests diff -u src/etc/mtree/NetBSD.dist.tests:1.203 src/etc/mtree/NetBSD.dist.tests:1.204 --- src/etc/mtree/NetBSD.dist.tests:1.203 Thu Mar 14 21:00:32 2024 +++ src/etc/mtree/NetBSD.dist.tests Sun Apr 28 01:21:27 2024 @@ -1,4 +1,4 @@ -# $NetBSD: NetBSD.dist.tests,v 1.203 2024/03/14 21:00:32 rillig Exp $ +# $NetBSD: NetBSD.dist.tests,v 1.204 2024/04/28 01:21:27 riastradh Exp $ ./usr/libdata/debug/usr/tests ./usr/libdata/debug/usr/tests/atf @@ -131,6 +131,7 @@ ./usr/libdata/debug/usr/tests/lib/librumphijack ./usr/libdata/debug/usr/tests/lib/libskey ./usr/libdata/debug/usr/tests/lib/libsljit +./usr/libdata/debug/usr/tests/lib/libstdc++ ./usr/libdata/debug/usr/tests/lib/libtre ./usr/libdata/debug/usr/tests/lib/libusbhid ./usr/libdata/debug/usr/tests/lib/libutil @@ -345,6 +346,7 @@ ./usr/tests/lib/librumphijack ./usr/tests/lib/libskey ./usr/tests/lib/libsljit +./usr/tests/lib/libstdc++ ./usr/tests/lib/libtre ./usr/tests/lib/libtre/data ./usr/tests/lib/libusbhid Added files: Index: src/tests/lib/libstdc++/Makefile diff -u /dev/null src/tests/lib/libstdc++/Makefile:1.1 --- /dev/null Sun Apr 28 01:21:27 2024 +++ src/tests/lib/libstdc++/Makefile Sun Apr 28 01:21:27 2024 @@ -0,0 +1,12 @@ +# $NetBSD: Makefile,v 1.1 2024/04/28 01:21:27 riastradh Exp $ +# + +NOMAN= # defined + +TESTSDIR= ${TESTSBASE}/lib/libstdc++ +BINDIR= ${TESTSDIR} + +TESTS_SH+= t_sync_with_stdio +PROG_CXX+= h_cin_nosync + +.include <bsd.test.mk> Index: src/tests/lib/libstdc++/h_cin_nosync.cc diff -u /dev/null src/tests/lib/libstdc++/h_cin_nosync.cc:1.1 --- /dev/null Sun Apr 28 01:21:27 2024 +++ src/tests/lib/libstdc++/h_cin_nosync.cc Sun Apr 28 01:21:27 2024 @@ -0,0 +1,40 @@ +/* $NetBSD: h_cin_nosync.cc,v 1.1 2024/04/28 01:21:27 riastradh Exp $ */ + +/*- + * Copyright (c) 2024 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. + */ + +#include <iostream> + +int +main(void) +{ + char buf[128]; + + std::ios::sync_with_stdio(false); + std::cin.read(buf, sizeof(buf)); + std::cout << std::cin.gcount() << std::endl; + return 0; +} Index: src/tests/lib/libstdc++/t_sync_with_stdio.sh diff -u /dev/null src/tests/lib/libstdc++/t_sync_with_stdio.sh:1.1 --- /dev/null Sun Apr 28 01:21:27 2024 +++ src/tests/lib/libstdc++/t_sync_with_stdio.sh Sun Apr 28 01:21:27 2024 @@ -0,0 +1,42 @@ +# $NetBSD: t_sync_with_stdio.sh,v 1.1 2024/04/28 01:21:27 riastradh Exp $ +# +# Copyright (c) 2024 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. +# + +cin_nosync_head() +{ + atf_set descr "Check cin works after std::ios::sync_with_stdio(false)" +} +cin_nosync_body() +{ + echo hello >in + atf_expect_fail "PR lib/58206: sync_with_stdio breaks reads from cin" + atf_check -o inline:'6\n' "$(atf_get_srcdir)"/h_cin_nosync <in +} + +atf_init_test_cases() +{ + atf_add_test_case cin_nosync +}