From d7141703769b5965de69c2ad06ce1c3868305f03 Mon Sep 17 00:00:00 2001 From: Naresh Kamboju Date: Wed, 16 Nov 2016 16:24:40 +0530 Subject: automated: added Linux libhugetlbfs test Change-Id: I9e8e75d22a99c79dae92663a384da197625e85d8 Signed-off-by: Naresh Kamboju --- automated/linux/libhugetlbfs/libhugetlbfs.sh | 120 +++++++++++++++++++++++++ automated/linux/libhugetlbfs/libhugetlbfs.yaml | 39 ++++++++ 2 files changed, 159 insertions(+) create mode 100755 automated/linux/libhugetlbfs/libhugetlbfs.sh create mode 100644 automated/linux/libhugetlbfs/libhugetlbfs.yaml (limited to 'automated/linux') diff --git a/automated/linux/libhugetlbfs/libhugetlbfs.sh b/automated/linux/libhugetlbfs/libhugetlbfs.sh new file mode 100755 index 0000000..1570816 --- /dev/null +++ b/automated/linux/libhugetlbfs/libhugetlbfs.sh @@ -0,0 +1,120 @@ +#!/bin/sh + +# shellcheck disable=SC1091 +. ../../lib/sh-test-lib + +OUTPUT="$(pwd)/output" +RESULT_FILE="${OUTPUT}/result.txt" +RESULT_LOG="${OUTPUT}/result_log.txt" +TEST_PASS_LOG="${OUTPUT}/test_pass_log.txt" +TEST_FAIL_LOG="${OUTPUT}/test_fail_log.txt" +TEST_SKIP_LOG="${OUTPUT}/test_skip_log.txt" + +WORD_SIZE="64" +VERSION="2.20" + +usage() { + echo "Usage: $0 [-b <4|64>] [-s ] [-v ]" 1>&2 + exit 1 +} + +while getopts "b:s:v:" o; do + case "$o" in + b) WORD_SIZE="${OPTARG}" ;; + s) SKIP_INSTALL="${OPTARG}" ;; + v) VERSION="${OPTARG}" ;; + *) usage ;; + esac +done + +parse_output() { + # Parse each type of results + egrep "*:.*PASS" "${RESULT_LOG}" | tee -a "${TEST_PASS_LOG}" + sed -i -e 's/ (inconclusive)//g' "${TEST_PASS_LOG}" + sed -i -e 's/(//g' "${TEST_PASS_LOG}" + sed -i -e 's/)://g' "${TEST_PASS_LOG}" + sed -i -e 's/://g' "${TEST_PASS_LOG}" + awk '{for (i=1; i&1 | tee -a "${RESULT_FILE}" + + egrep "*:.*FAIL" "${RESULT_LOG}" | cut -d: -f 1-2 2>&1 | tee -a "${TEST_FAIL_LOG}" + sed -i -e 's/ (inconclusive)//g' "${TEST_FAIL_LOG}" + sed -i -e 's/(//g' "${TEST_FAIL_LOG}" + sed -i -e 's/)//g' "${TEST_FAIL_LOG}" + sed -i -e 's/://g' "${TEST_FAIL_LOG}" + awk '{for (i=1; i&1 | tee -a "${RESULT_FILE}" + + egrep "*:.*SKIP" "${RESULT_LOG}" | cut -d: -f 1-2 2>&1 | tee -a "${TEST_SKIP_LOG}" + egrep "*:.*Bad configuration" "${RESULT_LOG}" | cut -d: -f 1-2 2>&1 | tee -a "${TEST_SKIP_LOG}" + sed -i -e 's/ (inconclusive)//g' "${TEST_SKIP_LOG}" + sed -i -e 's/(//g' "${TEST_SKIP_LOG}" + sed -i -e 's/)//g' "${TEST_SKIP_LOG}" + sed -i -e 's/://g' "${TEST_SKIP_LOG}" + awk '{for (i=1; i&1 | tee -a "${RESULT_FILE}" +} + +libhugetlbfs_build_test() { + mount_point="/mnt/hugetlb/" + # Allocate hugepages + echo 200 > /proc/sys/vm/nr_hugepages + umount "${mount_point}" > /dev/null 2>&1 || true + mkdir -p "${mount_point}" + mount -t hugetlbfs hugetlbfs "${mount_point}" + + # shellcheck disable=SC2140 + # Upstream tree +# wget https://github.com/libhugetlbfs/libhugetlbfs/releases/download/"${VERSION}"/libhugetlbfs-"${VERSION}".tar.gz + #TODO + # Private tree with CentOS build fix + # When patch is upstream remove private tree and enable upstream tree + wget https://github.com/nareshkamboju/libhugetlbfs/releases/download/"${VERSION}"/libhugetlbfs-"${VERSION}".tar.gz + tar -xvf libhugetlbfs-"${VERSION}".tar.gz + # shellcheck disable=SC2164 + cd libhugetlbfs-"${VERSION}" + make BUILDTYPE=NATIVEONLY + # shellcheck disable=SC2164 + cd tests + # Run tests + # Redirect stdout (not stderr) + ./run_tests.py -b "${WORD_SIZE}" | tee -a "${RESULT_LOG}" + parse_output + umount "${mount_point}" > /dev/null 2>&1 || true +} + +install() { + dist_name + # shellcheck disable=SC2154 + case "${dist}" in + Debian|Ubuntu) + pkgs="binutils gcc make python sed tar wget" + install_deps "${pkgs}" "${SKIP_INSTALL}" + ;; + Fedora|CentOS) + pkgs="binutils gcc glibc-static make python sed tar wget" + install_deps "${pkgs}" "${SKIP_INSTALL}" + ;; + esac +} + +# 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}" +# shellcheck disable=SC2164 +cd "${OUTPUT}" + +info_msg "About to run libhugetlbfs test..." +info_msg "Output directory: ${OUTPUT}" + + +CONFIG_HUGETLBFS=$(zcat /proc/config.gz | grep "CONFIG_HUGETLBFS=") +CONFIG_HUGETLB_PAGE=$(zcat /proc/config.gz | grep "CONFIG_HUGETLB_PAGE=") +HUGETLBFS=$(grep hugetlbfs /proc/filesystems | awk '{print $2}') + +[ "${CONFIG_HUGETLBFS}" = "CONFIG_HUGETLBFS=y" ] && [ "${CONFIG_HUGETLB_PAGE}" = "CONFIG_HUGETLB_PAGE=y" ] && [ "${HUGETLBFS}" = "hugetlbfs" ] +exit_on_skip "libhugetlb-pre-requirements" "Kernel config CONFIG_HUGETLBFS=y and CONFIG_HUGETLB_PAGE=y not enabled" + +# Install packages +install + +# Build libhugetlbfs and run tests +libhugetlbfs_build_test diff --git a/automated/linux/libhugetlbfs/libhugetlbfs.yaml b/automated/linux/libhugetlbfs/libhugetlbfs.yaml new file mode 100644 index 0000000..b853f18 --- /dev/null +++ b/automated/linux/libhugetlbfs/libhugetlbfs.yaml @@ -0,0 +1,39 @@ +metadata: + name: libhugetlbfs + format: "Lava-Test-Shell Test Definition 1.0" + description: "Build and run libhugetlbfs tests. + Runs through $WORD_SIZE bit libhugetlbfs on target system. + The default WORD_SIZE is 64 bit to accomodate 64 bit systems + but for 32 bit systems the WORD_SIZE value should be set to + 32 from the json file passed to the scheduler. + One needs to run with a kernel that supports huge pages" + maintainer: + - steve.capper@linaro.org + - naresh.kamboju@linaro.org + os: + - debian + - ubuntu + - centos + - fedora + scope: + - functional + devices: + - rtsm_ve-armv8 + - arndale + - mustang + - overdrive + - d05 + - d03 + - hi6220-hikey + - apq8016-sbc + +params: + WORD_SIZE: "64" + SKIP_INSTALL: "False" + VERSION: "2.20" + +run: + steps: + - cd ./automated/linux/libhugetlbfs/ + - ./libhugetlbfs.sh -b "${WORD_SIZE}" -s "${SKIP_INSTALL}" -v "${VERSION}" + - ../../utils/send-to-lava.sh ./output/result.txt -- cgit v1.2.3