From 402d1a50681b0beaedf6158ec07c6b6a306dd304 Mon Sep 17 00:00:00 2001 From: Johnny Bieren Date: Nov 06 2018 14:36:33 +0000 Subject: Add bash option to test local Signed-off-by: Johnny Bieren --- diff --git a/misc/ltp/test_local.sh b/misc/ltp/test_local.sh new file mode 100755 index 0000000..4dcb401 --- /dev/null +++ b/misc/ltp/test_local.sh @@ -0,0 +1,75 @@ +#!/bin/bash + +# This is a copy of test_local.yml to run on +# hosts without ansible available + +set -x + +# Set vars +artifacts="./artifacts" +ltpgit="https://github.com/linux-test-project/ltp.git" +testarea="/mnt/testarea" +ltpdir="${testarea}/ltp" +ctlogs="${artifacts}/ctlogs" +ltpgitver="HEAD" +builddir="./ltp" +userspacetargets="containers controllers hugetlb mm numa sched syscalls" + +# Install dependencies +dnf -y install automake autoconf bison flex util-linux gcc git patch + +# Fetch ltp +git clone ${ltpgit} ${builddir} + +# Add swap if there isn't over 7.2G +swapspace=$(free -m | grep '^Swap' | awk '{print $2}') +if [ ${swapspace} -lt 7200 ] ; then + dd if=/dev/zero of=/swapfile bs=1024 count=8388608 + mkswap /swapfile + swapon /swapfile + echo "/swapfile swap swap defaults 0 0" >> /etc/fstab +fi + +# Patch ltp +patch --strip=1 ${builddir}/pan/ltp-pan.c files/ltp-pan-ltp-testname-stamps-in-dmesg-and-console.patch + +# Clear existing logs +rm -rf ${ltpdir} + +# Run autotools for ltp +pushd ${builddir} +make autotools +popd + +# Configure ltp +pushd ${builddir} +./configure --prefix ${ltpdir} +popd + +# Build ltp +pushd ${builddir} +make +popd + +# Install ltp +pushd ${builddir} +make install +popd + +# Get known issues +./knownissues.sh > ${ltpdir}/ltp.skip + +# Run ltp +set -e +for test in ${userspacetargets} ; do + ./runtest.sh ${ltpdir} ${test} +done +set +e + +# Fail play if testing failed +for test in ${userspacetargets} ; do + number_failures_stdout=$(egrep '^Total Failures' ${ltpdir}/logs/${test}/ltp.log | awk '{print $3}') + if [ ${number_failures_stdout} != 0 ] ; then + exit 1 + fi +done