diff mbox series

[RFC,v2,3/3] support/testing/run-tests: add ability to run tests from external

Message ID 20240103002810.1055951-4-colin.foster@in-advantage.com
State New
Headers show
Series Add external test support | expand

Commit Message

Colin Foster Jan. 3, 2024, 12:28 a.m. UTC
The BR2_EXTERNAL variable can be used to keep customizations outside of
Buildroot. There was no support for writing tests in those external
environments.

When the BR2_EXTERNAL environment variable is used for running tests,
include the tests found in ${BR2_EXTERNAL}/support/testing.

Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
---

v1 -> v2:
  * try / finally reformatting broken out into a separate patch
  * Multiple BR2_EXTERNAL support

---
 support/testing/run-tests | 9 +++++++++
 1 file changed, 9 insertions(+)
diff mbox series

Patch

diff --git a/support/testing/run-tests b/support/testing/run-tests
index dedb487ffd..87ce91266f 100755
--- a/support/testing/run-tests
+++ b/support/testing/run-tests
@@ -48,6 +48,15 @@  def main():
     shutil.copytree(script_dir, temp_dir.name, dirs_exist_ok=True)
     test_dir = temp_dir.name
 
+    overlay_paths = os.getenv("BR2_EXTERNAL")
+    if overlay_paths:
+        for overlay_path in overlay_paths.split():
+            external_testing_path = overlay_path + "/support/testing"
+            if os.path.exists(external_testing_path):
+                shutil.copytree(external_testing_path,
+                                temp_dir.name,
+                                dirs_exist_ok=True)
+
     try:
         if args.stdout:
             BRConfigTest.logtofile = False