|
@@ -75,6 +75,12 @@ class TestCheckPackage(unittest.TestCase):
|
|
|
generated = int(stderr[1].split()[0])
|
|
|
self.assertGreater(generated, 0)
|
|
|
|
|
|
+ def assert_no_warnings_generated_for_file(self, stderr):
|
|
|
+ """Infer from check-package stderr if no warning was generated and fail otherwise."""
|
|
|
+ self.assertIn("warnings generated", stderr[1], stderr)
|
|
|
+ generated = int(stderr[1].split()[0])
|
|
|
+ self.assertEqual(generated, 0)
|
|
|
+
|
|
|
def test_run(self):
|
|
|
"""Test the various ways the script can be called in a simple top to
|
|
|
bottom sequence."""
|
|
@@ -201,3 +207,28 @@ class TestCheckPackage(unittest.TestCase):
|
|
|
self.assert_file_was_processed(m)
|
|
|
self.assert_warnings_generated_for_file(m)
|
|
|
self.assertIn("{}:1: should be 80 hashes (http://nightly.buildroot.org/#writing-rules-mk)".format(abs_file), w)
|
|
|
+
|
|
|
+ # br2-external with ignore list
|
|
|
+ topdir_path = infra.filepath("tests/utils/br2-external")
|
|
|
+ topdir_file = os.path.join(topdir_path, "package/external/external.mk")
|
|
|
+ subdir_path = infra.filepath("tests/utils/br2-external/package")
|
|
|
+ subdir_file = os.path.join(subdir_path, "external/external.mk")
|
|
|
+
|
|
|
+ w, m = call_script(["check-package", "--ignore-list=.checkpackageignore", "-b", topdir_file],
|
|
|
+ self.WITH_UTILS_IN_PATH, topdir_path)
|
|
|
+ self.assert_file_was_processed(m)
|
|
|
+ self.assert_no_warnings_generated_for_file(m)
|
|
|
+
|
|
|
+ w, m = call_script(["check-package", "--ignore-list=.checkpackageignore", "-b", subdir_file],
|
|
|
+ self.WITH_UTILS_IN_PATH, subdir_path)
|
|
|
+ self.assert_file_was_processed(m)
|
|
|
+ self.assert_no_warnings_generated_for_file(m)
|
|
|
+
|
|
|
+ w, m = call_script(["check-package", "--ignore-list=.checkpackageignore_outdated", "-b", subdir_file],
|
|
|
+ self.WITH_UTILS_IN_PATH, subdir_path)
|
|
|
+ self.assert_file_was_processed(m)
|
|
|
+ self.assert_warnings_generated_for_file(m)
|
|
|
+ self.assertIn("{}:0: Indent was expected to fail, did you fixed the file and forgot to update .checkpackageignore_outdated?"
|
|
|
+ .format(subdir_file), w)
|
|
|
+ self.assertIn("{}:0: NewlineAtEof was expected to fail, did you fixed the file and forgot to update .checkpackageignore_outdated?"
|
|
|
+ .format(subdir_file), w)
|