Module Name: src Committed By: jruoho Date: Sat Oct 15 06:26:34 UTC 2011
Modified Files: src/distrib/sets/lists/tests: mi src/tests/kernel: Makefile src/tests/lib/libc/sys: Makefile Added Files: src/tests/lib/libc/sys: t_mkdir.c Removed Files: src/tests/kernel: t_mkdir.c Log Message: Move the mkdir(2) test to the right place. To generate a diff of this commit: cvs rdiff -u -r1.403 -r1.404 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.15 -r1.16 src/tests/kernel/Makefile cvs rdiff -u -r1.3 -r0 src/tests/kernel/t_mkdir.c cvs rdiff -u -r1.11 -r1.12 src/tests/lib/libc/sys/Makefile cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/sys/t_mkdir.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.403 src/distrib/sets/lists/tests/mi:1.404 --- src/distrib/sets/lists/tests/mi:1.403 Sat Oct 15 06:17:02 2011 +++ src/distrib/sets/lists/tests/mi Sat Oct 15 06:26:34 2011 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.403 2011/10/15 06:17:02 jruoho Exp $ +# $NetBSD: mi,v 1.404 2011/10/15 06:26:34 jruoho Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -324,7 +324,7 @@ ./usr/libdata/debug/usr/tests/kernel/t_filedesc.debug tests-kernel-tests debug,atf ./usr/libdata/debug/usr/tests/kernel/t_lock.debug tests-kernel-tests debug,atf ./usr/libdata/debug/usr/tests/kernel/t_lwpctl.debug tests-kernel-tests debug,atf -./usr/libdata/debug/usr/tests/kernel/t_mkdir.debug tests-kernel-tests debug,atf +./usr/libdata/debug/usr/tests/kernel/t_mkdir.debug tests-obsolete obsolete ./usr/libdata/debug/usr/tests/kernel/t_pipe.debug tests-obsolete obsolete ./usr/libdata/debug/usr/tests/kernel/t_poll3w.debug tests-kernel-tests debug,atf ./usr/libdata/debug/usr/tests/kernel/t_pollts.debug tests-obsolete obsolete @@ -504,6 +504,7 @@ ./usr/libdata/debug/usr/tests/lib/libc/sys/t_kill.debug tests-lib-debug debug,atf ./usr/libdata/debug/usr/tests/lib/libc/sys/t_link.debug tests-lib-debug debug,atf ./usr/libdata/debug/usr/tests/lib/libc/sys/t_mincore.debug tests-lib-debug debug,atf +./usr/libdata/debug/usr/tests/lib/libc/sys/t_mkdir.debug tests-lib-debug debug,atf ./usr/libdata/debug/usr/tests/lib/libc/sys/t_mkfifo.debug tests-lib-debug debug,atf ./usr/libdata/debug/usr/tests/lib/libc/sys/t_mknod.debug tests-lib-debug debug,atf ./usr/libdata/debug/usr/tests/lib/libc/sys/t_mmap.debug tests-lib-debug debug,atf @@ -1849,7 +1850,7 @@ ./usr/tests/kernel/t_filedesc tests-kernel-tests atf ./usr/tests/kernel/t_lock tests-kernel-tests atf ./usr/tests/kernel/t_lwpctl tests-kernel-tests atf -./usr/tests/kernel/t_mkdir tests-kernel-tests atf +./usr/tests/kernel/t_mkdir tests-obsolete obsolete ./usr/tests/kernel/t_pipe tests-obsolete obsolete ./usr/tests/kernel/t_poll3w tests-kernel-tests atf ./usr/tests/kernel/t_pollts tests-obsolete obsolete @@ -2118,6 +2119,7 @@ ./usr/tests/lib/libc/sys/t_kill tests-lib-tests atf ./usr/tests/lib/libc/sys/t_link tests-lib-tests atf ./usr/tests/lib/libc/sys/t_mincore tests-lib-tests atf +./usr/tests/lib/libc/sys/t_mkdir tests-lib-tests atf ./usr/tests/lib/libc/sys/t_mkfifo tests-lib-tests atf ./usr/tests/lib/libc/sys/t_mknod tests-lib-tests atf ./usr/tests/lib/libc/sys/t_mmap tests-lib-tests atf Index: src/tests/kernel/Makefile diff -u src/tests/kernel/Makefile:1.15 src/tests/kernel/Makefile:1.16 --- src/tests/kernel/Makefile:1.15 Sat Oct 15 06:17:02 2011 +++ src/tests/kernel/Makefile Sat Oct 15 06:26:33 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.15 2011/10/15 06:17:02 jruoho Exp $ +# $NetBSD: Makefile,v 1.16 2011/10/15 06:26:33 jruoho Exp $ NOMAN= # defined @@ -10,7 +10,6 @@ TESTS_SUBDIRS= kqueue tty TESTS_C= t_lock TESTS_C+= t_lwpctl -TESTS_C+= t_mkdir TESTS_C+= t_poll3w TESTS_C+= t_pty TESTS_C+= t_rnd Index: src/tests/lib/libc/sys/Makefile diff -u src/tests/lib/libc/sys/Makefile:1.11 src/tests/lib/libc/sys/Makefile:1.12 --- src/tests/lib/libc/sys/Makefile:1.11 Sat Oct 15 06:17:02 2011 +++ src/tests/lib/libc/sys/Makefile Sat Oct 15 06:26:34 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.11 2011/10/15 06:17:02 jruoho Exp $ +# $NetBSD: Makefile,v 1.12 2011/10/15 06:26:34 jruoho Exp $ MKMAN= no @@ -25,6 +25,7 @@ TESTS_C+= t_issetugid TESTS_C+= t_kill TESTS_C+= t_link TESTS_C+= t_mincore +TESTS_C+= t_mkdir TESTS_C+= t_mkfifo TESTS_C+= t_mknod TESTS_C+= t_mmap Added files: Index: src/tests/lib/libc/sys/t_mkdir.c diff -u /dev/null src/tests/lib/libc/sys/t_mkdir.c:1.1 --- /dev/null Sat Oct 15 06:26:34 2011 +++ src/tests/lib/libc/sys/t_mkdir.c Sat Oct 15 06:26:33 2011 @@ -0,0 +1,84 @@ +/* $NetBSD: t_mkdir.c,v 1.1 2011/10/15 06:26:33 jruoho Exp $ */ + +/*- + * Copyright (c) 2008 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Jason R. Thorpe. + * + * 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> +__COPYRIGHT("@(#) Copyright (c) 2008\ + The NetBSD Foundation, inc. All rights reserved."); +__RCSID("$NetBSD: t_mkdir.c,v 1.1 2011/10/15 06:26:33 jruoho Exp $"); + +#include <sys/stat.h> + +#include <atf-c.h> +#include <stdio.h> +#include <unistd.h> + +ATF_TC(mkdir_trail); +ATF_TC_HEAD(mkdir_trail, tc) +{ + atf_tc_set_md_var(tc, "descr", "Checks mkdir(2) for trailing slashes"); +} + +ATF_TC_BODY(mkdir_trail, tc) +{ + const char *tests[] = { + /* + * IEEE 1003.1 second ed. 2.2.2.78: + * + * If the pathname refers to a directory, it may also have + * one or more trailing slashes. Multiple successive slashes + * are considered to be the same as one slash. + */ + "dir1/", + "dir2//", + + NULL, + }; + + const char **test; + + for (test = &tests[0]; *test != NULL; ++test) { + + (void)printf("Checking \"%s\"\n", *test); + (void)rmdir(*test); + + ATF_REQUIRE(mkdir(*test, 0777) == 0); + ATF_REQUIRE(rename(*test, "foo") == 0); + ATF_REQUIRE(rename("foo/", *test) == 0); + ATF_REQUIRE(rmdir(*test) == 0); + } +} + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, mkdir_trail); + + return atf_no_error(); +}