[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 05/56] docker: Add "cc" subcommand
From: |
Alex Bennée |
Subject: |
[Qemu-devel] [PULL 05/56] docker: Add "cc" subcommand |
Date: |
Tue, 19 Jun 2018 16:43:44 +0100 |
Signed-off-by: Fam Zheng <address@hidden>
[AJB: add if args.paths check]
Signed-off-by: Alex Bennée <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Tested-by: Philippe Mathieu-Daudé <address@hidden>
---
v2
- add if args.paths check to avoid iterating null argument
diff --git a/tests/docker/docker.py b/tests/docker/docker.py
index 306e14cf69..4cd6f9b8ec 100755
--- a/tests/docker/docker.py
+++ b/tests/docker/docker.py
@@ -409,6 +409,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]))
--
2.17.1
- [Qemu-devel] [PULL 00/56] add check-tcg and associated machinery, Alex Bennée, 2018/06/19
- [Qemu-devel] [PULL 04/56] configure: set cross_cc_FOO for host compiler, Alex Bennée, 2018/06/19
- [Qemu-devel] [PULL 01/56] configure: add support for --cross-cc-FOO, Alex Bennée, 2018/06/19
- [Qemu-devel] [PULL 03/56] configure: allow user to specify --cross-cc-cflags-foo=, Alex Bennée, 2018/06/19
- [Qemu-devel] [PULL 05/56] docker: Add "cc" subcommand,
Alex Bennée <=
- [Qemu-devel] [PULL 07/56] docker: allow "cc" command to run in user context, Alex Bennée, 2018/06/19
- [Qemu-devel] [PULL 08/56] docker: Makefile.include introduce DOCKER_SCRIPT, Alex Bennée, 2018/06/19
- [Qemu-devel] [PULL 02/56] configure: move i386_cc to cross_cc_i386, Alex Bennée, 2018/06/19
- [Qemu-devel] [PULL 06/56] docker: extend "cc" command to accept compiler, Alex Bennée, 2018/06/19
- [Qemu-devel] [PULL 09/56] tests/tcg: move architecture independent tests into subdir, Alex Bennée, 2018/06/19
- [Qemu-devel] [PULL 16/56] tests/tcg/i386: Build fix for hello-i386, Alex Bennée, 2018/06/19
- [Qemu-devel] [PULL 10/56] tests/tcg/multiarch: Build fix for linux-test, Alex Bennée, 2018/06/19
- [Qemu-devel] [PULL 13/56] tests/tcg/multiarch: move most output to stdout, Alex Bennée, 2018/06/19
- [Qemu-devel] [PULL 37/56] tests/tcg: enable building for sh4, Alex Bennée, 2018/06/19
- [Qemu-devel] [PULL 14/56] tests/tcg: move i386 specific tests into subdir, Alex Bennée, 2018/06/19