From 41c4729506fc9c5be5fb8309bea9c3d85f9449cc Mon Sep 17 00:00:00 2001
From: Paul Gevers <elbrus@debian.org>
Date: Sat, 21 Oct 2017 21:10:41 +0200
Subject: [PATCH] Only give bounty on passing packages if the package has a
 test suite itself

---
 britney2/policies/autopkgtest.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/britney2/policies/autopkgtest.py b/britney2/policies/autopkgtest.py
index 6955b32..bbb53d2 100644
--- a/britney2/policies/autopkgtest.py
+++ b/britney2/policies/autopkgtest.py
@@ -203,6 +203,7 @@ class AutopkgtestPolicy(BasePolicy):
 
         # add test result details to Excuse
         verdict = PolicyVerdict.PASS
+        src_has_own_test = False
         cloud_url = self.options.adt_ci_url + "packages/%(h)s/%(s)s/%(r)s/%(a)s"
         for (testsrc, testver) in sorted(pkg_arch_result):
             arch_results = pkg_arch_result[(testsrc, testver)]
@@ -215,6 +216,11 @@ class AutopkgtestPolicy(BasePolicy):
             if not r - {'RUNNING', 'RUNNING-ALWAYSFAIL'}:
                 testver = None
 
+            # Keep track if this source package has tests of its own for the
+            # bounty system
+            if testsrc == source_name:
+                src_has_own_test = True
+
             html_archmsg = []
             for arch in sorted(arch_results):
                 (status, log_url) = arch_results[arch]
@@ -271,7 +277,7 @@ class AutopkgtestPolicy(BasePolicy):
             else:
                 excuse.addreason('autopkgtest')
 
-        if self.options.adt_success_bounty and verdict == PolicyVerdict.PASS:
+        if self.options.adt_success_bounty and verdict == PolicyVerdict.PASS and src_has_own_test:
             excuse.add_bounty('autopkgtest', int(self.options.adt_success_bounty))
         if self.options.adt_regression_penalty and verdict == PolicyVerdict.REJECTED_PERMANENTLY:
             excuse.add_penalty('autopkgtest', int(self.options.adt_regression_penalty))