From patchwork Thu Nov 19 12:25:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stuart Haslam X-Patchwork-Id: 56987 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp3147255lbb; Thu, 19 Nov 2015 04:25:36 -0800 (PST) X-Received: by 10.55.73.216 with SMTP id w207mr6813415qka.90.1447935935951; Thu, 19 Nov 2015 04:25:35 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id h51si6464154qgh.97.2015.11.19.04.25.35; Thu, 19 Nov 2015 04:25:35 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dkim=neutral (body hash did not verify) header.i=@linaro-org.20150623.gappssmtp.com Received: by lists.linaro.org (Postfix, from userid 109) id 466E361B1F; Thu, 19 Nov 2015 12:25:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 8A58161A2B; Thu, 19 Nov 2015 12:25:29 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 8C4F361A33; Thu, 19 Nov 2015 12:25:27 +0000 (UTC) Received: from mail-wm0-f43.google.com (mail-wm0-f43.google.com [74.125.82.43]) by lists.linaro.org (Postfix) with ESMTPS id 43219619E5 for ; Thu, 19 Nov 2015 12:25:26 +0000 (UTC) Received: by wmec201 with SMTP id c201so115413723wme.1 for ; Thu, 19 Nov 2015 04:25:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro-org.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=fQmo6Sg0g5xzHvph69Md83oPzJuYzlEN3TKWJNLt4Jc=; b=HvxAHudPvIT6lXIT3QAus+4vfxlItjpDYpoUSfvdkhPqH1HQ6jxofy/BdfVhaxAyDa RzTvV097fxoXAfnae0TCZZ1j+atpoT/7i9MiVhWiRwy+M9NGy0Se+kAGV3P2yJC9RTRG Da6kgx+hpqUjs5MvUQrMDodjsMWhd49MzOiHYBIop2EuO4sZwNBbd6yYHqk56knmirCO Lb84r7nbkvRTtUCXVRN9K+YstTpAVRrT4q/NKWN6WTyoj/z+0boFW4JFa9bgydcKuGCh O29o4QCuF2szQoiZxOtZcEvN0O47oxtwDEF4FFb1XvkKEWCTIT8floypxCr2CsN72cWu mnyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=fQmo6Sg0g5xzHvph69Md83oPzJuYzlEN3TKWJNLt4Jc=; b=YXjdl4TZN3G3xinM9QH7y5uKgCCqmxTyvF0EMro8mB77HemxXcntdfcTy6hMw3VoDc DXNMuNvEHv3Gg18DKQOPU09vqtgS1+xGFycCt7TE+9hpGCwVx+q/x+oMUkwTxpy5cuf5 xCOrrgyd61eOWn6aG0RPNLTD35zhWZ9N3yobsF5u59S3E4BT0Z0/XHrexw5pqiNjywLE EUPkbvU3n4y1ADEMqBIcoi85J+wVtUBZFp5RH+KEjsYPDX1fox/pjgBdx5vQGG1nAXMT 4+o1HDLLAoBu5V60zReixZMiQQIVLLlpnL9Y57txoNDBsmGdikta4rmmNYa77d6Gx3Qv +1Yw== X-Gm-Message-State: ALoCoQmfPMRY21RprNMXfJwP6pGkWLOGzNm7BCaRoDtrG3nUQM5oceHzYz0KdyoUOZOsIrXOAEPt X-Received: by 10.28.68.139 with SMTP id r133mr10794025wma.66.1447935925488; Thu, 19 Nov 2015 04:25:25 -0800 (PST) Received: from e106441.emea.arm.com ([2001:41d0:a:3cb4::abcd]) by smtp.gmail.com with ESMTPSA id he3sm7693662wjc.25.2015.11.19.04.25.24 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 19 Nov 2015 04:25:24 -0800 (PST) From: Stuart Haslam To: lng-odp@lists.linaro.org Date: Thu, 19 Nov 2015 12:25:09 +0000 Message-Id: <1447935910-5961-2-git-send-email-stuart.haslam@linaro.org> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1447935910-5961-1-git-send-email-stuart.haslam@linaro.org> References: <1447935910-5961-1-git-send-email-stuart.haslam@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv2 2/3] linux-generic: validation: add run-test script for post install testing X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Add a run-test script that replicates some of the "make check" functionality without depending on a whole load of Makefile gubbins. This makes it easier to perform on-target testing following a cross-build (as we want to do in CI) and gives a simple way to verify that all the required components do actually get installed correctly, using "make installcheck". ./configure --enable-test-vald --with-testdir DESTDIR=$(pwd)/test-install make install installcheck Signed-off-by: Stuart Haslam --- Change in v2: moved an endif in the Makefile to fix issue with distcheck platform/linux-generic/test/.gitignore | 1 + platform/linux-generic/test/Makefile.am | 13 +++++++ platform/linux-generic/test/run-test | 67 +++++++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+) create mode 100755 platform/linux-generic/test/run-test diff --git a/platform/linux-generic/test/.gitignore b/platform/linux-generic/test/.gitignore index 7e563b8..5dabf91 100644 --- a/platform/linux-generic/test/.gitignore +++ b/platform/linux-generic/test/.gitignore @@ -1,2 +1,3 @@ *.log *.trs +tests-validation.env diff --git a/platform/linux-generic/test/Makefile.am b/platform/linux-generic/test/Makefile.am index 11648d4..1475589 100644 --- a/platform/linux-generic/test/Makefile.am +++ b/platform/linux-generic/test/Makefile.am @@ -30,7 +30,20 @@ SUBDIRS = $(ODP_MODULES) if HAVE_PCAP TESTS += pktio/pktio_run_pcap endif +endif + +dist_check_SCRIPTS = run-test tests-validation.env $(LOG_COMPILER) + +test_SCRIPTS = $(dist_check_SCRIPTS) + +tests-validation.env: + echo "TESTS=\"$(TESTS)\"" > $@ + echo "$(TESTS_ENVIRONMENT)" >> $@ + echo "$(LOG_COMPILER)" >> $@ +if test_installdir +installcheck-local: + $(DESTDIR)/$(testdir)/run-test endif #performance tests refer to pktio_env diff --git a/platform/linux-generic/test/run-test b/platform/linux-generic/test/run-test new file mode 100755 index 0000000..2bff651 --- /dev/null +++ b/platform/linux-generic/test/run-test @@ -0,0 +1,67 @@ +#!/bin/bash +# +# Run the ODP test applications and report status in a format that +# matches the automake "make check" output. +# +# The list of tests to be run is obtained by sourcing a file that +# contains an environment variable in the form; +# +# TEST="test_app1 test_app2" +# +# The default behaviour is to run all the tests defined in files +# named tests-*.env in the same directory as this script, but a single +# test definition file can be specified using the TEST_DEF environment +# variable. +# +# Test definition files may optionally also specify a LOG_COMPILER +# which will be invoked as a wrapper to each of the test application +# (as per automake). +# +TDIR=$(dirname $(readlink -f $0)) +PASS=0 +FAIL=0 +SKIP=0 +res=0 + +if [ "$V" != "0" ]; then + verbose=1 +else + verbose=0 + mkdir -p logs +fi + +do_run_tests() { + source $1 + + for tc in $TESTS; do + tc=$(basename $tc) + if [ "$verbose" = "0" ]; then + logfile=logs/${tc}.log + touch $logfile || logfile=/dev/null + $LOG_COMPILER $TDIR/$tc > $logfile 2>&1 + else + $LOG_COMPILER $TDIR/$tc + fi + + tres=$? + case $tres in + 0) echo "PASS: $tc"; let PASS=$PASS+1 ;; + 77) echo "SKIP: $tc"; let SKIP=$SKIP+1 ;; + *) echo "FAIL: $tc"; let FAIL=$FAIL+1; res=1 ;; + esac + done +} + +if [ "$TEST_DEFS" != "" -a -f "$TEST_DEFS" ]; then + do_run_tests $TEST_DEFS +elif [ "$1" != "" ]; then + do_run_tests $TDIR/tests-${1}.env +else + for tenv in $TDIR/tests-*.env; do + do_run_tests $tenv + done +fi + +echo "TEST RESULT: $PASS tests passed, $SKIP skipped, $FAIL failed" + +exit $res