qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, peter.maydell@linaro.org, jsnow@redhat.com,
	stefanha@redhat.com, "Paolo Bonzini" <pbonzini@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	david@gibson.dropbear.id.au
Subject: [Qemu-devel] [RFC PATCH 4/4] tests: Add travis container test case
Date: Wed,  3 Feb 2016 22:36:04 +0800	[thread overview]
Message-ID: <1454510164-6278-5-git-send-email-famz@redhat.com> (raw)
In-Reply-To: <1454510164-6278-1-git-send-email-famz@redhat.com>

.travis.yml is parsed by an auxiliary python script, to generate the
command list out of the matrix.

TODO: respect "compiler".

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 tests/docker/travis.py | 40 ++++++++++++++++++++++++++++++++++++++++
 tests/docker/travis.sh | 10 ++++++++++
 2 files changed, 50 insertions(+)
 create mode 100755 tests/docker/travis.py
 create mode 100755 tests/docker/travis.sh

diff --git a/tests/docker/travis.py b/tests/docker/travis.py
new file mode 100755
index 0000000..7fd5e4b
--- /dev/null
+++ b/tests/docker/travis.py
@@ -0,0 +1,40 @@
+#!/usr/bin/env python2
+import sys
+import yaml
+import json
+import itertools
+
+def load_yaml(fname):
+    return yaml.load(open(sys.argv[1], "r").read())
+
+def conf_iter(conf):
+    def env_list(e):
+        return e if type(e) is list else [e]
+    global_env = conf["env"]["global"]
+    for c in conf["matrix"]["include"]:
+        a = { "env": global_env + env_list(c["env"]),
+              "compiler": c["compiler"]
+            }
+        yield a
+    for c in itertools.product(conf["compiler"],
+                               conf["env"]["matrix"]):
+        a = { "env": global_env + env_list(c[1]),
+              "compiler": c[0]
+            }
+        yield a
+
+def main():
+    if len(sys.argv) < 2:
+        sys.stderr.write("Usage: %s <travis-file>\n" % sys.argv[0])
+        return 1
+    conf = load_yaml(sys.argv[1])
+    for config in conf_iter(conf):
+        print "("
+        print "\n".join(config["env"])
+        print "\n".join(conf["before_script"])
+        print "\n".join(conf["script"])
+        print ")"
+    return 0
+
+if __name__ == "__main__":
+    sys.exit(main())
diff --git a/tests/docker/travis.sh b/tests/docker/travis.sh
new file mode 100755
index 0000000..e7e1f20
--- /dev/null
+++ b/tests/docker/travis.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+if ! python -c 'import yaml' &>/dev/null; then
+    echo "PyYAML not found, skip"
+    exit 0
+fi
+
+cd $(mktemp -d)
+$QEMU_SRC/tests/docker/travis.py $QEMU_SRC/.travis.yml > travis_command_list
+. travis_command_list
-- 
2.4.3

  parent reply	other threads:[~2016-02-03 14:36 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-03 14:36 [Qemu-devel] [RFC PATCH 0/4] tests: Introducing docker tests Fam Zheng
2016-02-03 14:36 ` [Qemu-devel] [RFC PATCH 1/4] tests: Introduce Docker based tests Fam Zheng
2016-02-04 11:58   ` Daniel P. Berrange
2016-02-05  6:17     ` Fam Zheng
2016-02-03 14:36 ` [Qemu-devel] [RFC PATCH 2/4] tests: Add clang docker test Fam Zheng
2016-02-03 14:36 ` [Qemu-devel] [RFC PATCH 3/4] tests: Add mingw 32/64 cross compiling Fam Zheng
2016-02-03 15:08   ` Stefan Weil
2016-02-04  2:29     ` Fam Zheng
2016-02-04 11:24       ` Paolo Bonzini
2016-02-03 16:14   ` Eric Blake
2016-02-04  2:28     ` Fam Zheng
2016-02-04 12:00   ` Daniel P. Berrange
2016-02-03 14:36 ` Fam Zheng [this message]
2016-02-03 15:24 ` [Qemu-devel] [RFC PATCH 0/4] tests: Introducing docker tests Stefan Hajnoczi
2016-02-04  2:43   ` Fam Zheng
2016-02-04 11:26     ` Paolo Bonzini

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=1454510164-6278-5-git-send-email-famz@redhat.com \
    --to=famz@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=david@gibson.dropbear.id.au \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@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).