[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[SCM] Debian package checker branch, master, updated. 2.3.3-62-g61f1ef5



The following commit has been merged in the master branch:
commit 7d071b576184b879e5ca24deff44ae19dee7bbd2
Author: Raphael Geissert <atomo64@gmail.com>
Date:   Sun Mar 21 12:47:50 2010 -0600

    Add support for architecture-specific tests to t/runtests
    
    * t/runtests:
      + [RG] Add support for architecture-specific tests.

diff --git a/debian/changelog b/debian/changelog
index 856a9d5..f8afb8e 100755
--- a/debian/changelog
+++ b/debian/changelog
@@ -123,6 +123,9 @@ lintian (2.3.4) UNRELEASED; urgency=low
   * testset/etcfiles/:
     + [RA] Fix problems with the md5sums test suite construction in the
       legacy etcfiles test.  Thanks, Frank Lin PIAT.  (Closes: #573081)
+
+  * t/runtests:
+    + [RG] Add support for architecture-specific tests.
   * t/tests/binaries-multiarch/:
     + [RG] Fix test failure in non-i386 architectures by normalising the
       expected output.  Thanks, Niko Tyni.  (Closes: #568680)
diff --git a/t/runtests b/t/runtests
index af53b28..5974902 100755
--- a/t/runtests
+++ b/t/runtests
@@ -63,6 +63,8 @@ our $LINTIAN = $LINTIAN_ROOT . '/frontend/lintian';
 our $DPKG_BUILDPACKAGE = 'dpkg-buildpackage -rfakeroot -us -uc -d'
     . ' -iNEVER_MATCH_ANYTHING -INEVER_MATCH_ANYTHING';
 our $STANDARDS_VERSION = '3.8.4';
+our $ARCHITECTURE = `dpkg-architecture -qDEB_HOST_ARCH`;
+chomp $ARCHITECTURE;
 
 # --- Usage information
 
@@ -378,7 +380,11 @@ sub find_tests_for_tag {
 sub test_package {
     my ($testdata) = @_;
 
-    check_test_is_sane($TESTSET, $testdata);
+    if (!check_test_is_sane($TESTSET, $testdata)) {
+	print "Skipping test $testdata->{testname} $testdata->{version}... architecture mismatch\n";
+	return 1;
+    }
+
     print "Running test $testdata->{testname} $testdata->{version}... ";
 
     my $pkg = $testdata->{srcpkg};
@@ -761,6 +767,16 @@ sub check_test_is_sane {
     if ($DEBUG) {
 	print "check_test_is_sane => ".Dumper($data);
     }
+
+    my @architectures = qw(all any);
+    push @architectures, $ARCHITECTURE;
+
+    # Check for arch-specific tests
+    if (!grep { $data->{architecture} =~ m/\b$_\b/ } @architectures) {
+	return 0;
+    }
+
+    return 1;
 }
 
 # Local Variables:
diff --git a/t/tests/README b/t/tests/README
index e42490b..8e79bc1 100644
--- a/t/tests/README
+++ b/t/tests/README
@@ -281,3 +281,7 @@ Tests will generally fall into one of four basic types:
    on an empty source package) or generic-empty (a package missing
    everything that dpkg-buildpackage will let one get away with
    missing).
+
+If you by any reason need to write an architecture-specific test case,
+make sure the target architectures are properly listed _in the desc
+file_.  runtests will in then handle this special test correctly.
diff --git a/t/tests/runtests-arch-amd64/debian/debian/install b/t/tests/runtests-arch-amd64/debian/debian/install
new file mode 100644
index 0000000..a2cc8ff
--- /dev/null
+++ b/t/tests/runtests-arch-amd64/debian/debian/install
@@ -0,0 +1 @@
+dummy usr/share/package/
diff --git a/t/tests/runtests-arch-amd64/debian/dummy b/t/tests/runtests-arch-amd64/debian/dummy
new file mode 100644
index 0000000..5c3118d
--- /dev/null
+++ b/t/tests/runtests-arch-amd64/debian/dummy
@@ -0,0 +1 @@
+dummy file
diff --git a/t/tests/runtests-arch-amd64/desc b/t/tests/runtests-arch-amd64/desc
new file mode 100644
index 0000000..a9dcaa0
--- /dev/null
+++ b/t/tests/runtests-arch-amd64/desc
@@ -0,0 +1,5 @@
+Testname: runtests-arch-amd64
+Sequence: 0700
+Version: 1.0
+Architecture: amd64
+Description: Test a package that is supposedly amd64-specific
diff --git a/t/debs/deb-format-record-size/tags b/t/tests/runtests-arch-amd64/tags
similarity index 100%
copy from t/debs/deb-format-record-size/tags
copy to t/tests/runtests-arch-amd64/tags
diff --git a/t/tests/runtests-arch-i386/debian/debian/install b/t/tests/runtests-arch-i386/debian/debian/install
new file mode 100644
index 0000000..a2cc8ff
--- /dev/null
+++ b/t/tests/runtests-arch-i386/debian/debian/install
@@ -0,0 +1 @@
+dummy usr/share/package/
diff --git a/t/tests/runtests-arch-i386/debian/dummy b/t/tests/runtests-arch-i386/debian/dummy
new file mode 100644
index 0000000..5c3118d
--- /dev/null
+++ b/t/tests/runtests-arch-i386/debian/dummy
@@ -0,0 +1 @@
+dummy file
diff --git a/t/tests/runtests-arch-i386/desc b/t/tests/runtests-arch-i386/desc
new file mode 100644
index 0000000..e448bc2
--- /dev/null
+++ b/t/tests/runtests-arch-i386/desc
@@ -0,0 +1,5 @@
+Testname: runtests-arch-i386
+Sequence: 0700
+Version: 1.0
+Architecture: i386
+Description: Test a package that is supposedly i386-specific
diff --git a/t/debs/deb-format-record-size/tags b/t/tests/runtests-arch-i386/tags
similarity index 100%
copy from t/debs/deb-format-record-size/tags
copy to t/tests/runtests-arch-i386/tags

-- 
Debian package checker


Reply to: