Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Add a test case for PR bin/39546.



details:   https://anonhg.NetBSD.org/src/rev/16251364f215
branches:  trunk
changeset: 778908:16251364f215
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Thu Apr 19 18:51:35 2012 +0000

description:
Add a test case for PR bin/39546.

diffstat:

 distrib/sets/lists/tests/mi         |   5 ++-
 etc/mtree/NetBSD.dist.tests         |   3 +-
 tests/usr.sbin/Makefile             |   4 +-
 tests/usr.sbin/useradd/Makefile     |  11 ++++++++
 tests/usr.sbin/useradd/t_useradd.sh |  50 +++++++++++++++++++++++++++++++++++++
 5 files changed, 69 insertions(+), 4 deletions(-)

diffs (116 lines):

diff -r f49f0a2593dd -r 16251364f215 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Thu Apr 19 18:07:05 2012 +0000
+++ b/distrib/sets/lists/tests/mi       Thu Apr 19 18:51:35 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.464 2012/04/14 12:21:45 jruoho Exp $
+# $NetBSD: mi,v 1.465 2012/04/19 18:51:36 jruoho Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -3246,6 +3246,9 @@
 ./usr/tests/usr.sbin/traceroute                        tests-usr.sbin-tests
 ./usr/tests/usr.sbin/traceroute/Atffile                tests-usr.sbin-tests    atf
 ./usr/tests/usr.sbin/traceroute/t_traceroute   tests-usr.sbin-tests    atf
+./usr/tests/usr.sbin/useradd                   tests-usr.sbin-tests
+./usr/tests/usr.sbin/useradd/Atffile           tests-usr.sbin-tests    atf
+./usr/tests/usr.sbin/useradd/t_useradd         tests-usr.sbin-tests    atf
 ./usr/tests/util                               tests-obsolete          obsolete
 ./usr/tests/util/Atffile                       tests-obsolete          obsolete
 ./usr/tests/util/awk                           tests-obsolete          obsolete
diff -r f49f0a2593dd -r 16251364f215 etc/mtree/NetBSD.dist.tests
--- a/etc/mtree/NetBSD.dist.tests       Thu Apr 19 18:07:05 2012 +0000
+++ b/etc/mtree/NetBSD.dist.tests       Thu Apr 19 18:51:35 2012 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: NetBSD.dist.tests,v 1.74 2012/04/14 12:21:46 jruoho Exp $
+#      $NetBSD: NetBSD.dist.tests,v 1.75 2012/04/19 18:51:36 jruoho Exp $
 
 ./usr/libdata/debug/usr/tests
 ./usr/libdata/debug/usr/tests/atf
@@ -300,3 +300,4 @@
 ./usr/tests/usr.sbin/mtree
 ./usr/tests/usr.sbin/tcpdump
 ./usr/tests/usr.sbin/traceroute
+./usr/tests/usr.sbin/useradd
diff -r f49f0a2593dd -r 16251364f215 tests/usr.sbin/Makefile
--- a/tests/usr.sbin/Makefile   Thu Apr 19 18:07:05 2012 +0000
+++ b/tests/usr.sbin/Makefile   Thu Apr 19 18:51:35 2012 +0000
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.3 2012/04/14 12:21:45 jruoho Exp $
+# $NetBSD: Makefile,v 1.4 2012/04/19 18:51:35 jruoho Exp $
 .include <bsd.own.mk>
 
 TESTSDIR=       ${TESTSBASE}/usr.sbin
 
-TESTS_SUBDIRS+= mtree tcpdump traceroute
+TESTS_SUBDIRS+= mtree tcpdump traceroute useradd
 
 .include <bsd.test.mk>
diff -r f49f0a2593dd -r 16251364f215 tests/usr.sbin/useradd/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.sbin/useradd/Makefile   Thu Apr 19 18:51:35 2012 +0000
@@ -0,0 +1,11 @@
+# $NetBSD: Makefile,v 1.1 2012/04/19 18:51:35 jruoho Exp $
+
+NOMAN=         # defined
+
+.include <bsd.own.mk>
+
+TESTSDIR=      ${TESTSBASE}/usr.sbin/useradd
+
+TESTS_SH=      t_useradd
+
+.include <bsd.test.mk>
diff -r f49f0a2593dd -r 16251364f215 tests/usr.sbin/useradd/t_useradd.sh
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.sbin/useradd/t_useradd.sh       Thu Apr 19 18:51:35 2012 +0000
@@ -0,0 +1,50 @@
+# $NetBSD: t_useradd.sh,v 1.1 2012/04/19 18:51:36 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.
+#
+username="test5678901234567"
+
+atf_test_case longname cleanup
+longname_head() {
+       atf_set "require.user" "root"
+       atf_set "descr" "Test that usernames longer than 16 " \
+                       "characters are allowed (PR bin/39546)"
+}
+
+longname_body() {
+       atf_expect_fail "PR bin/39546"
+       atf_check -s exit:0 -o ignore -e ignore -x "useradd $username"
+}
+
+longname_cleanup() {
+       atf_check -s ignore -o ignore -e ignore -x "userdel $username"
+}
+
+atf_init_test_cases() {
+       atf_add_test_case longname
+}



Home | Main Index | Thread Index | Old Index