]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests: add new test for chfn gecos
authorRadka Skvarilova <rskvaril@redhat.com>
Mon, 16 Dec 2019 09:57:32 +0000 (10:57 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 16 Dec 2019 12:22:29 +0000 (13:22 +0100)
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=1743555
Signed-off-by: Karel Zak <kzak@redhat.com>
tests/commands.sh
tests/expected/chfn/gecos [new file with mode: 0644]
tests/ts/chfn/gecos [new file with mode: 0755]

index 7b480dcc0b1bb8fb82c1af288c38ca87083ca359..5f34452737f7333a2c11ed605ffb5b78e95d5bb3 100644 (file)
@@ -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 (file)
index 0000000..af7b81b
--- /dev/null
@@ -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 (executable)
index 0000000..159ceff
--- /dev/null
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2019 Radka Skvarilova <rskvaril@redhat.com>
+#
+# 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