diff mbox

[v3,05/13] docker: Add common.rc

Message ID 1457086720-30391-6-git-send-email-famz@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Fam Zheng March 4, 2016, 10:18 a.m. UTC
"requires" checks the "FEATURE" environment for specified prerequisits,
and skip the execution of test if not found.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 tests/docker/common.rc | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100755 tests/docker/common.rc

Comments

Alex Bennée March 11, 2016, 4:06 p.m. UTC | #1
Fam Zheng <famz@redhat.com> writes:

> "requires" checks the "FEATURE" environment for specified prerequisits,
> and skip the execution of test if not found.

You also add a build_qemu function which you should mention.

Otherwise have a:

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

>
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  tests/docker/common.rc | 31 +++++++++++++++++++++++++++++++
>  1 file changed, 31 insertions(+)
>  create mode 100755 tests/docker/common.rc
>
> diff --git a/tests/docker/common.rc b/tests/docker/common.rc
> new file mode 100755
> index 0000000..74b89d6
> --- /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
> +}


--
Alex Bennée
Fam Zheng March 16, 2016, 3:39 a.m. UTC | #2
On Fri, 03/11 16:06, Alex Bennée wrote:
> 
> Fam Zheng <famz@redhat.com> writes:
> 
> > "requires" checks the "FEATURE" environment for specified prerequisits,
> > and skip the execution of test if not found.
> 
> You also add a build_qemu function which you should mention.

Will mention it.

Thanks,

Fam
> 
> Otherwise have a:
> 
> Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
>
diff mbox

Patch

diff --git a/tests/docker/common.rc b/tests/docker/common.rc
new file mode 100755
index 0000000..74b89d6
--- /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
+}