From 32e0ba8ebdadc47ac1a0da8d9a9668ff21909e4f Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 07:55:27 +0200 Subject: Adding upstream version 3.118+deb11u1. Signed-off-by: Daniel Baumann --- testsuite/test1.pl | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 testsuite/test1.pl (limited to 'testsuite/test1.pl') diff --git a/testsuite/test1.pl b/testsuite/test1.pl new file mode 100644 index 0000000..d2e62c6 --- /dev/null +++ b/testsuite/test1.pl @@ -0,0 +1,45 @@ +#!/usr/bin/perl -w + +# expect: +# - a new system user $USER +# - added to group nogroup +# - home directory /home/$USER +# - removal of home directory works + +use strict; +use lib_test; + +my $groupname = "nogroup"; +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; + } + assert(check_user_exist ($username)); + assert(check_homedir_exist($username)); + assert(check_group_exist($groupname)); + assert(check_user_in_group($username,$groupname)); + print "ok\n"; +} + +$cmd = "deluser --remove-home $username"; +if (defined (getpwnam($username))) { + my $homedir = (getpwnam($username))[7]; + print "Testing $cmd... "; + `$cmd`; + my $error = ($?>>8); + if ($error) { + print "failed\n adduser returned an errorcode != 0 ($error)\n"; + exit $error; + } + assert(check_user_not_exist ($username)); + assert(check_homedir_not_exist($homedir)); + print "ok\n"; +} + -- cgit v1.2.3