aboutsummaryrefslogtreecommitdiff
path: root/tests/docker/common.rc
diff options
context:
space:
mode:
authorFam Zheng <famz@redhat.com>2016-06-01 12:25:20 +0800
committerFam Zheng <famz@redhat.com>2016-06-01 17:27:35 +0800
commit3568f98ca56099309417a9bbf0e22435fa7094a5 (patch)
tree8b2ccceded6d2464ad89fba13c52d10dfd89e85e /tests/docker/common.rc
parentb344aa9132e832127b7d740b5ae26ae9a2c453f0 (diff)
docker: Add common.rc
"requires" checks the "FEATURE" environment for specified prerequisits, and skip the execution of test if not found. "build_qemu" is the central routine to compile QEMU for tests to call. Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Fam Zheng <famz@redhat.com> Message-id: 1464755128-32490-8-git-send-email-famz@redhat.com
Diffstat (limited to 'tests/docker/common.rc')
-rwxr-xr-xtests/docker/common.rc31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/docker/common.rc b/tests/docker/common.rc
new file mode 100755
index 0000000000..74b89d6c1e
--- /dev/null
+++ b/tests/docker/common.rc
@@ -0,0 +1,31 @@
+#!/bin/sh
+#
+# Common routines for docker test scripts.
+#
+# Copyright (c) 2016 Red Hat Inc.
+#
+# Authors:
+# Fam Zheng <famz@redhat.com>
+#
+# This work is licensed under the terms of the GNU GPL, version 2
+# or (at your option) any later version. See the COPYING file in
+# the top-level directory.
+
+requires()
+{
+ for c in $@; do
+ if ! echo "$FEATURES" | grep -wq -e "$c"; then
+ echo "Prerequisite '$c' not present, skip"
+ exit 0
+ fi
+ done
+}
+
+build_qemu()
+{
+ $QEMU_SRC/configure \
+ --target-list="${TARGET_LIST}" \
+ --prefix="$PWD/install" \
+ "$@"
+ make $MAKEFLAGS
+}