summaryrefslogtreecommitdiff
path: root/automated/linux
diff options
context:
space:
mode:
authorChase Qi <chase.qi@linaro.org>2016-11-24 12:27:59 +0800
committerChase Qi <chase.qi@linaro.org>2016-11-24 18:55:47 +0800
commitfed78723b9287cf7b76b75682b30b65dd763522a (patch)
treea2c26b76883578d1b19fd225d1c83cc483ee4981 /automated/linux
parentae88be3b1aa12f3bc4f9c0ce8fe10bb5acf290b9 (diff)
downloadtest-definitions-pipe-fed78723b9287cf7b76b75682b30b65dd763522a.tar.gz
automated: added Linux Kernel compilation test
Change-Id: I5d0b6423b8d6267bfc9c558eb7637335541a5055 Signed-off-by: Chase Qi <chase.qi@linaro.org>
Diffstat (limited to 'automated/linux')
-rwxr-xr-xautomated/linux/kernel-compilation/kernel-compilation.sh72
-rw-r--r--automated/linux/kernel-compilation/kernel-compilation.yaml37
2 files changed, 109 insertions, 0 deletions
diff --git a/automated/linux/kernel-compilation/kernel-compilation.sh b/automated/linux/kernel-compilation/kernel-compilation.sh
new file mode 100755
index 0000000..1637c12
--- /dev/null
+++ b/automated/linux/kernel-compilation/kernel-compilation.sh
@@ -0,0 +1,72 @@
+#!/bin/sh -e
+
+# shellcheck disable=SC1091
+. ../../lib/sh-test-lib
+OUTPUT="$(pwd)/output"
+RESULT_FILE="${OUTPUT}/result.txt"
+export RESULT_FILE
+LOGFILE="${OUTPUT}/kernel-compilation.txt"
+VERSION='4.4.34'
+NPROC=$(nproc)
+
+usage() {
+ echo "Usage: $0 [-v version] [-s true|false]" 1>&2
+ exit 1
+}
+
+while getopts "v:s:h" o; do
+ case "$o" in
+ v) VERSION="${OPTARG}" ;;
+ s) SKIP_INSTALL="${OPTARG}" ;;
+ h|*) usage ;;
+ esac
+done
+
+dist_name
+# shellcheck disable=SC2154
+case "${dist}" in
+ Debian|Ubuntu) pkgs="time bc xz-utils build-essential" ;;
+ CentOS|Fedora) pkgs="time bc xz gcc make" ;;
+esac
+! check_root && error_msg "You need to be root to install packages!"
+# install_deps supports the above distributions.
+# It will skip package installation on other distributions by default.
+install_deps "${pkgs}" "${SKIP_INSTALL}"
+
+[ -d "${OUTPUT}" ] && mv "${OUTPUT}" "${OUTPUT}_$(date +%Y%m%d%H%M%S)"
+mkdir -p "${OUTPUT}"
+cd "${OUTPUT}"
+
+# Download and extract Kernel tarball.
+major_version=$(echo "${VERSION}" | awk -F'.' '{print $1}')
+wget "https://cdn.kernel.org/pub/linux/kernel/v${major_version}.x/linux-${VERSION}.tar.xz"
+tar xf "linux-${VERSION}.tar.xz"
+cd "linux-${VERSION}"
+
+# Compile Kernel with defconfig.
+# It is native not cross compiling.
+# It will not work on x86.
+detect_abi
+# shellcheck disable=SC2154
+case "${abi}" in
+ arm64|armeabi)
+ make defconfig
+ { time -p make -j"${NPROC}" Image; } 2>&1 | tee "${LOGFILE}"
+ ;;
+ *)
+ error_msg "Unsupported architecture!"
+ ;;
+esac
+
+measurement="$(grep "^real" "${LOGFILE}" | awk '{print $2}')"
+if egrep "arch/.*/boot/Image" "${LOGFILE}"; then
+ report_pass "kernel-compilation"
+ add_metric "kernel-compilation-time" "pass" "${measurement}" "seconds"
+else
+ report_fail "kernel-compilation"
+ add_metric "kernel-compilation-time" "fail" "${measurement}" "seconds"
+fi
+
+# Cleanup.
+cd ../
+rm -rf "linux-${VERSION}"*
diff --git a/automated/linux/kernel-compilation/kernel-compilation.yaml b/automated/linux/kernel-compilation/kernel-compilation.yaml
new file mode 100644
index 0000000..ef85afd
--- /dev/null
+++ b/automated/linux/kernel-compilation/kernel-compilation.yaml
@@ -0,0 +1,37 @@
+metadata:
+ name: kernel-compilation
+ format: "Lava-Test-Shell Test Definition 1.0"
+ description: "Compile kernel with defconfig on ARM64/ARM platform and
+ measure how long it takes."
+ maintainer:
+ - chase.qi@linaro.org
+ os:
+ - debian
+ - ubuntu
+ - fedora
+ - centos
+ scope:
+ - functional
+ - performance
+ environment:
+ - lava-test-shell
+ devices:
+ - hi6220-hikey
+ - apq8016-sbc
+ - mustang
+ - moonshot
+ - thunderX
+ - d03
+ - d05
+
+params:
+ # Specify longterm/stable Kernel version that availabe on:
+ # https://www.kernel.org/
+ VERSION: "4.4.34"
+ SKIP_INSTALL: "false"
+
+run:
+ steps:
+ - cd ./automated/linux/kernel-compilation/
+ - ./kernel-compilation.sh -v "${VERSION}" -s "${SKIP_INSTALL}"
+ - ../../utils/send-to-lava.sh ./output/result.txt