summaryrefslogtreecommitdiffstats
path: root/testsuite/test4.pl
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 18:03:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 18:03:34 +0000
commitcfa700b903d57bea5c9fd42be88ad47d5bd40c0b (patch)
treedf642cc058204089bd523d6e1c70b44689caf8a3 /testsuite/test4.pl
parentInitial commit. (diff)
downloadadduser-cfa700b903d57bea5c9fd42be88ad47d5bd40c0b.tar.xz
adduser-cfa700b903d57bea5c9fd42be88ad47d5bd40c0b.zip
Adding upstream version 3.118.upstream/3.118upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testsuite/test4.pl')
-rw-r--r--testsuite/test4.pl32
1 files changed, 32 insertions, 0 deletions
diff --git a/testsuite/test4.pl b/testsuite/test4.pl
new file mode 100644
index 0000000..276031a
--- /dev/null
+++ b/testsuite/test4.pl
@@ -0,0 +1,32 @@
+#!/usr/bin/perl -w
+
+# expect:
+# - a new user $USER
+# - added to group nogroup
+# - no home directory /home/$USER
+
+use strict;
+use lib_test;
+
+my $groupname = "nogroup";
+my $username = find_unused_name();
+my $homedir = "/var/$username";
+my $cmd = "adduser --system --home $homedir --no-create-home $username";
+
+
+if (!defined (getpwnam($username))) {
+ print "Testing $cmd... ";
+ `$cmd`;
+ my $error = ($?>>8);
+ if ($error) {
+ print "failed\n adduser returned an errorcode != 0 ($error)\n";
+ exit $error;
+ }
+
+ assert(check_user_exist ($username));
+ assert(check_homedir_not_exist($homedir));
+ assert(check_group_exist($groupname));
+ assert(check_user_in_group($username,$groupname));
+ print "ok\n";
+}
+