summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlex Bennée2018-04-12 17:49:11 +0200
committerAlex Bennée2018-06-20 21:22:34 +0200
commit5e03c2d816284e1033814fa6e638ed0df0a58d87 (patch)
tree2591b27a057558f6c06b276049a96e1a4369fef9 /tests
parentconfigure: set cross_cc_FOO for host compiler (diff)
downloadqemu-5e03c2d816284e1033814fa6e638ed0df0a58d87.tar.gz
qemu-5e03c2d816284e1033814fa6e638ed0df0a58d87.tar.xz
qemu-5e03c2d816284e1033814fa6e638ed0df0a58d87.zip
docker: Add "cc" subcommand
Signed-off-by: Fam Zheng <famz@redhat.com> [AJB: add if args.paths check] Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/docker/docker.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/docker/docker.py b/tests/docker/docker.py
index e4095270eb..42267bb94d 100755
--- a/tests/docker/docker.py
+++ b/tests/docker/docker.py
@@ -412,6 +412,31 @@ class ProbeCommand(SubCommand):
return
+class CcCommand(SubCommand):
+ """Compile sources with cc in images"""
+ name = "cc"
+
+ def args(self, parser):
+ parser.add_argument("--image", "-i", required=True,
+ help="The docker image in which to run cc")
+ parser.add_argument("--source-path", "-s", nargs="*", dest="paths",
+ help="""Extra paths to (ro) mount into container for
+ reading sources""")
+
+ def run(self, args, argv):
+ if argv and argv[0] == "--":
+ argv = argv[1:]
+ cwd = os.getcwd()
+ cmd = ["--rm", "-w", cwd,
+ "-v", "%s:%s:rw" % (cwd, cwd)]
+ if args.paths:
+ for p in args.paths:
+ cmd += ["-v", "%s:%s:ro,z" % (p, p)]
+ cmd += [args.image, "cc"]
+ cmd += argv
+ return Docker().command("run", cmd, args.quiet)
+
+
def main():
parser = argparse.ArgumentParser(description="A Docker helper",
usage="%s <subcommand> ..." % os.path.basename(sys.argv[0]))