Blame SOURCES/0032-tests-add-new-test-for-chfn-gecos.patch

936174
From 447b7d7222bf8cb3591d611aa51917bd4453f8d6 Mon Sep 17 00:00:00 2001
936174
From: Radka Skvarilova <rskvaril@redhat.com>
936174
Date: Mon, 16 Dec 2019 10:57:32 +0100
936174
Subject: [PATCH 32/32] tests: add new test for chfn gecos
936174
936174
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=1743555
936174
Upstream: http://github.com/karelzak/util-linux/commit/02238bff663ce5fe823980d8119f3871cc348764
936174
Upstream: http://github.com/karelzak/util-linux/commit/b2ef43864f24b1a9c0c67fe2a7177a5110da1b6e
936174
Signed-off-by: Karel Zak <kzak@redhat.com>
936174
---
936174
 tests/commands.sh         |  1 +
936174
 tests/expected/chfn/gecos |  6 ++++++
936174
 tests/ts/chfn/gecos       | 36 ++++++++++++++++++++++++++++++++++++
936174
 3 files changed, 43 insertions(+)
936174
 create mode 100644 tests/expected/chfn/gecos
936174
 create mode 100755 tests/ts/chfn/gecos
936174
936174
diff --git a/tests/commands.sh b/tests/commands.sh
936174
index 93100caf6..b56381c9e 100644
936174
--- a/tests/commands.sh
936174
+++ b/tests/commands.sh
936174
@@ -104,3 +104,4 @@ TS_CMD_UUIDPARSE=${TS_CMD_UUIDPARSE-"${ts_commandsdir}uuidparse"}
936174
 TS_CMD_WHEREIS=${TS_CMD_WHEREIS-"${ts_commandsdir}whereis"}
936174
 TS_CMD_WIPEFS=${TS_CMD_WIPEFS-"${ts_commandsdir}wipefs"}
936174
 TS_CMD_CHRT=${TS_CMD_CHRT-"${ts_commandsdir}chrt"}
936174
+TS_CMD_CHFN=${TS_CMD_CHFN-"${ts_commandsdir}chfn"}
936174
diff --git a/tests/expected/chfn/gecos b/tests/expected/chfn/gecos
936174
new file mode 100644
936174
index 000000000..af7b81b6c
936174
--- /dev/null
936174
+++ b/tests/expected/chfn/gecos
936174
@@ -0,0 +1,6 @@
936174
+Initialize user
936174
+testuser_chfn_test:x:9899:9899::/home/testuser_chfn_test:/bin/bash
936174
+Changing finger information for testuser_chfn_test.
936174
+
936174
+Finger information changed.
936174
+testuser_chfn_test:x:9899:9899:test_gecos:/home/testuser_chfn_test:/bin/bash
936174
diff --git a/tests/ts/chfn/gecos b/tests/ts/chfn/gecos
936174
new file mode 100755
936174
index 000000000..aad27d40a
936174
--- /dev/null
936174
+++ b/tests/ts/chfn/gecos
936174
@@ -0,0 +1,36 @@
936174
+#!/bin/bash
936174
+
936174
+#
936174
+# Copyright (C) 2019 Radka Skvarilova <rskvaril@redhat.com>
936174
+#
936174
+# This file is part of util-linux.
936174
+#
936174
+# This file is free software; you can redistribute it and/or modify
936174
+# it under the terms of the GNU General Public License as published by
936174
+# the Free Software Foundation; either version 2 of the License, or
936174
+# (at your option) any later version.
936174
+#
936174
+# This file is distributed in the hope that it will be useful,
936174
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
936174
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
936174
+# GNU General Public License for more details.
936174
+#
936174
+
936174
+TS_TOPDIR="${0%/*}/../.."
936174
+TS_DESC="gecos"
936174
+
936174
+. $TS_TOPDIR/functions.sh
936174
+ts_init "$*"
936174
+
936174
+ts_skip_nonroot
936174
+ts_check_test_command "$TS_CMD_CHFN"
936174
+ts_check_prog "useradd"
936174
+ts_check_prog "userdel"
936174
+
936174
+ts_log "Initialize user"
936174
+useradd -u 9899 --shell /bin/bash testuser_chfn_test
936174
+grep testuser /etc/passwd >> $TS_OUTPUT
936174
+$TS_CMD_CHFN -f test_gecos testuser_chfn_test >>$TS_OUTPUT
936174
+grep testuser /etc/passwd >> $TS_OUTPUT
936174
+userdel --remove testuser_chfn_test &> /dev/null
936174
+ts_finalize
936174
-- 
936174
2.21.0
936174