From: Radka Skvarilova Date: Mon, 16 Dec 2019 09:57:32 +0000 (+0100) Subject: tests: add new test for chfn gecos X-Git-Tag: v2.35-rc2~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=02238bff663ce5fe823980d8119f3871cc348764;p=thirdparty%2Futil-linux.git tests: add new test for chfn gecos Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=1743555 Signed-off-by: Karel Zak --- diff --git a/tests/commands.sh b/tests/commands.sh index 7b480dcc0b..5f34452737 100644 --- a/tests/commands.sh +++ b/tests/commands.sh @@ -107,3 +107,4 @@ TS_CMD_UUIDPARSE=${TS_CMD_UUIDPARSE-"${ts_commandsdir}uuidparse"} TS_CMD_WHEREIS=${TS_CMD_WHEREIS-"${ts_commandsdir}whereis"} TS_CMD_WIPEFS=${TS_CMD_WIPEFS-"${ts_commandsdir}wipefs"} TS_CMD_CHRT=${TS_CMD_CHRT-"${ts_commandsdir}chrt"} +TS_CMD_CHFN=${TS_CMD_CHFN-"${ts_commandsdir}chfn"} diff --git a/tests/expected/chfn/gecos b/tests/expected/chfn/gecos new file mode 100644 index 0000000000..af7b81b6ca --- /dev/null +++ b/tests/expected/chfn/gecos @@ -0,0 +1,6 @@ +Initialize user +testuser_chfn_test:x:9899:9899::/home/testuser_chfn_test:/bin/bash +Changing finger information for testuser_chfn_test. + +Finger information changed. +testuser_chfn_test:x:9899:9899:test_gecos:/home/testuser_chfn_test:/bin/bash diff --git a/tests/ts/chfn/gecos b/tests/ts/chfn/gecos new file mode 100755 index 0000000000..159ceff715 --- /dev/null +++ b/tests/ts/chfn/gecos @@ -0,0 +1,36 @@ +#!/bin/bash + +# +# Copyright (C) 2019 Radka Skvarilova +# +# This file is part of util-linux. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# + +TS_TOPDIR="${0%/*}/../.." +TS_DESC="gecos" + +. $TS_TOPDIR/functions.sh +ts_init "$*" + +ts_skip_nonroot +ts_check_test_command "$TS_CMD_CHFN" +ts_check_prog "useradd" +ts_check_prog "userdel" + +ts_log "Initialize user" +useradd -u 9899 testuser_chfn_test +grep testuser /etc/passwd >> $TS_OUTPUT +$TS_CMD_CHFN -f test_gecos testuser_chfn_test >>$TS_OUTPUT +grep testuser /etc/passwd >> $TS_OUTPUT +userdel --remove testuser_chfn_test &> /dev/null +ts_finalize