diff options
author | Tom Marshall <tdm@cyngn.com> | 2016-02-09 18:32:40 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2016-02-10 22:34:51 -0600 |
commit | 5b61086cac812b60d21e8cfe0e74920f791bc5bc (patch) | |
tree | 5f37c118613df25648509676ad4a0f645e593cd8 /tests | |
parent | 62b53ed9e64e40d2534f1239c4b314d84e79f15f (diff) | |
download | toybox-5b61086cac812b60d21e8cfe0e74920f791bc5bc.tar.gz |
toybox: tar: Fix tar tests
Don't rely on ordering of readdir for tests.
Change-Id: Ice24bb64ce453acb0006e3746677d619db933ab1
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/tar.test | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/tar.test b/tests/tar.test index 187186a8..872e7c02 100755 --- a/tests/tar.test +++ b/tests/tar.test @@ -34,22 +34,22 @@ testing "tar - compession and extraction of a empty file" "tar -czf testFile.tgz #Creating dir mkdir dir/dir1 -p touch dir/dir1/file1 dir/dir1/file2 dir/dir1/file3 dir/dir1/file4 -testing "tar -t option" "tar -czf dir.tar.gz dir/; rm -rf dir; tar -tf dir.tar.gz; rm -rf dir.tar.gz" "dir/\ndir/dir1/\ndir/dir1/file2\ndir/dir1/file4\ndir/dir1/file3\ndir/dir1/file1\n" "" "" +testing "tar -t option" "tar -czf dir.tar.gz dir/; rm -rf dir; tar -tf dir.tar.gz | sort; rm -rf dir.tar.gz" "dir/\ndir/dir1/\ndir/dir1/file1\ndir/dir1/file2\ndir/dir1/file3\ndir/dir1/file4\n" "" "" rm -rf dir/ #Creating nested directory 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 "dir/dir4\ndir/dir3/file2" > exclude_file -testing "Creating tar with files excluded : -X" "tar -cvzf dir.tgz dir/ -X exclude_file ; rm -rf dir ; tar -tf dir.tgz; rm -rf dir.tgz " "dir/\ndir/dir2/\ndir/dir2/file1\ndir/dir1/\ndir/dir1/file\ndir/dir3/\ndir/dir3/file1\ndir/\ndir/dir2/\ndir/dir2/file1\ndir/dir1/\ndir/dir1/file\ndir/dir3/\ndir/dir3/file1\n" "" "" +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" "" "" rm -rf exclude_file #Creating nested directory mkdir dir/dir1 -p ; mkdir dir/dir2 ; mkdir dir/dir3 ; mkdir 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 -testing "tar with pattern --exclude" "tar --exclude=dir/dir3/* -cvzf dir.tgz dir/ ; rm -rf dir ; tar -tf dir.tgz; rm -rf dir.tgz " "dir/\ndir/dir2/\ndir/dir2/file1\ndir/dir1/\ndir/dir1/file\ndir/dir3/\ndir/dir4/\ndir/dir4/file2\ndir/dir4/file1\ndir/\ndir/dir2/\ndir/dir2/file1\ndir/dir1/\ndir/dir1/file\ndir/dir3/\ndir/dir4/\ndir/dir4/file2\ndir/dir4/file1\n" "" "" +testing "tar with pattern --exclude" "tar --exclude=dir/dir3/* -czf dir.tgz dir/ ; 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/dir4/\ndir/dir4/file1\ndir/dir4/file2\n" "" "" #Creating directory to be compressed mkdir dir/dir1 -p @@ -63,11 +63,11 @@ 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; rm -rf dir.tgz " "dir/\ndir/dir2/\ndir/dir2/file1\ndir/dir1/\ndir/dir1/file\ndir/dir3/\ndir/dir3/file2\ndir/dir3/file1\ndir/dir4/\ndir/dir4/file2\ndir/dir4/file1\ntemp_dir/file\n" "" "" +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" "" "" 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 "Exctraction 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 "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 " "" "" "" |