Merge "linux/docker: install docker-ce from upstream"
diff --git a/automated/android/workload-automation/aep-energy-config.sh b/automated/android/workload-automation/aep-energy-config.sh
new file mode 100755
index 0000000..79ce07b
--- /dev/null
+++ b/automated/android/workload-automation/aep-energy-config.sh
@@ -0,0 +1,44 @@
+#!/bin/sh -ex
+# shellcheck disable=SC1090
+
+TEST_DIR=$(dirname "$(realpath "$0")")
+OUTPUT="${TEST_DIR}/output"
+SKIP_INSTALL="false"
+AEP_CONFIG_REPOSITORY="https://git.linaro.org/power/energy-probe-ext.git"
+AEP_CONFIG_REF="master"
+AEP_CONFIG_TARGET_PATH="/root/energy-probe-ext"
+
+usage() {
+    echo "Usage: $0 [-t <aep_config_repository_ref>] [-r <aep_config_repository>] [-p <aep_config_target_path>]" 1>&2
+    exit 1
+}
+
+while getopts ":t:r:p:" opt; do
+    case "${opt}" in
+        t) AEP_CONFIG_REF="${OPTARG}" ;;
+        r) AEP_CONFIG_REPOSITORY="${OPTARG}" ;;
+        p) AEP_CONFIG_TARGET_PATH="${OPTARG}" ;;
+        *) usage ;;
+    esac
+done
+
+. "${TEST_DIR}/../../lib/sh-test-lib"
+
+! check_root && error_msg "Please run this test as root."
+cd "${TEST_DIR}"
+create_out_dir "${OUTPUT}"
+RESULT_FILE="${OUTPUT}/result.txt"
+export RESULT_FILE
+
+if [ "${SKIP_INSTALL}" = "true" ] || [ "${SKIP_INSTALL}" = "True" ]; then
+    info_msg "Dependency installation skipped"
+else
+    PKGS="git"
+    install_deps "${PKGS}"
+fi
+create_out_dir "${AEP_CONFIG_TARGET_PATH}"
+git clone "${AEP_CONFIG_REPOSITORY}" energy-probe-ext
+cd energy-probe-ext
+git checkout "${AEP_CONFIG_REF}"
+cp -r ./* "${AEP_CONFIG_TARGET_PATH}"
+report_pass "AEP config installed"
diff --git a/automated/android/workload-automation/aep-install.sh b/automated/android/workload-automation/aep-install.sh
new file mode 100755
index 0000000..5cb4104
--- /dev/null
+++ b/automated/android/workload-automation/aep-install.sh
@@ -0,0 +1,44 @@
+#!/bin/sh -ex
+# shellcheck disable=SC1090
+
+TEST_DIR=$(dirname "$(realpath "$0")")
+OUTPUT="${TEST_DIR}/output"
+SKIP_INSTALL="false"
+AEP_REPOSITORY="https://git.linaro.org/tools/arm-probe.git"
+AEP_REF="master"
+
+usage() {
+    echo "Usage: $0 [-t <aep_repository_ref>] [-r <aep_repository>]" 1>&2
+    exit 1
+}
+
+while getopts ":t:r:" opt; do
+    case "${opt}" in
+        t) AEP_REF="${OPTARG}" ;;
+        r) AEP_REPOSITORY="${OPTARG}" ;;
+        *) usage ;;
+    esac
+done
+
+. "${TEST_DIR}/../../lib/sh-test-lib"
+
+! check_root && error_msg "Please run this test as root."
+cd "${TEST_DIR}"
+create_out_dir "${OUTPUT}"
+RESULT_FILE="${OUTPUT}/result.txt"
+export RESULT_FILE
+
+if [ "${SKIP_INSTALL}" = "true" ] || [ "${SKIP_INSTALL}" = "True" ]; then
+    info_msg "Dependency installation skipped"
+else
+    PKGS="git autoconf libtool cmake zlib1g-dev libssl-dev python"
+    install_deps "${PKGS}"
+fi
+git clone "${AEP_REPOSITORY}" arm-probe
+cd arm-probe
+git checkout "${AEP_REF}"
+./autogen.sh
+./configure --prefix=/usr
+make
+make install
+report_pass "AEP installed"
diff --git a/automated/android/workload-automation/aep-install.yaml b/automated/android/workload-automation/aep-install.yaml
new file mode 100644
index 0000000..a8ed990
--- /dev/null
+++ b/automated/android/workload-automation/aep-install.yaml
@@ -0,0 +1,30 @@
+metadata:
+    format: Lava-Test Test Definition 1.0
+    name: arm-probe-install
+    description: "Install arm-probe tool on devices that have ARM
+                  energy probes connected to them.
+                  It also installs configuration files for the probe"
+    maintainer:
+        - lisa.nguyen@linaro.org
+        - milosz.wasilewski@linaro.org
+    os:
+        - ubuntu
+    devices:
+        - hi6220-hikey
+        - hi960-hikey
+        - juno
+
+params:
+    AEP_REPOSITORY: https://git.linaro.org/tools/arm-probe.git
+    AEP_REF: master
+    AEP_CONFIG_REPOSITORY: https://git.linaro.org/power/energy-probe-ext.git
+    AEP_CONFIG_REF: master
+    # path should be absolute
+    AEP_CONFIG_TARGET_PATH: /root/energy-probe-ext
+
+run:
+    steps:
+        - cd ./automated/android/workload-automation
+        - ./aep-install.sh -r "${AEP_REPOSITORY}" -t "${AEP_REF}"
+        - ./aep-energy-config.sh -r "${AEP_CONFIG_REPOSITORY}" -t "${AEP_CONFIG_REF}" -p "${AEP_CONFIG_TARGET_PATH}"
+        - ../../utils/send-to-lava.sh ./output/result.txt
diff --git a/automated/linux/gst-validate/gst-validate.yaml b/automated/linux/gst-validate/gst-validate.yaml
index 39d6066..7a3e765 100644
--- a/automated/linux/gst-validate/gst-validate.yaml
+++ b/automated/linux/gst-validate/gst-validate.yaml
@@ -26,17 +26,22 @@
     MAIN_DIR: "/gst-validate"
     OPTIONS: "-nd -v -j 1"
     GST_INTEGRATION_SUITES: "http://testdata.validation.linaro.org/gst-validate/gst-integration-testsuites_1.12.tar.gz"
+    GST_IGNORE_TESTS_REPO: ""
+    GST_IGNORE_TESTS_BRANCH: "master"
+    GST_IGNORE_TESTS_FILE: ""
 
 run:
     steps:
+        - . ./automated/lib/sh-test-lib
+        - cd ./automated/linux/gst-validate
         - wget ${GST_INTEGRATION_SUITES}
         - tar -xzf $(basename ${GST_INTEGRATION_SUITES}) -C /
-        - gst-validate-launcher -M ${MAIN_DIR} ${OPTIONS} || true
-
-parse:
-    pattern: '(?P<test_case_id>validate\..*):\s+(?P<result>(Failed|Passed|Skipped|Timeout))'
-    fixupdict:
-        Failed: fail
-        Passed: pass
-        Skipped: skip
-        Timeout: fail
+        - IGNORE_FILE=""
+        - if [ ! -z "${GST_IGNORE_TESTS_REPO}" ] && [ ! -z "${GST_IGNORE_TESTS_FILE}" ]; then
+        -     repo_path=${PWD}/$(basename ${GST_IGNORE_TESTS_REPO})
+        -     git clone -b ${GST_IGNORE_TESTS_BRANCH} ${GST_IGNORE_TESTS_REPO} $repo_path
+        -     IGNORE_FILE=${repo_path}/${GST_IGNORE_TESTS_FILE}
+        - fi
+        - gst-validate-launcher -M ${MAIN_DIR} ${OPTIONS} 2>&1 | tee ./gst-validate-raw.log
+        - ./gst_validate_lava_parse.py ./gst-validate-raw.log ${IGNORE_FILE} > ./result.txt
+        - ../../utils/send-to-lava.sh ./result.txt
diff --git a/automated/linux/gst-validate/gst_validate_lava_parse.py b/automated/linux/gst-validate/gst_validate_lava_parse.py
new file mode 100755
index 0000000..8845fe6
--- /dev/null
+++ b/automated/linux/gst-validate/gst_validate_lava_parse.py
@@ -0,0 +1,62 @@
+#!/usr/bin/env python3
+
+# LAVA/OE gst-validate results parse script
+#
+# Copyright (C) 2018, Linaro Limited.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+#
+# Author: Aníbal Limón <anibal.limon@linaro.org>
+#
+
+import json
+import os
+import re
+import sys
+
+
+def map_result_to_lava(result):
+    if result == 'Passed':
+        result = 'pass'
+    elif result == 'Failed':
+        result = 'fail'
+    elif result == 'Skipped':
+        result = 'skip'
+    elif result == 'Timeout':
+        result = 'fail'
+
+    return result
+
+
+if __name__ == '__main__':
+    if len(sys.argv) < 2:
+        print("Usage: %s <result_file> [ignore_file]" % sys.argv[0])
+        sys.exit(1)
+
+    ignore_tests = []
+    if len(sys.argv) == 3:
+        with open(sys.argv[2], 'r') as f:
+            ignore_tests = f.read().split()
+
+    rex = re.compile('^(?P<test_case_id>validate\..*):\s+(?P<result>(Failed|Passed|Skipped|Timeout))')
+    with open(sys.argv[1], 'r') as f:
+        for line in f.readlines():
+            s = rex.search(line)
+            if s:
+                test_case_id = s.group('test_case_id')
+                result = s.group('result')
+
+                if test_case_id not in ignore_tests:
+                    print("%s %s" % (test_case_id, map_result_to_lava(result)))
diff --git a/automated/linux/lapack/lapack.sh b/automated/linux/lapack/lapack.sh
index 8fb1b46..f7979ee 100755
--- a/automated/linux/lapack/lapack.sh
+++ b/automated/linux/lapack/lapack.sh
@@ -66,13 +66,12 @@
     case "${dist}" in
       debian|ubuntu)
         pkgs="binutils gcc make python sed tar wget gfortran"
-        install_deps "${pkgs}" "${SKIP_INSTALL}"
         ;;
       fedora|centos)
-        pkgs="binutils gcc glibc-static make python sed tar wget gfortran"
-        install_deps "${pkgs}" "${SKIP_INSTALL}"
+        pkgs="binutils gcc glibc-static make python sed tar wget gcc-gfortran"
         ;;
     esac
+    install_deps "${pkgs}" "${SKIP_INSTALL}"
 }
 
 # Test run.