aboutsummaryrefslogtreecommitdiff
path: root/support
diff options
context:
space:
mode:
authorGravatar Ricardo Martincoski <ricardo.martincoski@gmail.com>2018-11-04 02:12:09 -0200
committerGravatar Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>2019-08-03 17:17:29 +0200
commit1ad5e0a6a6c8c82c116352abf420ea14074177e3 (patch)
treed498f77488858eb2e2020f7e5469c425a968b8f6 /support
parent75d6c2ba96bcfd796210f7ad73f71543996c4a04 (diff)
downloadbuildroot-1ad5e0a6a6c8c82c116352abf420ea14074177e3.tar.gz
buildroot-1ad5e0a6a6c8c82c116352abf420ea14074177e3.tar.bz2
support/testing: test check-package ignores external.mk
Check external.mk is ignored only when in the root path of a br2-external. Add a file called external.mk as a fixture to be used by the test case. Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com> Cc: Arnout Vandecappelle <arnout@mind.be> [Arnout: wrap at 80 columns] Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Diffstat (limited to 'support')
-rw-r--r--support/testing/tests/utils/br2-external/external.mk2
-rw-r--r--support/testing/tests/utils/br2-external/package/external/external.mk1
-rw-r--r--support/testing/tests/utils/test_check_package.py30
3 files changed, 32 insertions, 1 deletions
diff --git a/support/testing/tests/utils/br2-external/external.mk b/support/testing/tests/utils/br2-external/external.mk
index e69de29bb2..470c01a382 100644
--- a/support/testing/tests/utils/br2-external/external.mk
+++ b/support/testing/tests/utils/br2-external/external.mk
@@ -0,0 +1,2 @@
+custom-target:
+ @echo "do nothing"
diff --git a/support/testing/tests/utils/br2-external/package/external/external.mk b/support/testing/tests/utils/br2-external/package/external/external.mk
new file mode 100644
index 0000000000..74fb6540ab
--- /dev/null
+++ b/support/testing/tests/utils/br2-external/package/external/external.mk
@@ -0,0 +1 @@
+# wrong
diff --git a/support/testing/tests/utils/test_check_package.py b/support/testing/tests/utils/test_check_package.py
index 009d9f3f38..17c2fcf3bc 100644
--- a/support/testing/tests/utils/test_check_package.py
+++ b/support/testing/tests/utils/test_check_package.py
@@ -32,7 +32,8 @@ class TestCheckPackage(unittest.TestCase):
When in in-tree mode (without -b) some in-tree files and also all
out-of-tree files are ignored.
- When in out-tree mode (with -b) the script does generate warnings for these.
+ When in out-tree mode (with -b) the script does generate warnings for these
+ but ignores external.mk.
"""
WITH_EMPTY_PATH = {}
@@ -172,3 +173,30 @@ class TestCheckPackage(unittest.TestCase):
self.assert_file_was_processed(m)
self.assert_warnings_generated_for_file(m)
self.assertIn("{}:1: empty line at end of file".format(abs_file), w)
+
+ # external.mk is ignored only when in the root path of a br2-external
+ rel_file = "external.mk"
+ abs_file = os.path.join(abs_path, rel_file)
+
+ _, m = call_script(["check-package", "-b", rel_file],
+ self.WITH_UTILS_IN_PATH, abs_path)
+ self.assert_file_was_ignored(m)
+
+ _, m = call_script(["check-package", "-b", abs_file],
+ self.WITH_UTILS_IN_PATH, infra.basepath())
+ self.assert_file_was_ignored(m)
+
+ abs_path = infra.filepath("tests/utils/br2-external/package/external")
+ abs_file = os.path.join(abs_path, rel_file)
+
+ w, m = call_script(["check-package", "-b", rel_file],
+ self.WITH_UTILS_IN_PATH, abs_path)
+ 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(rel_file), w)
+
+ w, m = call_script(["check-package", "-b", abs_file],
+ self.WITH_UTILS_IN_PATH, infra.basepath())
+ 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)