From e626461e724ddf7325ee6bd4c08c9b3d4a5879bf Mon Sep 17 00:00:00 2001 From: jruoho Date: Sun, 18 Mar 2012 08:52:07 +0000 Subject: [PATCH] Add a case for PR lib/41558. It is unclear whether this is a bug, but at least it is documented now. Probably it would be better to follow Linux, where the test case does not fail. --- distrib/sets/lists/tests/mi | 4 ++- tests/lib/libc/gen/Makefile | 3 +- tests/lib/libc/gen/t_fnmatch.c | 65 ++++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 tests/lib/libc/gen/t_fnmatch.c diff --git a/distrib/sets/lists/tests/mi b/distrib/sets/lists/tests/mi index f61b96049696..ee26ee7b510d 100644 --- a/distrib/sets/lists/tests/mi +++ b/distrib/sets/lists/tests/mi @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.446 2012/03/17 17:23:34 jruoho Exp $ +# $NetBSD: mi,v 1.447 2012/03/18 08:52:07 jruoho Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -379,6 +379,7 @@ ./usr/libdata/debug/usr/tests/lib/libc/gen/t_cpuset.debug tests-lib-debug debug,atf ./usr/libdata/debug/usr/tests/lib/libc/gen/t_dir.debug tests-lib-debug debug,atf ./usr/libdata/debug/usr/tests/lib/libc/gen/t_fmtcheck.debug tests-lib-debug debug,atf +./usr/libdata/debug/usr/tests/lib/libc/gen/t_fnmatch.debug tests-lib-debug debug,atf ./usr/libdata/debug/usr/tests/lib/libc/gen/t_fpclassify.debug tests-lib-debug debug,atf ./usr/libdata/debug/usr/tests/lib/libc/gen/t_fpsetmask.debug tests-lib-debug debug,atf ./usr/libdata/debug/usr/tests/lib/libc/gen/t_fpsetround.debug tests-lib-debug debug,atf @@ -2016,6 +2017,7 @@ ./usr/tests/lib/libc/gen/t_cpuset tests-lib-tests atf ./usr/tests/lib/libc/gen/t_dir tests-lib-tests atf ./usr/tests/lib/libc/gen/t_fmtcheck tests-lib-tests atf +./usr/tests/lib/libc/gen/t_fnmatch tests-lib-tests atf ./usr/tests/lib/libc/gen/t_fpclassify tests-lib-tests atf ./usr/tests/lib/libc/gen/t_fpsetmask tests-lib-tests atf ./usr/tests/lib/libc/gen/t_fpsetround tests-lib-tests atf diff --git a/tests/lib/libc/gen/Makefile b/tests/lib/libc/gen/Makefile index b6e57982de9f..c790fc015295 100644 --- a/tests/lib/libc/gen/Makefile +++ b/tests/lib/libc/gen/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.35 2012/03/17 16:40:14 jruoho Exp $ +# $NetBSD: Makefile,v 1.36 2012/03/18 08:52:07 jruoho Exp $ .include @@ -13,6 +13,7 @@ TESTS_C+= t_closefrom TESTS_C+= t_cpuset TESTS_C+= t_dir TESTS_C+= t_fmtcheck +TESTS_C+= t_fnmatch TESTS_C+= t_fpclassify TESTS_C+= t_fpsetmask TESTS_C+= t_fpsetround diff --git a/tests/lib/libc/gen/t_fnmatch.c b/tests/lib/libc/gen/t_fnmatch.c new file mode 100644 index 000000000000..3326544f1495 --- /dev/null +++ b/tests/lib/libc/gen/t_fnmatch.c @@ -0,0 +1,65 @@ +/* $NetBSD: t_fnmatch.c,v 1.1 2012/03/18 08:52:07 jruoho Exp $ */ + +/*- + * Copyright (c) 2012 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Jukka Ruohonen. + * + * 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 +__RCSID("$NetBSD: t_fnmatch.c,v 1.1 2012/03/18 08:52:07 jruoho Exp $"); + +#include +#include +#include + +/* + * TODO: Test basic functionality of fnmatch(3) too. + */ + +ATF_TC(fnmatch_backslashes); +ATF_TC_HEAD(fnmatch_backslashes, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Test translation of '\\' with fnmatch(3) (PR lib/41558)"); +} + +ATF_TC_BODY(fnmatch_backslashes, tc) +{ + const int rv = fnmatch(/* pattern */ "\\", "\\", 0); + + atf_tc_expect_fail("PR lib/41558"); + + if (rv != FNM_NOMATCH) + atf_tc_fail("fnmatch(3) did not translate '\\'"); +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, fnmatch_backslashes); + + return atf_no_error(); +}