[libgsf] Tests: more basic tests
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgsf] Tests: more basic tests
- Date: Mon, 1 Dec 2014 20:55:17 +0000 (UTC)
commit 694a24d6eb76d4002c94cadf45de50dd95d4bc08
Author: Morten Welinder <terra gnome org>
Date: Mon Dec 1 15:54:55 2014 -0500
Tests: more basic tests
tests/LibGsfTest.pm | 14 +++++++++++---
tests/Makefile.am | 3 +++
tests/t1001-zip-multiple.pl | 8 ++++++++
tests/t1002-zip-aaaa.pl | 17 +++++++++++++++++
tests/t1003-zip-noise.pl | 12 ++++++++++++
5 files changed, 51 insertions(+), 3 deletions(-)
---
diff --git a/tests/LibGsfTest.pm b/tests/LibGsfTest.pm
index 2ebdbfe..4d56998 100644
--- a/tests/LibGsfTest.pm
+++ b/tests/LibGsfTest.pm
@@ -269,10 +269,17 @@ sub test_zip {
}
{
- my $cmd = "earg ('unzip', '-q', '-t', $archive);
+ my $cmd = "earg ($unzip, '-q', '-t', $archive);
print "# $cmd\n";
my $code = system ("$cmd 2>&1 | sed -e 's/^/| /'");
- &system_failure ($gsf, $code) if $code;
+ &system_failure ($unzip, $code) if $code;
+ }
+
+ if ($verbose) {
+ my $cmd = "earg ($zipinfo, '-v', $archive);
+ print "# $cmd\n";
+ my $code = system ("$cmd 2>&1 | sed -e 's/^/| /'");
+ &system_failure ($zipinfo, $code) if $code;
}
foreach my $file (@$pfiles) {
@@ -280,12 +287,13 @@ sub test_zip {
print "# $cmd\n";
my $stored_data = `$cmd`;
- my $cmd = "earg ('cat', $file);
+ $cmd = "earg ('cat', $file);
print "# $cmd\n";
my $original_data = `$cmd`;
die "Mismatch for member $file\n"
unless $stored_data eq $original_data;
+ print "# Member $file matched.\n";
}
}
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 0e39d21..30b6ec0 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -13,6 +13,9 @@
TESTS_EXTENSIONS=.pl
TESTS = t1000-zip-single.pl \
+ t1001-zip-multiple.pl \
+ t1002-zip-aaaa.pl \
+ t1003-zip-noise.pl \
t9999-epilogue.pl
SUPPS = common.supp
diff --git a/tests/t1001-zip-multiple.pl b/tests/t1001-zip-multiple.pl
new file mode 100755
index 0000000..50ccfd3
--- /dev/null
+++ b/tests/t1001-zip-multiple.pl
@@ -0,0 +1,8 @@
+#!/usr/bin/perl -w
+# -----------------------------------------------------------------------------
+
+use strict;
+use lib ($0 =~ m|^(.*/)| ? $1 : ".");
+use LibGsfTest;
+
+&test_zip ('files' => ['Makefile.am', 'common.supp']);
diff --git a/tests/t1002-zip-aaaa.pl b/tests/t1002-zip-aaaa.pl
new file mode 100755
index 0000000..dff15a6
--- /dev/null
+++ b/tests/t1002-zip-aaaa.pl
@@ -0,0 +1,17 @@
+#!/usr/bin/perl -w
+# -----------------------------------------------------------------------------
+
+use strict;
+use lib ($0 =~ m|^(.*/)| ? $1 : ".");
+use LibGsfTest;
+use FileHandle;
+
+my $aaaa = 'aaaa.txt';
+{
+ &LibGsfTest::junkfile ($aaaa);
+ my $f = new FileHandle ($aaaa, 'w') or
+ die "Failed to create $aaaa: $!\n";
+ print $f "a"x10000000;
+}
+
+&test_zip ('files' => [$aaaa]);
diff --git a/tests/t1003-zip-noise.pl b/tests/t1003-zip-noise.pl
new file mode 100755
index 0000000..c86102b
--- /dev/null
+++ b/tests/t1003-zip-noise.pl
@@ -0,0 +1,12 @@
+#!/usr/bin/perl -w
+# -----------------------------------------------------------------------------
+
+use strict;
+use lib ($0 =~ m|^(.*/)| ? $1 : ".");
+use LibGsfTest;
+use FileHandle;
+
+my $noise = 'noise.txt';
+&LibGsfTest::junkfile ($noise);
+system ("dd", "if=/dev/urandom", "of=$noise", "bs=1M", "count=10");
+&test_zip ('files' => [$noise]);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]