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

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