Module Name: src Committed By: jruoho Date: Sun Mar 18 08:52:08 UTC 2012
Modified Files: src/distrib/sets/lists/tests: mi src/tests/lib/libc/gen: Makefile Added Files: src/tests/lib/libc/gen: t_fnmatch.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.446 -r1.447 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.35 -r1.36 src/tests/lib/libc/gen/Makefile cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/gen/t_fnmatch.c 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.446 src/distrib/sets/lists/tests/mi:1.447 --- src/distrib/sets/lists/tests/mi:1.446 Sat Mar 17 17:23:34 2012 +++ src/distrib/sets/lists/tests/mi Sun Mar 18 08:52:07 2012 @@ -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 Index: src/tests/lib/libc/gen/Makefile diff -u src/tests/lib/libc/gen/Makefile:1.35 src/tests/lib/libc/gen/Makefile:1.36 --- src/tests/lib/libc/gen/Makefile:1.35 Sat Mar 17 16:40:14 2012 +++ src/tests/lib/libc/gen/Makefile Sun Mar 18 08:52:07 2012 @@ -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 <bsd.own.mk> @@ -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 Added files: Index: src/tests/lib/libc/gen/t_fnmatch.c diff -u /dev/null src/tests/lib/libc/gen/t_fnmatch.c:1.1 --- /dev/null Sun Mar 18 08:52:08 2012 +++ src/tests/lib/libc/gen/t_fnmatch.c Sun Mar 18 08:52:07 2012 @@ -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 <sys/cdefs.h> +__RCSID("$NetBSD: t_fnmatch.c,v 1.1 2012/03/18 08:52:07 jruoho Exp $"); + +#include <atf-c.h> +#include <fnmatch.h> +#include <stdio.h> + +/* + * 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(); +}