aboutsummaryrefslogtreecommitdiff
path: root/support/testing/infra/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'support/testing/infra/__init__.py')
-rw-r--r--support/testing/infra/__init__.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/support/testing/infra/__init__.py b/support/testing/infra/__init__.py
index 27e2a2708d..b03e891771 100644
--- a/support/testing/infra/__init__.py
+++ b/support/testing/infra/__init__.py
@@ -1,4 +1,3 @@
-import contextlib
import os
import re
import sys
@@ -8,6 +7,7 @@ from urllib2 import urlopen, HTTPError, URLError
ARTIFACTS_URL = "http://autobuild.buildroot.net/artefacts/"
+
def open_log_file(builddir, stage, logtofile=True):
"""
Open a file for logging and return its handler.
@@ -20,9 +20,11 @@ def open_log_file(builddir, stage, logtofile=True):
fhandle = sys.stdout
return fhandle
+
def filepath(relpath):
return os.path.join(os.getcwd(), "support/testing", relpath)
+
def download(dldir, filename):
finalpath = os.path.join(dldir, filename)
if os.path.exists(finalpath):
@@ -46,6 +48,7 @@ def download(dldir, filename):
os.rename(tmpfile, finalpath)
return finalpath
+
def get_elf_arch_tag(builddir, prefix, fpath, tag):
"""
Runs the cross readelf on 'fpath', then extracts the value of tag 'tag'.
@@ -66,9 +69,11 @@ def get_elf_arch_tag(builddir, prefix, fpath, tag):
return m.group(1)
return None
+
def get_file_arch(builddir, prefix, fpath):
return get_elf_arch_tag(builddir, prefix, fpath, "Tag_CPU_arch")
+
def get_elf_prog_interpreter(builddir, prefix, fpath):
"""
Runs the cross readelf on 'fpath' to extract the program interpreter