diff options
-rwxr-xr-x | automated/linux/ethernet/ethernet.sh | 50 | ||||
-rw-r--r-- | automated/linux/ethernet/ethernet.yaml | 37 | ||||
-rwxr-xr-x | automated/linux/fio-test/fio-test.sh | 170 | ||||
-rw-r--r-- | automated/linux/fio-test/fio-test.yaml | 20 | ||||
-rwxr-xr-x | automated/linux/nginx-apache-bench/apache-bench.sh | 84 | ||||
-rw-r--r-- | automated/linux/nginx-apache-bench/apache-bench.yaml | 33 | ||||
-rw-r--r-- | manual/generic/linux/disk-boot.yaml | 37 | ||||
-rw-r--r-- | manual/generic/linux/openssl-debian.yaml | 39 |
8 files changed, 356 insertions, 114 deletions
diff --git a/automated/linux/ethernet/ethernet.sh b/automated/linux/ethernet/ethernet.sh new file mode 100755 index 0000000..12fbec6 --- /dev/null +++ b/automated/linux/ethernet/ethernet.sh @@ -0,0 +1,50 @@ +#!/bin/sh + +# shellcheck disable=SC1091 +. ../../lib/sh-test-lib + +OUTPUT="$(pwd)/output" +RESULT_FILE="${OUTPUT}/result.txt" +export RESULT_FILE + +# Default ethernet interface +INTERFACE="eth0" + +usage() { + echo "Usage: $0 [-i <ethernet-interface> -s <true|false>]" 1>&2 + exit 1 +} + +while getopts "s:i:" o; do + case "$o" in + s) SKIP_INSTALL="${OPTARG}" ;; + # Ethernet interface + i) INTERFACE="${OPTARG}" ;; + *) usage ;; + esac +done + +# Test run. +! check_root && error_msg "This script must be run as root" +[ -d "${OUTPUT}" ] && mv "${OUTPUT}" "${OUTPUT}_$(date +%Y%m%d%H%M%S)" +mkdir -p "${OUTPUT}" + +pkgs="net-tools" +install_deps "${pkgs}" "${SKIP_INSTALL}" + +# Print all network interface status +ip addr +# Print given network interface status +ip addr show "${INTERFACE}" + +# Get IP address of a given interface +IP_ADDR=$(ip addr show "${INTERFACE}" | grep -a2 "state UP" | tail -1 | awk '{print $2}' | cut -f1 -d'/') + +[ -n "${IP_ADDR}" ] +exit_on_fail "ethernet-ping-state-UP" "ethernet-ping-route" + +# Get default Route IP address of a given interface +ROUTE_ADDR=$(ip route list | grep default | awk '{print $3}') + +# Run the test +run_test_case "ping ${ROUTE_ADDR} -c 5" "ethernet-ping-route" diff --git a/automated/linux/ethernet/ethernet.yaml b/automated/linux/ethernet/ethernet.yaml new file mode 100644 index 0000000..d2999a2 --- /dev/null +++ b/automated/linux/ethernet/ethernet.yaml @@ -0,0 +1,37 @@ +metadata: + name: ethernet + format: "Lava-Test-Shell Test Definition 1.0" + description: "This test checks if Ethernet is up and prints IP address." + maintainer: + - naresh.kamboju@linaro.org + os: + - debian + - ubuntu + - centos + - fedora + scope: + - functional + devices: + - panda + - panda-es + - arndale + - beaglebone-black + - juno + - hi6220-hikey + - apq8016-sbc + - d03 + - d05 + - overdrive + - mustang + - moonshot + - thunderX + +params: + SKIP_INSTALL: "False" + INTERFACE: "eth0" + +run: + steps: + - cd automated/linux/ethernet + - ./ethernet.sh -s "${SKIP_INSTALL}" -i "${INTERFACE}" + - ../../utils/send-to-lava.sh ./output/result.txt diff --git a/automated/linux/fio-test/fio-test.sh b/automated/linux/fio-test/fio-test.sh index bf06755..90e7b4a 100755 --- a/automated/linux/fio-test/fio-test.sh +++ b/automated/linux/fio-test/fio-test.sh @@ -1,41 +1,27 @@ -#!/bin/bash -# -# FIO test cases for Linux -# -# Copyright (C) 2016, 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: Naresh Kamboju <naresh.kamboju@linaro.org> -# +#!/bin/sh -e +# shellcheck disable=SC1091 . ../../lib/sh-test-lib OUTPUT="$(pwd)/output" RESULT_FILE="${OUTPUT}/result.txt" -FIO_SKIP_LIST="fio_read fio_randread fio_write fio_randwrite fio_512k_write fio_512k_read" +export RESULT_FILE +PARTITION="" +IOENGINE="sync" +BLOCK_SIZE="4k" usage() { - echo "Usage: $0 [-p <partition>] [-s <true>]" 1>&2 + echo "Usage: $0 [-p <partition>] [-b <block_size>] [-i <sync|psync|libaio>] + [-s <true|false>]" 1>&2 exit 1 } -while getopts "p:s:" o; do +while getopts "p:b:i:s:" o; do case "$o" in # The current working directory will be used by default. - # Use '-p' specify partition that used for dd test. + # Use '-p' specify partition that used for fio test. p) PARTITION="${OPTARG}" ;; + b) BLOCK_SIZE="${OPTARG}" ;; + i) IOENGINE="${OPTARG}" ;; s) SKIP_INSTALL="${OPTARG}" ;; *) usage ;; esac @@ -52,106 +38,76 @@ fio_build_install() { install() { dist_name + # shellcheck disable=SC2154 case "${dist}" in Debian|Ubuntu) pkgs="fio" install_deps "${pkgs}" "${SKIP_INSTALL}" ;; Fedora|CentOS) - pkgs="gcc tar wget" + pkgs="libaio-devel gcc tar wget" install_deps "${pkgs}" "${SKIP_INSTALL}" fio_build_install ;; # When build do not have package manager # Assume development tools pre-installed - *) fio_build_install ;; + *) + fio_build_install + ;; esac } -parse_output() { - test="$1" - file="$2" - IOPS=$(grep "iops=" "${file}" | cut -d= -f4 | cut -d, -f1) - add_metric "${test}" "pass" "${IOPS}" "iops" -} - -fio_device_existence() { - # check for block device - [ -b "${PARTITION}" ] - exit_on_fail "fio_device" "fio ${FIO_SKIP_LIST}" -} - -fio_existence() { - eval "which fio" - exit_on_fail "fio" "${FIO_SKIP_LIST}" -} - -fio_read() { - file="${OUTPUT}/fio_read.txt" - fio -filename="${PARTITION}" -rw=read -direct=1 -iodepth 1 -thread \ - -ioengine=psync -bs=4k -numjobs=1 -runtime=10 -group_reporting \ - -name=fio_read 2>&1 | tee -a "${file}" - parse_output "fio_read" "${file}" - -} - -fio_randread() { - file="${OUTPUT}/fio_randread.txt" - fio -filename="${PARTITION}" -rw=randread -direct=1 -iodepth 1 -thread \ - -ioengine=psync -bs=4k -numjobs=1 -runtime=10 -group_reporting \ - -name=fio_randread 2>&1 | tee -a "${file}" - parse_output "fio_randread" "${file}" -} - -fio_write() { - file="${OUTPUT}/fio_write.txt" - fio -filename="${PARTITION}" -rw=write -direct=1 -iodepth 1 -thread \ - -ioengine=psync -bs=4k -numjobs=1 -runtime=10 -group_reporting \ - -name=fio_write 2>&1 | tee -a "${file}" - parse_output "fio_write" "${file}" -} - -fio_randwrite() { - file="${OUTPUT}/fio_randwrite.txt" - fio -filename="${PARTITION}" -rw=randwrite -direct=1 -iodepth 1 -thread \ - -ioengine=psync -bs=4k -numjobs=1 -runtime=10 -group_reporting \ - -name=fio_randwrite 2>&1 | tee -a "${file}" - parse_output "fio_randwrite" "${file}" -} - -fio_512k_write() { - file="${OUTPUT}/fio_512k_write.txt" - fio -filename="${PARTITION}" -rw=write -direct=1 -iodepth 1 -thread \ - -ioengine=psync -bs=512k -numjobs=1 -runtime=10 -group_reporting \ - -name=fio_512k_write 2>&1 | tee -a "${file}" - parse_output "fio_512k_write" "${file}" -} - -fio_512k_read() { - file="${OUTPUT}/fio_512k_read.txt" - fio -filename="${PARTITION}" -rw=read -direct=1 -iodepth 1 -thread \ - -ioengine=psync -bs=512k -numjobs=1 -runtime=10 -group_reporting \ - -name=fio_512k_read 2>&1 | tee -a "${file}" - parse_output "fio_512k_read" "${file}" +fio_test() { + # shellcheck disable=SC2039 + local rw="$1" + file="${OUTPUT}/fio-${BLOCK_SIZE}-${rw}.txt" + + # Run fio test. + echo + info_msg "Running fio ${BLOCK_SIZE} ${rw} test ..." + fio -name="${rw}" -rw="${rw}" -bs="${BLOCK_SIZE}" -size=1G -runtime=300 \ + -numjobs=1 -ioengine="${IOENGINE}" -direct=1 -group_reporting \ + -output="${file}" + echo + + # Parse output. + cat "${file}" + measurement=$(grep -m 1 "iops=" "${file}" | cut -d= -f4 | cut -d, -f1) + add_metric "fio-${rw}" "pass" "${measurement}" "iops" + + # Delete files created by fio to avoid out of space. + rm -rf ./"${rw}"* } -# Test run. +# Config test. ! check_root && error_msg "This script must be run as root" [ -d "${OUTPUT}" ] && mv "${OUTPUT}" "${OUTPUT}_$(date +%Y%m%d%H%M%S)" mkdir -p "${OUTPUT}" +# Enter test directory. +if [ -n "${PARTITION}" ]; then + if [ -b "${PARTITION}" ]; then + if df | grep "${PARTITION}"; then + mount_point=$(df | grep "${PARTITION}" | awk '{print $NF}') + else + mount_point="/media/fio" + mkdir -p "${mount_point}" + umount "${mount_point}" > /dev/null 2>&1 || true + mount "${PARTITION}" "${mount_point}" && \ + info_msg "${PARTITION} mounted to ${mount_point}" + df | grep "${PARTITION}" + fi + cd "${mount_point}" + else + error_msg "Block device ${PARTITION} NOT found" + fi +fi + +# Install and run fio test. +install info_msg "About to run fio test..." info_msg "Output directory: ${OUTPUT}" - -# Install dependency packages -install - -# Run all test -fio_device_existence -fio_existence -fio_read -fio_randread -fio_write -fio_randwrite -fio_512k_write -fio_512k_read +info_msg "fio test directory: $(pwd)" +for rw in "read" randread write randwrite rw randrw; do + fio_test "${rw}" +done diff --git a/automated/linux/fio-test/fio-test.yaml b/automated/linux/fio-test/fio-test.yaml index e355495..337fec0 100644 --- a/automated/linux/fio-test/fio-test.yaml +++ b/automated/linux/fio-test/fio-test.yaml @@ -1,10 +1,11 @@ metadata: name: fio-test format: "Lava-Test-Shell Test Definition 1.0" - description: "FIO or Flexible IO is a versatile IO workload generator Test on Linux. - The target block device partition required to run this test to be set as '/dev/sdbX'" + description: "FIO or Flexible IO is a versatile IO workload generator test + on Linux." maintainer: - naresh.kamboju@linaro.org + - chase.qi@linaro.org os: - debian - ubuntu @@ -13,8 +14,10 @@ metadata: devices: - mustang - overdrive - - d02 + - d05 - d03 + - moonshot + - thunderX - hi6220-hikey - apq8016-sbc scope: @@ -23,14 +26,17 @@ metadata: - lava-test-shell params: + # Specify block device partition that used for fio test. Example: /dev/sdb1 + # Use disk-partitioning.yaml to create and format partition, as needed. # The currenty working directory will be used by default. - # Use '-p' specify block device partition that used for fio test. - # Example: /dev/sdb1 - BLK_DEV_PARTITION: "" + PARTITION: "" + # Available IO engines: sync, psync, libaio + IOENGINE: "sync" + BLOCK_SIZE: "4k" SKIP_INSTALL: "False" run: steps: - cd ./automated/linux/fio-test/ - - ./fio-test.sh -p "${BLK_DEV_PARTITION}" -s "${SKIP_INSTALL}" + - ./fio-test.sh -p "${PARTITION}" -i "${IOENGINE}" -b "${BLOCK_SIZE}" -s "${SKIP_INSTALL}" - ../../utils/send-to-lava.sh ./output/result.txt diff --git a/automated/linux/nginx-apache-bench/apache-bench.sh b/automated/linux/nginx-apache-bench/apache-bench.sh new file mode 100755 index 0000000..f4c774c --- /dev/null +++ b/automated/linux/nginx-apache-bench/apache-bench.sh @@ -0,0 +1,84 @@ +#!/bin/sh + + +. ../../lib/sh-test-lib +OUTPUT="$(pwd)/output" +RESULT_FILE="${OUTPUT}/result.txt" +LOGFILE="${OUTPUT}/ablog.txt" + +usage() { + echo "Usage: $0 [-s <true|false>] [-n <numer_or_requests>] [-c <number_of_requests_at_a_time>] " 1>&2 + exit 1 +} + +NUMBER=1000 +CONCURENT=100 + +while getopts "s:n:c:" o; do + case "$o" in + n) NUMBER="${OPTARG}" ;; + c) CONCURENT="${OPTARG}" ;; + s) SKIP_INSTALL="${OPTARG}" ;; + *) usage ;; + esac +done + +! check_root && error_msg "This script must be run as root" +[ -d "${OUTPUT}" ] && mv "${OUTPUT}" "${OUTPUT}_$(date +%Y%m%d%H%M%S)" +mkdir -p "${OUTPUT}" + +dist_name +# Install and configure LEMP. +# systemctl available on Debian 8, CentOS 7 and newer releases. +# shellcheck disable=SC2154 +case "${dist}" in + Debian) + pkgs="nginx apache2-utils" + install_deps "${pkgs}" "${SKIP_INSTALL}" + + # Stop apache server in case it is installed and running. + systemctl stop apache2 > /dev/null 2>&1 || true + + systemctl restart nginx + ;; + CentOS) + # x86_64 nginx package can be installed from epel repo. However, epel + # project doesn't support ARM arch yet. RPB repo should provide nginx. + [ "$(uname -m)" = "x86_64" ] && install_deps "epel-release" "${SKIP_INSTALL}" + pkgs="nginx httpd-tools" + install_deps "${pkgs}" "${SKIP_INSTALL}" + + # Stop apache server in case it is installed and running. + systemctl stop httpd.service > /dev/null 2>&1 || true + + systemctl restart nginx + ;; + *) + info_msg "Supported distributions: Debian, CentOS" + error_msg "Unsupported distribution: ${dist}" + ;; +esac + +# Test Apachebench on NGiNX. +# Default index page should be OK to run ab test +ab -n "${NUMBER}" -c "${CONCURENT}" "http://localhost/index.html" | tee "${LOGFILE}" +# shellcheck disable=SC2129 +grep "Time taken for tests:" "${LOGFILE}" | awk '{print "Time-taken-for-tests pass " $5 " s"}' >> "${RESULT_FILE}" +# shellcheck disable=SC2129 +grep "Complete requests:" "${LOGFILE}" | awk '{print "Complete-requests pass " $3 " items"}' >> "${RESULT_FILE}" +# shellcheck disable=SC2129 +grep "Failed requests:" "${LOGFILE}" | awk '{ORS=""} {print "Failed-requests "; if ($3==0) {print "pass "} else {print "fail "}; print $3 " items\n" }' >> "${RESULT_FILE}" +# shellcheck disable=SC2129 +grep "Write errors:" "${LOGFILE}" | awk '{ORS=""} {print "Write-errors "; if ($3==0) {print "pass "} else {print "fail "}; print $3 " items\n" }' >> "${RESULT_FILE}" +# shellcheck disable=SC2129 +grep "Total transferred:" "${LOGFILE}" | awk '{print "Total-transferred pass " $3 " bytes"}' >> "${RESULT_FILE}" +# shellcheck disable=SC2129 +grep "HTML transferred:" "${LOGFILE}" | awk '{print "HTML-transferred pass " $3 " bytes"}' >> "${RESULT_FILE}" +# shellcheck disable=SC2129 +grep "Requests per second:" "${LOGFILE}" | awk '{print "Requests-per-second pass " $4 " #/s"}' >> "${RESULT_FILE}" +# shellcheck disable=SC2129 +grep "Time per request:" "${LOGFILE}" | grep -v "across" | awk '{print "Time-per-request-mean pass " $4 " ms"}' >> "${RESULT_FILE}" +# shellcheck disable=SC2129 +grep "Time per request:" "${LOGFILE}" | grep "across" | awk '{print "Time-per-request-concurent pass " $4 " ms"}' >> "${RESULT_FILE}" +# shellcheck disable=SC2129 +grep "Transfer rate:" "${LOGFILE}" | awk '{print "Transfer-rate pass " $3 " kb/s"}' >> "${RESULT_FILE}" diff --git a/automated/linux/nginx-apache-bench/apache-bench.yaml b/automated/linux/nginx-apache-bench/apache-bench.yaml new file mode 100644 index 0000000..3e76f1b --- /dev/null +++ b/automated/linux/nginx-apache-bench/apache-bench.yaml @@ -0,0 +1,33 @@ +metadata: + format: Lava-Test Test Definition 1.0 + name: ngingx-apache-bench + description: "Apachebench is a benchmark created to measure + the webserver performance on HTTP protocol. This + test runs apachebench against apache nginx" + maintainer: + - milosz.wasilewski@linaro.org + os: + - debian + - centos + scope: + - performance + devices: + - mustang + - overdrive + - thunderX + - d02 + - d03 + - d05 + +params: + SKIP_INSTALL: "False" + # Number of requests to perform + NUMBER: 1000 + # Number of multiple requests to make at a time + CONCURENT: 100 + +run: + steps: + - cd ./automated/linux/nginx-apache-bench/ + - ./apache-bench.sh -s "${SKIP_INSTALL}" -n "${NUMBER}" -c "${CONCURENT}" + - ../../utils/send-to-lava.sh ./output/result.txt diff --git a/manual/generic/linux/disk-boot.yaml b/manual/generic/linux/disk-boot.yaml new file mode 100644 index 0000000..cadd6da --- /dev/null +++ b/manual/generic/linux/disk-boot.yaml @@ -0,0 +1,37 @@ +metadata: + name: disk-boot + format: "Manual Test Definition 1.0" + description: "Boot Linux operating system from pre-installed hard disk and mount rootfs" + maintainer: + - naresh.kamboju@linaro.org + os: + - debian + - ubuntu + - centos + - fedora + scope: + - functional + devices: + - d02 + - d03 + - d05 + - overdrive + - moonshot + environment: + - manual-test + +run: + steps: + - After successful installation, reboot the board + - UEFI should take the control to default boot + - Do not interrupt this, let it boot automatically + + expected: + - Linux kernel should start booting + - Watch kernel boot log it should detect sda/sdb or hda/hdb + [ 15.362985] sda sda1 sda2 sda3 + [ 15.363433] sd 1 0 0 0 [sda] Attached SCSI disk + [ 15.651309] EXT4-fs (sda1) mounted filesystem with ordered data mode. Opts (null) + - Linux should boot to shell, without kernel panic, crash, hang or any other serve error observed + - The Linux shell should not boot to initramfs shell or minimal shell + - Linux should boot default shell or it should ask for username and password (provide credentials for login) diff --git a/manual/generic/linux/openssl-debian.yaml b/manual/generic/linux/openssl-debian.yaml new file mode 100644 index 0000000..f76774a --- /dev/null +++ b/manual/generic/linux/openssl-debian.yaml @@ -0,0 +1,39 @@ +metadata: + name: openssl-debian + format: "Manual Test Definition 1.0" + description: "OpenSSL is an open source project that provides a robust, + commercial-grade, and full-featured toolkit for the Transport Layer + Security (TLS) and Secure Sockets Layer (SSL) protocols. + It is also a general-purpose cryptography library + ref: https://www.openssl.org" + maintainer: + - naresh.kamboju@linaro.org + os: + - debian + - ubuntu + scope: + - functional + devices: + - d02 + - d03 + - d05 + - overdrive + environment: + - manual-test + +run: + steps: + - apt-get update + - apt-get -y install build-essential + - apt-get -y install openssl + - apt-get source openssl + - VERSION=$(dpkg -l | grep " openssl " |awk '{print $3}'|cut -d- -f 1 | cut -d: -f2) + - cd openssl-"${VERSION}" + - ./config + - make -j8 + - make install + - make test + - run takes around 5 minutes + expected: + - all tests should pass, look for "ALL TESTS SUCCESSFUL" + - if any openssl test fails please report bugs |