aboutsummaryrefslogtreecommitdiff
path: root/support
diff options
context:
space:
mode:
authorGravatar Ricardo Martincoski <ricardo.martincoski@gmail.com>2018-11-04 02:12:06 -0200
committerGravatar Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>2019-08-03 17:17:29 +0200
commit8669243da3c4d6f86a912b5dfda9006e87789eec (patch)
tree2b10f0d5117acc80e438b4b14f7cc8abb8cce132 /support
parent1842bb1470cac3b8bf59b69f33b098761e07a02c (diff)
downloadbuildroot-8669243da3c4d6f86a912b5dfda9006e87789eec.tar.gz
buildroot-8669243da3c4d6f86a912b5dfda9006e87789eec.tar.bz2
support/testing: allow run-tests to be called from anywhere
Currently run-tests must be called from the Buildroot top directory. Derive the top directory from the script path, so run-tests can be called from any path. As a consequence the test infra will always test the repo it belongs to. Suggested-by: Yann E. MORIN <yann.morin.1998@free.fr> Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com> Cc: Arnout Vandecappelle <arnout@mind.be> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Cc: Yann E. MORIN <yann.morin.1998@free.fr> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Diffstat (limited to 'support')
-rw-r--r--support/testing/infra/__init__.py8
-rw-r--r--support/testing/infra/builder.py2
2 files changed, 8 insertions, 2 deletions
diff --git a/support/testing/infra/__init__.py b/support/testing/infra/__init__.py
index e229e90852..1d4d18bbe9 100644
--- a/support/testing/infra/__init__.py
+++ b/support/testing/infra/__init__.py
@@ -6,6 +6,7 @@ import subprocess
from urllib2 import urlopen, HTTPError, URLError
ARTIFACTS_URL = "http://autobuild.buildroot.net/artefacts/"
+BASE_DIR = os.path.realpath(os.path.join(os.path.dirname(__file__), "../../.."))
def open_log_file(builddir, stage, logtofile=True):
@@ -21,8 +22,13 @@ def open_log_file(builddir, stage, logtofile=True):
return fhandle
+def basepath(relpath=""):
+ """Return the absolute path for a file or directory relative to the Buildroot top directory."""
+ return os.path.join(BASE_DIR, relpath)
+
+
def filepath(relpath):
- return os.path.join(os.getcwd(), "support/testing", relpath)
+ return os.path.join(BASE_DIR, "support/testing", relpath)
def download(dldir, filename):
diff --git a/support/testing/infra/builder.py b/support/testing/infra/builder.py
index 018747555d..88f01d15c0 100644
--- a/support/testing/infra/builder.py
+++ b/support/testing/infra/builder.py
@@ -43,7 +43,7 @@ class Builder(object):
cmd += ["olddefconfig"]
ret = subprocess.call(cmd, stdout=self.logfile, stderr=self.logfile,
- env=env)
+ cwd=infra.basepath(), env=env)
if ret != 0:
raise SystemError("Cannot olddefconfig")