qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, thuth@redhat.com,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Fam Zheng" <famz@redhat.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	programmingkidx@gmail.com, crosa@redhat.com, pbonzini@redhat.com,
	rth@twiddle.net
Subject: [Qemu-devel] [PATCH RFC 2/7] docker: Add "cc" subcommand
Date: Fri,  8 Sep 2017 17:16:55 +0800	[thread overview]
Message-ID: <20170908091700.14867-3-famz@redhat.com> (raw)
In-Reply-To: <20170908091700.14867-1-famz@redhat.com>

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 tests/docker/docker.py | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/tests/docker/docker.py b/tests/docker/docker.py
index 81c87ee329..419ebe665f 100755
--- a/tests/docker/docker.py
+++ b/tests/docker/docker.py
@@ -367,6 +367,29 @@ class ImagesCommand(SubCommand):
     def run(self, args, argv):
         return Docker().command("images", argv, args.quiet)
 
+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)]
+        for p in args.paths:
+           cmd += ["-v", "%s:%s:ro,z" % (p, p)]
+        cmd += [args.image, "cc"]
+        cmd += argv
+        return Docker().command("run", cmd, True)
+
 def main():
     parser = argparse.ArgumentParser(description="A Docker helper",
             usage="%s <subcommand> ..." % os.path.basename(sys.argv[0]))
-- 
2.13.5

  parent reply	other threads:[~2017-09-08  9:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-08  9:16 [Qemu-devel] [PATCH RFC 0/7] Proof of concept to power up "make test" with docker Fam Zheng
2017-09-08  9:16 ` [Qemu-devel] [PATCH RFC 1/7] Makefile: Rename TARGET_DIRS to TARGET_LIST Fam Zheng
2017-09-08  9:16 ` Fam Zheng [this message]
2017-09-08  9:16 ` [Qemu-devel] [PATCH RFC 3/7] docker: Add fedora-i386-cross image Fam Zheng
2017-09-08  9:16 ` [Qemu-devel] [PATCH RFC 4/7] tests: Build fix for hello-i386 Fam Zheng
2017-09-08  9:16 ` [Qemu-devel] [PATCH RFC 5/7] tests: Build fix for linux-test Fam Zheng
2017-09-08  9:16 ` [Qemu-devel] [PATCH RFC 6/7] buildsys: Add "check-tcg" target Fam Zheng
2017-09-08  9:17 ` [Qemu-devel] [PATCH RFC 7/7] tests: Move i386 tcg tests to check-tcg Fam Zheng
2017-09-08  9:26 ` [Qemu-devel] [PATCH RFC 0/7] Proof of concept to power up "make test" with docker no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170908091700.14867-3-famz@redhat.com \
    --to=famz@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=crosa@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=programmingkidx@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).