diff options
author | Milosz Wasilewski <milosz.wasilewski@linaro.org> | 2016-11-04 22:14:02 +0000 |
---|---|---|
committer | Milosz Wasilewski <milosz.wasilewski@linaro.org> | 2016-11-08 12:34:47 +0000 |
commit | a080bbff9a3bedbeb567e6dfc7996eb947df5752 (patch) | |
tree | 0c420d4ce76776253fecd04ed724a1d2d48e141f /automated/linux/toolchain-smoke | |
parent | 4cb5f38bd1f246e31de780bd88b5cf31cec5cfad (diff) |
automated: added toolchain-smoke test
Simple test that check if gcc compilation works
Change-Id: Ic59f75c6b4c11c9e569017ca848036cdfeb69059
Signed-off-by: Milosz Wasilewski <milosz.wasilewski@linaro.org>
Diffstat (limited to 'automated/linux/toolchain-smoke')
-rw-r--r-- | automated/linux/toolchain-smoke/hello.c | 6 | ||||
-rwxr-xr-x | automated/linux/toolchain-smoke/toolchain-smoke.sh | 58 | ||||
-rw-r--r-- | automated/linux/toolchain-smoke/toolchain-smoke.yaml | 30 |
3 files changed, 94 insertions, 0 deletions
diff --git a/automated/linux/toolchain-smoke/hello.c b/automated/linux/toolchain-smoke/hello.c new file mode 100644 index 0000000..8981773 --- /dev/null +++ b/automated/linux/toolchain-smoke/hello.c @@ -0,0 +1,6 @@ +#include <stdio.h> + +void main(int argc) +{ + printf("Hello world"); +} diff --git a/automated/linux/toolchain-smoke/toolchain-smoke.sh b/automated/linux/toolchain-smoke/toolchain-smoke.sh new file mode 100755 index 0000000..17b30f8 --- /dev/null +++ b/automated/linux/toolchain-smoke/toolchain-smoke.sh @@ -0,0 +1,58 @@ +#!/bin/sh -e + +. ../../lib/sh-test-lib +OUTPUT="$(pwd)/output" +RESULT_FILE="${OUTPUT}/result.txt" +export RESULT_FILE +STATIC=false + +usage() { + echo "Usage: $0 [-s <true|flase>] [-t <true|flase>]" 1>&2 + exit 1 +} + +while getopts "s:t:h" o; do + case "$o" in + t) STATIC=${OPTARG} ;; + s) SKIP_INSTALL="${OPTARG}" ;; + h|*) usage ;; + esac +done + +install() { + dist_name + # shellcheck disable=SC2154 + case "${dist}" in + Debian|Ubuntu) + pkgs="build-essential" + install_deps "${pkgs}" + ;; + Fedora|CentOS) + pkgs="gcc glibc-static" + install_deps "${pkgs}" + ;; + *) error_msg "Unsupported distribution" ;; + esac +} + +! check_root && error_msg "You need to be root to run this script." +[ -d "${OUTPUT}" ] && mv "${OUTPUT}" "${OUTPUT}_$(date +%Y%m%d%H%M%S)" +mkdir -p "${OUTPUT}" + +if [ "${SKIP_INSTALL}" = "True" ] || [ "${SKIP_INSTALL}" = "true" ]; then + info_msg "gcc package installation skipped" +else + install +fi +FLAGS="" +if [ "${STATIC}" = "true" ] || [ "${STATIC}" = "True" ]; then + FLAGS="-static" +fi + +skip_list="execute_binary" +command="gcc ${FLAGS} -o hello hello.c" +run_test_case "${command}" "gcc${FLAGS}" "${skip_list}" + +command="./hello | grep -x 'Hello world'" +# skip_list is used as test case name to avoid typing mistakes +run_test_case "${command}" "${skip_list}" diff --git a/automated/linux/toolchain-smoke/toolchain-smoke.yaml b/automated/linux/toolchain-smoke/toolchain-smoke.yaml new file mode 100644 index 0000000..8d7c1ab --- /dev/null +++ b/automated/linux/toolchain-smoke/toolchain-smoke.yaml @@ -0,0 +1,30 @@ +metadata: + name: toolchain-smoke + format: "Lava-Test-Shell Test Definition 1.0" + description: "Simple test that checks whether gcc compilation works" + maintainer: + - milosz.wasilewski@linaro.org + os: + - debian + - ubuntu + - fedora + - centos + scope: + - functional + devices: + - mustang + - overdrive + - moonshot + - thunderX + - d03 + - d05 + +params: + STATIC: false + SKIP_INSTALL: false + +run: + steps: + - cd ./automated/linux/toolchain-smoke/ + - ./toolchain-smoke.sh -s ${SKIP_INSTALL} -t ${STATIC} + - ../../utils/send-to-lava.sh ./output/result.txt |