summaryrefslogtreecommitdiffstats
path: root/testsuite/test7.pl
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/test7.pl')
-rw-r--r--testsuite/test7.pl33
1 files changed, 33 insertions, 0 deletions
diff --git a/testsuite/test7.pl b/testsuite/test7.pl
new file mode 100644
index 0000000..0a3596c
--- /dev/null
+++ b/testsuite/test7.pl
@@ -0,0 +1,33 @@
+#!/usr/bin/perl -w
+
+# expect:
+# - a new system user $USER
+# - Second execution of command does not return an error.
+
+use strict;
+use lib_test;
+
+my $username = find_unused_name();
+
+my $cmd = "adduser --system $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;
+ }
+ `$cmd`;
+ $error = ($?>>8);
+ if ($error) {
+ print "failed\n double execution with same parameters showed an error (return code $error)\n";
+ exit $error;
+ }
+
+ assert(check_user_exist ($username));
+ assert(check_homedir_exist ($username));
+ print "ok\n";
+}
+