aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rwxr-xr-xtests/tar.test8
-rwxr-xr-xtests/test_human_readable.test18
-rwxr-xr-xtests/useradd.test28
3 files changed, 27 insertions, 27 deletions
diff --git a/tests/tar.test b/tests/tar.test
index 5b10b014..034b7a3b 100755
--- a/tests/tar.test
+++ b/tests/tar.test
@@ -42,7 +42,7 @@ mkdir -p dir/dir1 dir/dir2 dir/dir3 dir/dir4
echo "This is testdata" > dir/dir1/file; echo "Dont exclude me" > dir/dir3/file1 ;
echo "Exclude me" > dir/dir3/file2 ; echo "YO" > dir/dir4/file1 ; echo "Hello" >dir/dir4/file2; echo "Dont" > dir/dir2/file1
echo -ne "dir/dir4\ndir/dir3/file2\n" > exclude_file
-testing "Creating tar with files excluded : -X" "tar -czf dir.tgz dir/ -X exclude_file ; rm -rf dir ; tar -tf dir.tgz | sort; rm -rf dir.tgz " "dir/\ndir/dir1/\ndir/dir1/file\ndir/dir2/\ndir/dir2/file1\ndir/dir3/\ndir/dir3/file1\n" "" ""
+testing "tar create with files excluded : -X" "tar -czf dir.tgz dir/ -X exclude_file ; rm -rf dir ; tar -tf dir.tgz | sort; rm -rf dir.tgz " "dir/\ndir/dir1/\ndir/dir1/file\ndir/dir2/\ndir/dir2/file1\ndir/dir3/\ndir/dir3/file1\n" "" ""
rm -rf exclude_file
#Creating nested directory
@@ -55,7 +55,7 @@ testing "tar with pattern --exclude" "tar --exclude=dir/dir3/* -czf dir.tgz dir/
mkdir dir/dir1 -p
echo "This is testdata" > dir/dir1/file
mkdir temp
-testing "Extraction with -C Dir" "tar -czf dir.tgz dir/ ;rm -rf dir ;tar -xf dir.tgz -C temp/ ; [ -e temp/dir ] && echo 'yes' ; rm -rf dir dir.tgz" "yes\n" "" ""
+testing "tar extract with -C Dir" "tar -czf dir.tgz dir/ ;rm -rf dir ;tar -xf dir.tgz -C temp/ ; [ -e temp/dir ] && echo 'yes' ; rm -rf dir dir.tgz" "yes\n" "" ""
rm -rf temp
#Creating nested directory
@@ -63,14 +63,14 @@ mkdir dir/dir1 -p ; mkdir dir/dir2 ; mkdir dir/dir3 ; mkdir dir/dir4 ; mkdir t
echo "dir1/file" > dir/dir1/file ; echo "temp_dir/file" > temp_dir/file
echo "dir3/file1" > dir/dir3/file1 ; echo "dir3/file2" > dir/dir3/file2 ; echo "YO" > dir/dir4/file1 ; echo "Hello" >dir/dir4/file2; echo "dir2/file1" > dir/dir2/file1
echo "temp_dir/file" > exclude_file
-testing "Creating tar extra files/directory included : -T" "tar -czf dir.tgz dir/ -T exclude_file ; rm -rf dir ; tar -tf dir.tgz | sort; rm -rf dir.tgz " "dir/\ndir/dir1/\ndir/dir1/file\ndir/dir2/\ndir/dir2/file1\ndir/dir3/\ndir/dir3/file1\ndir/dir3/file2\ndir/dir4/\ndir/dir4/file1\ndir/dir4/file2\ntemp_dir/file\n" "" ""
+testing "tar create with extra files/directory included : -T" "tar -czf dir.tgz dir/ -T exclude_file ; rm -rf dir ; tar -tf dir.tgz | sort; rm -rf dir.tgz " "dir/\ndir/dir1/\ndir/dir1/file\ndir/dir2/\ndir/dir2/file1\ndir/dir3/\ndir/dir3/file1\ndir/dir3/file2\ndir/dir4/\ndir/dir4/file1\ndir/dir4/file2\ntemp_dir/file\n" "" ""
rm -rf exclude_file
rm -rf temp_dir
#Creating dir
mkdir dir/dir1 -p
echo "Inside dir/dir1" > dir/dir1/file ; echo "Hello Inside dir" > dir/file
-testing "Extraction on STDOUT : -O" " tar -czf dir.tgz dir/ ; rm -rf dir ; tar -xf dir.tgz -O ; [ -e 'Inside dir/dir1/\nHello Inside dir\n' ] && echo 'yes'; rm -rf dir.tgz " "" "" ""
+testing "tar extract to STDOUT : -O" " tar -czf dir.tgz dir/ ; rm -rf dir ; tar -xf dir.tgz -O ; [ -e 'Inside dir/dir1/\nHello Inside dir\n' ] && echo 'yes'; rm -rf dir.tgz " "" "" ""
#Creating short filename
f="filename_with_100_chars_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
diff --git a/tests/test_human_readable.test b/tests/test_human_readable.test
index a7533b7f..26ebd668 100755
--- a/tests/test_human_readable.test
+++ b/tests/test_human_readable.test
@@ -4,16 +4,16 @@
#testing "name" "command" "result" "infile" "stdin"
-testing "human_readable l 1024" "test_human_readable 123456789" "118M\n" "" ""
-testing "human_readable l 1000" "test_human_readable -i 123456789" "123M\n" "" ""
-testing "human_readable s 1024" "test_human_readable 5675" "5.5K\n" "" ""
-testing "human_readable s 1000" "test_human_readable -i 5675" "5.6k\n" "" ""
+testing "test_human_readable l 1024" "test_human_readable 123456789" "118M\n" "" ""
+testing "test_human_readable l 1000" "test_human_readable -i 123456789" "123M\n" "" ""
+testing "test_human_readable s 1024" "test_human_readable 5675" "5.5K\n" "" ""
+testing "test_human_readable s 1000" "test_human_readable -i 5675" "5.6k\n" "" ""
# An example input where we give a better result than coreutils.
# 267350/1024=261.08. We say 261K and coreutils says 262K.
-testing "human_readable" "test_human_readable 267350" "261K\n" "" ""
+testing "test_human_readable" "test_human_readable 267350" "261K\n" "" ""
-testing "human_readable -b" "test_human_readable -b 123" "123B\n" "" ""
-testing "human_readable -b" "test_human_readable -b 123456789" "118M\n" "" ""
-testing "human_readable -s" "test_human_readable -s 123456789" "118 M\n" "" ""
-testing "human_readable -bs" "test_human_readable -bs 123456789" "118 M\n" "" ""
+testing "test_human_readable -b" "test_human_readable -b 123" "123B\n" "" ""
+testing "test_human_readable -b" "test_human_readable -b 123456789" "118M\n" "" ""
+testing "test_human_readable -s" "test_human_readable -s 123456789" "118 M\n" "" ""
+testing "test_human_readable -bs" "test_human_readable -bs 123456789" "118 M\n" "" ""
diff --git a/tests/useradd.test b/tests/useradd.test
index 6ffe7071..90b65019 100755
--- a/tests/useradd.test
+++ b/tests/useradd.test
@@ -21,83 +21,83 @@ arg="&>/dev/null"
pass=`echo -ne 'password\npassword\n'`
user="toyTestUser"
-testing "adduser user_name (text)" "useradd $user $arg ||
+testing "useradd (text)" "useradd $user $arg ||
grep '^$user:' /etc/passwd $arg && [ -d /home/$user ] &&
echo 'yes'" "yes\n" "" "$pass"
userdel -r $user $arg
user="toy1Test2User3"
-testing "adduser user_name (alphanumeric)" "useradd $user $arg ||
+testing "useradd (alphanumeric)" "useradd $user $arg ||
grep '^$user:' /etc/passwd $arg && [ -d /home/$user ] &&
echo 'yes'" "yes\n" "" "$pass"
userdel -r $user $arg
user="987654321"
-testing "adduser user_name (numeric)" "useradd $user $arg ||
+testing "useradd (numeric)" "useradd $user $arg ||
grep '^$user:' /etc/passwd $arg && [ -d /home/$user ] &&
echo 'yes'" "yes\n" "" "$pass"
userdel -r $user $arg
user="toy.1Test-2User_3"
-testing "adduser user_name (with ./-/_)" "useradd $user $arg ||
+testing "useradd (with ./-/_)" "useradd $user $arg ||
grep '^$user:' /etc/passwd $arg && [ -d /home/$user ] &&
echo 'yes'" "yes\n" "" "$pass"
userdel -r $user $arg
# 70 characters long string; hereafter, we will use it as per our need.
user="abcdefghijklmnopqrstuvwxyz123456789abcdefghijklmnopqrstuvwxyz123456789"
-testing "adduser user_name (long string)" "useradd $user $arg ||
+testing "useradd (long string)" "useradd $user $arg ||
grep '^$user:' /etc/passwd $arg && [ -d /home/$user ] &&
echo 'yes'" "yes\n" "" "$pass"
userdel -r $user $arg
user="toyTestUser"
-testing "adduser user_name with dir" "useradd -h $PWD/dir $user $arg ||
+testing "useradd dir" "useradd -h $PWD/dir $user $arg ||
grep '^$user:.*dir' /etc/passwd $arg && [ -d $PWD/dir ] &&
echo 'yes'" "yes\n" "" "$pass"
userdel -r $user $arg
rm -rf $PWD/dir
gecos="aaa,bbb,ccc,ddd,eee"
-testing "adduser user_name with gecos" "useradd -g '$gecos' $user $arg ||
+testing "useradd gecos" "useradd -g '$gecos' $user $arg ||
grep '^$user:.*$gecos' /etc/passwd $arg && [ -d /home/$user ] &&
echo 'yes'" "yes\n" "" "$pass"
userdel -r $user $arg
shl="/bin/sh"
-testing "adduser user_name with shell" "useradd -s $shl $user $arg ||
+testing "useradd shell" "useradd -s $shl $user $arg ||
grep '^$user:.*$shl$' /etc/passwd $arg && [ -d /home/$user ] &&
echo 'yes'" "yes\n" "" "$pass"
userdel -r $user $arg
g_name="root"
g_id=`grep $g_name':.*:.*' /etc/group | cut -d : -f 3`
-testing "adduser user_name with group" "useradd -G $g_name $user $arg ||
+testing "useradd group" "useradd -G $g_name $user $arg ||
grep '^$user:.*:.*:$g_id:.*' /etc/passwd $arg && [ -d /home/$user ] &&
echo 'yes'" "yes\n" "" "$pass"
userdel -r $user $arg
-testing "adduser user_name (system user)" "useradd -S $user $arg ||
+testing "useradd (system user)" "useradd -S $user $arg ||
grep '^$user:.*:.*:.*' /etc/passwd $arg && [ ! -e /home/$user ] &&
echo 'yes'" "yes\n" "" "$pass"
userdel -r $user $arg
-testing "adduser user_name with -D" "useradd -D $user $arg ||
+testing "useradd -D" "useradd -D $user $arg ||
grep '^$user:.*:.*:.*' /etc/passwd $arg && [ -d /home/$user ] &&
echo 'yes'" "yes\n" "" "$pass"
userdel -r $user $arg
-testing "adduser user_name with -H" "useradd -H $user $arg ||
+testing "useradd -H" "useradd -H $user $arg ||
grep '^$user:.*:.*:.*' /etc/passwd $arg && [ ! -e /home/$user ] &&
echo 'yes'" "yes\n" "" "$pass"
userdel -r $user $arg
-testing "adduser user_name with dir and -H" "useradd -H -h $PWD/dir $user $arg ||
+testing "useradd dir and -H" "useradd -H -h $PWD/dir $user $arg ||
grep '^$user:.*dir' /etc/passwd $arg && [ ! -e $PWD/dir ] &&
echo 'yes'" "yes\n" "" "$pass"
userdel -r $user $arg
-testing "adduser user_name with user_id" "useradd -u 49999 $user $arg ||
+testing "useradd -u" "useradd -u 49999 $user $arg ||
grep '^$user:x:49999:.*' /etc/passwd $arg && [ -d /home/$user ] &&
echo 'yes'" "yes\n" "" "$pass"
userdel -r $user $arg