[Midnightbsd-cvs] src [11183] trunk/bin/rmdir: sync with freebsd, add tests

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sat Jun 30 19:39:19 EDT 2018


Revision: 11183
          http://svnweb.midnightbsd.org/src/?rev=11183
Author:   laffer1
Date:     2018-06-30 19:39:19 -0400 (Sat, 30 Jun 2018)
Log Message:
-----------
sync with freebsd, add tests

Modified Paths:
--------------
    trunk/bin/rmdir/Makefile
    trunk/bin/rmdir/rmdir.1
    trunk/bin/rmdir/rmdir.c

Added Paths:
-----------
    trunk/bin/rmdir/tests/
    trunk/bin/rmdir/tests/Makefile
    trunk/bin/rmdir/tests/rmdir_test.sh

Property Changed:
----------------
    trunk/bin/rmdir/rmdir.1

Modified: trunk/bin/rmdir/Makefile
===================================================================
--- trunk/bin/rmdir/Makefile	2018-06-30 23:38:04 UTC (rev 11182)
+++ trunk/bin/rmdir/Makefile	2018-06-30 23:39:19 UTC (rev 11183)
@@ -1,7 +1,12 @@
+# $MidnightBSD$
 #	@(#)Makefile	8.1 (Berkeley) 5/31/93
-# $FreeBSD: src/bin/rmdir/Makefile,v 1.8 2001/12/04 01:57:46 obrien Exp $
-# $MidnightBSD$
+# $FreeBSD: stable/10/bin/rmdir/Makefile 326332 2017-11-28 18:18:39Z asomers $
 
+.include <bsd.own.mk>
+
+PACKAGE=runtime
 PROG=	rmdir
+HAS_TESTS=
+SUBDIR.${MK_TESTS}+= tests
 
 .include <bsd.prog.mk>

Modified: trunk/bin/rmdir/rmdir.1
===================================================================
--- trunk/bin/rmdir/rmdir.1	2018-06-30 23:38:04 UTC (rev 11182)
+++ trunk/bin/rmdir/rmdir.1	2018-06-30 23:39:19 UTC (rev 11183)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"-
 .\" Copyright (c) 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -30,10 +31,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)rmdir.1	8.1 (Berkeley) 5/31/93
-.\" $FreeBSD: src/bin/rmdir/rmdir.1,v 1.14 2005/05/31 12:57:44 tjr Exp $
-.\" $MidnightBSD: src/bin/rmdir/rmdir.1,v 1.2 2007/07/26 20:13:00 laffer1 Exp $
+.\" $FreeBSD: stable/10/bin/rmdir/rmdir.1 248342 2013-03-15 20:12:54Z joel $
 .\"
-.Dd March 21, 2004
+.Dd March 15, 2013
 .Dt RMDIR 1
 .Os
 .Sh NAME
@@ -87,6 +87,18 @@
 .It Li >0
 An error occurred.
 .El
+.Sh EXAMPLES
+Remove the directory
+.Pa foobar ,
+if it is empty:
+.Pp
+.Dl $ rmdir foobar
+.Pp
+Remove all directories up to and including
+.Pa cow ,
+stopping at the first non-empty directory (if any):
+.Pp
+.Dl $ rmdir -p cow/horse/monkey
 .Sh SEE ALSO
 .Xr rm 1
 .Sh STANDARDS


Property changes on: trunk/bin/rmdir/rmdir.1
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/bin/rmdir/rmdir.c
===================================================================
--- trunk/bin/rmdir/rmdir.c	2018-06-30 23:38:04 UTC (rev 11182)
+++ trunk/bin/rmdir/rmdir.c	2018-06-30 23:39:19 UTC (rev 11183)
@@ -40,7 +40,7 @@
 #endif /* not lint */
 #endif
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/bin/rmdir/rmdir.c,v 1.20 2005/01/26 06:51:28 ssouhlal Exp $");
+__FBSDID("$FreeBSD: stable/10/bin/rmdir/rmdir.c 140851 2005-01-26 06:51:28Z ssouhlal $");
 
 #include <err.h>
 #include <stdio.h>

Added: trunk/bin/rmdir/tests/Makefile
===================================================================
--- trunk/bin/rmdir/tests/Makefile	                        (rev 0)
+++ trunk/bin/rmdir/tests/Makefile	2018-06-30 23:39:19 UTC (rev 11183)
@@ -0,0 +1,6 @@
+# $MidnightBSD$
+# $FreeBSD: stable/10/bin/rmdir/tests/Makefile 323275 2017-09-07 16:54:47Z asomers $
+
+ATF_TESTS_SH+=  rmdir_test
+
+.include <bsd.test.mk>


Property changes on: trunk/bin/rmdir/tests/Makefile
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/bin/rmdir/tests/rmdir_test.sh
===================================================================
--- trunk/bin/rmdir/tests/rmdir_test.sh	                        (rev 0)
+++ trunk/bin/rmdir/tests/rmdir_test.sh	2018-06-30 23:39:19 UTC (rev 11183)
@@ -0,0 +1,58 @@
+#
+# Copyright 2017 Shivansh Rai
+# 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 AUTHOR 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 AUTHOR 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.
+#
+# $FreeBSD: stable/10/bin/rmdir/tests/rmdir_test.sh 323275 2017-09-07 16:54:47Z asomers $
+# $MidnightBSD$
+
+usage_output='usage: rmdir'
+
+atf_test_case invalid_usage
+invalid_usage_head()
+{
+	atf_set "descr" "Verify that an invalid usage with a supported option produces a valid error message"
+}
+
+invalid_usage_body()
+{
+	atf_check -s not-exit:0 -e match:"$usage_output" rmdir -p
+	atf_check -s not-exit:0 -e match:"$usage_output" rmdir -v
+}
+
+atf_test_case no_arguments
+no_arguments_head()
+{
+	atf_set "descr" "Verify that rmdir(1) fails and generates a valid usage message when no arguments are supplied"
+}
+
+no_arguments_body()
+{
+	atf_check -s not-exit:0 -e match:"$usage_output" rmdir
+}
+
+atf_init_test_cases()
+{
+	atf_add_test_case invalid_usage
+	atf_add_test_case no_arguments
+}


Property changes on: trunk/bin/rmdir/tests/rmdir_test.sh
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property


More information about the Midnightbsd-cvs mailing list