From owner-svn-src-stable@freebsd.org Tue Jul 18 18:48:26 2017 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D9F21D9D28A; Tue, 18 Jul 2017 18:48:26 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B40E37F263; Tue, 18 Jul 2017 18:48:26 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6IImPGf090926; Tue, 18 Jul 2017 18:48:25 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6IImPj3090923; Tue, 18 Jul 2017 18:48:25 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201707181848.v6IImPj3090923@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Tue, 18 Jul 2017 18:48:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r321163 - stable/10/usr.sbin/pw/tests X-SVN-Group: stable-10 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: stable/10/usr.sbin/pw/tests X-SVN-Commit-Revision: 321163 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Jul 2017 18:48:27 -0000 Author: ngie Date: Tue Jul 18 18:48:25 2017 New Revision: 321163 URL: https://svnweb.freebsd.org/changeset/base/321163 Log: MFC r319026: pw: add some basic testcases for groupshow and usershow - groupshow: test out -a/-g/-n . - usershow: test out -a/-n/-u . Added: stable/10/usr.sbin/pw/tests/pw_groupshow_test.sh - copied unchanged from r319026, head/usr.sbin/pw/tests/pw_groupshow_test.sh stable/10/usr.sbin/pw/tests/pw_usershow_test.sh - copied unchanged from r319026, head/usr.sbin/pw/tests/pw_usershow_test.sh Modified: stable/10/usr.sbin/pw/tests/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/pw/tests/Makefile ============================================================================== --- stable/10/usr.sbin/pw/tests/Makefile Tue Jul 18 18:39:54 2017 (r321162) +++ stable/10/usr.sbin/pw/tests/Makefile Tue Jul 18 18:48:25 2017 (r321163) @@ -12,10 +12,12 @@ ATF_TESTS_SH= pw_etcdir_test \ pw_groupadd_test \ pw_groupdel_test \ pw_groupmod_test \ + pw_groupshow_test \ pw_useradd_test \ pw_userdel_test \ pw_usermod_test \ - pw_usernext_test + pw_usernext_test \ + pw_usershow_test .for tp in ${ATF_TESTS_SH} TEST_METADATA.${tp}+= required_user="root" Copied: stable/10/usr.sbin/pw/tests/pw_groupshow_test.sh (from r319026, head/usr.sbin/pw/tests/pw_groupshow_test.sh) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/usr.sbin/pw/tests/pw_groupshow_test.sh Tue Jul 18 18:48:25 2017 (r321163, copy of r319026, head/usr.sbin/pw/tests/pw_groupshow_test.sh) @@ -0,0 +1,56 @@ +# $FreeBSD$ + +# Import helper functions +. $(atf_get_srcdir)/helper_functions.shin + +atf_test_case group_show_all +group_show_all_body() { + populate_etc_skel + atf_check -o not-empty ${PW} groupshow -a +} + +atf_test_case group_show_gid +group_show_gid_body() { + populate_etc_skel + atf_check -o not-empty ${PW} groupshow -g 0 +} + +atf_test_case group_show_name +group_show_name_body() { + populate_etc_skel + atf_check -o not-empty ${PW} groupshow wheel +} + +atf_test_case group_show_nonexistent_gid +group_show_nonexistent_gid_body() { + populate_etc_skel + + nonexistent_gid=4242 + no_such_name_msg="pw: unknown gid \`$nonexistent_gid'\n" + + atf_check -e "inline:$no_such_name_msg" -s exit:65 ${PW} groupshow \ + $nonexistent_gid + atf_check -e "inline:$no_such_name_msg" -s exit:65 ${PW} groupshow \ + -g $nonexistent_gid +} + +atf_test_case group_show_nonexistent_name +group_show_nonexistent_name_body() { + populate_etc_skel + + nonexistent_name=bogus + no_such_name_msg="pw: unknown group \`$nonexistent_name'\n" + + atf_check -e "inline:$no_such_name_msg" -s exit:65 ${PW} groupshow \ + $nonexistent_name + atf_check -e "inline:$no_such_name_msg" -s exit:65 ${PW} groupshow \ + -n $nonexistent_name +} + +atf_init_test_cases() { + atf_add_test_case group_show_all + atf_add_test_case group_show_gid + atf_add_test_case group_show_name + atf_add_test_case group_show_nonexistent_gid + atf_add_test_case group_show_nonexistent_name +} Copied: stable/10/usr.sbin/pw/tests/pw_usershow_test.sh (from r319026, head/usr.sbin/pw/tests/pw_usershow_test.sh) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/usr.sbin/pw/tests/pw_usershow_test.sh Tue Jul 18 18:48:25 2017 (r321163, copy of r319026, head/usr.sbin/pw/tests/pw_usershow_test.sh) @@ -0,0 +1,56 @@ +# $FreeBSD$ + +# Import helper functions +. $(atf_get_srcdir)/helper_functions.shin + +atf_test_case user_show_all +user_show_all_body() { + populate_etc_skel + atf_check -o not-empty ${PW} usershow -a +} + +atf_test_case user_show_name +user_show_name_body() { + populate_etc_skel + atf_check -o not-empty ${PW} usershow root +} + +atf_test_case user_show_nonexistent_name +user_show_nonexistent_name_body() { + populate_etc_skel + + nonexistent_user=bogus + no_such_user_msg="pw: no such user \`$nonexistent_user'\n" + + atf_check -e "inline:$no_such_user_msg" -s exit:67 ${PW} usershow \ + $nonexistent_user + atf_check -e "inline:$no_such_user_msg" -s exit:67 ${PW} usershow \ + -n $nonexistent_user +} + +atf_test_case user_show_nonexistent_uid +user_show_nonexistent_uid_body() { + populate_etc_skel + + nonexistent_uid=4242 + no_such_uid_msg="pw: no such uid \`$nonexistent_uid'\n" + + atf_check -e "inline:$no_such_uid_msg" -s exit:67 ${PW} usershow \ + $nonexistent_uid + atf_check -e "inline:$no_such_uid_msg" -s exit:67 ${PW} usershow \ + -u $nonexistent_uid +} + +atf_test_case user_show_uid +user_show_uid_body() { + populate_etc_skel + atf_check -o not-empty ${PW} usershow -u 0 +} + +atf_init_test_cases() { + atf_add_test_case user_show_all + atf_add_test_case user_show_name + atf_add_test_case user_show_nonexistent_name + atf_add_test_case user_show_nonexistent_uid + atf_add_test_case user_show_uid +}