All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ricardo Martincoski <ricardo.martincoski@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 5/5] support/testing: test check-package ignores external.mk
Date: Sat,  3 Nov 2018 01:56:24 -0300	[thread overview]
Message-ID: <20181103045624.31059-6-ricardo.martincoski@gmail.com> (raw)
In-Reply-To: <20181103045624.31059-1-ricardo.martincoski@gmail.com>

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>
---
 .../tests/utils/br2-external/external.mk      |  2 ++
 .../br2-external/package/external/external.mk |  1 +
 .../testing/tests/utils/test_check_package.py | 25 ++++++++++++++++++-
 3 files changed, 27 insertions(+), 1 deletion(-)
 create mode 100644 support/testing/tests/utils/br2-external/package/external/external.mk

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 85f2e280a8..301aae51ac 100644
--- a/support/testing/tests/utils/test_check_package.py
+++ b/support/testing/tests/utils/test_check_package.py
@@ -66,7 +66,7 @@ class TestCheckPackageBasicUsage(TestCheckPackage):
     The script can be called either using relative path, absolute path or from PATH.
     The files to be checked can be passed as arguments using either relative path or absolute path.
     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.
+    When in out-tree mode (with -b) the script does generate warnings but ignores external.mk.
     """
 
     def test_run(self):
@@ -146,3 +146,26 @@ class TestCheckPackageBasicUsage(TestCheckPackage):
         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)
+
+        rel_file = "package/external/external.mk"
+        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(abs_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)
-- 
2.17.1

  parent reply	other threads:[~2018-11-03  4:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-03  4:56 [Buildroot] [PATCH 0/5] Fix bug 11271 and add test for check-package Ricardo Martincoski
2018-11-03  4:56 ` [Buildroot] [PATCH 1/5] check-package: fix check of file in current dir with -b Ricardo Martincoski
2018-11-03 22:49   ` Ricardo Martincoski
2018-11-03  4:56 ` [Buildroot] [PATCH 2/5] support/testing: allow run-tests to be called from anywhere Ricardo Martincoski
2018-11-03  4:56 ` [Buildroot] [PATCH 3/5] support/testing: add test for check-package Ricardo Martincoski
2019-08-03 15:19   ` Arnout Vandecappelle
2018-11-03  4:56 ` [Buildroot] [PATCH 4/5] check-package: ignore external.mk Ricardo Martincoski
2018-11-03  4:56 ` Ricardo Martincoski [this message]
2018-11-04  4:12 ` [Buildroot] [PATCH v2 0/5] Fix bug 11271 and add test for check-package Ricardo Martincoski
2018-11-04  4:12   ` [Buildroot] [PATCH v2 1/5] check-package: fix check of file in current dir with -b Ricardo Martincoski
2018-11-04  4:12   ` [Buildroot] [PATCH v2 2/5] support/testing: allow run-tests to be called from anywhere Ricardo Martincoski
2018-11-04  4:12   ` [Buildroot] [PATCH v2 3/5] support/testing: add test for check-package Ricardo Martincoski
2018-11-04  4:12   ` [Buildroot] [PATCH v2 4/5] check-package: ignore external.mk Ricardo Martincoski
2018-11-04  4:12   ` [Buildroot] [PATCH v2 5/5] support/testing: test check-package ignores external.mk Ricardo Martincoski
2019-08-03 15:19   ` [Buildroot] [PATCH v2 0/5] Fix bug 11271 and add test for check-package Arnout Vandecappelle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181103045624.31059-6-ricardo.martincoski@gmail.com \
    --to=ricardo.martincoski@gmail.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.