From patchwork Tue Nov 24 13:35:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stuart Haslam X-Patchwork-Id: 57236 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp2091144lbb; Tue, 24 Nov 2015 05:35:37 -0800 (PST) X-Received: by 10.55.75.216 with SMTP id y207mr32403255qka.19.1448372137556; Tue, 24 Nov 2015 05:35:37 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id b79si15780116qga.92.2015.11.24.05.35.36; Tue, 24 Nov 2015 05:35:37 -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 AE26C61D2A; Tue, 24 Nov 2015 13:35:36 +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 4C51561D39; Tue, 24 Nov 2015 13:35:32 +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 6B0A761D3B; Tue, 24 Nov 2015 13:35:30 +0000 (UTC) Received: from mail-wm0-f50.google.com (mail-wm0-f50.google.com [74.125.82.50]) by lists.linaro.org (Postfix) with ESMTPS id 55D7061D2A for ; Tue, 24 Nov 2015 13:35:28 +0000 (UTC) Received: by wmww144 with SMTP id w144so26659662wmw.0 for ; Tue, 24 Nov 2015 05:35:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=fQmo6Sg0g5xzHvph69Md83oPzJuYzlEN3TKWJNLt4Jc=; b=sx9SU8R9JefcIhPIHpC1sSmkiIPwZVcRDErDFH8R/ncgwxH4yT4jq8k390japfzm3w Z0U1iDQnUUWjpnRP0G5FMas7G9Lr61TWhzwRUaEuu5GmpSLj0jq+U39PeOuJbp4Aww+E 81vMAj1jWdgx7LVrgNGZEMPP/7OoRD8wam1pciPIOE2Gj3gq3dU8k4Twh3p/0QZ7sLjL vOl/zTJ6tSNFR+wdTM6CxZi3rGuREt7YmFWn1/0YxsA0nTYrEXAyCpiOdY2/YIeY+EDI smQVIMoMohDmGTxx76f6Zwsgbjwxj749UXMwbfm0Y0QjjH+IQVVVATZj9LmCBaoEl9/c LuyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=fQmo6Sg0g5xzHvph69Md83oPzJuYzlEN3TKWJNLt4Jc=; b=Le5umkOPmPZOy6bmesJT/RBo7UNibO4sOD+uWIrnkd4xUc5JUL8mko1wPYkCuPPq/m 19wx1GGWmhUzEGKcu9NSYENy8A/hgC1kE1GLLrf6OAoj0BwJaGUriZdrF+iGY+kRMI5C nY3SLfdlOkN2K02DL7kyQb2lEoNBzNgtcanmkMKeerUUshj+3UMAY78DUO2AxRPtwD6n +C5kW9X053xaDYp02xNCKlCP3u7XJAIgWV0HnctnglBgb/ZsjHGfBXdGLvrtkAaZBnjZ Rdi3pn0Ttfj9nJr1wS9r4SZFwNy/ZtmxT8EKedKOKIMBfJGupym9V1MaTdMxdthNh43l X4Dg== X-Gm-Message-State: ALoCoQmrQaSsX5hdRZ6M1pJphL4ZkvSoRvX9/rRMykoMBHyR8OrlFnbvencyyuQvgSthAc+kjwsW X-Received: by 10.28.227.212 with SMTP id a203mr24966292wmh.68.1448372127329; Tue, 24 Nov 2015 05:35:27 -0800 (PST) Received: from e106441.emea.arm.com ([2001:41d0:a:3cb4::abcd]) by smtp.gmail.com with ESMTPSA id cw3sm18266738wjb.26.2015.11.24.05.35.26 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 24 Nov 2015 05:35:26 -0800 (PST) From: Stuart Haslam To: lng-odp@lists.linaro.org Date: Tue, 24 Nov 2015 13:35:00 +0000 Message-Id: <1448372101-27580-2-git-send-email-stuart.haslam@linaro.org> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1448372101-27580-1-git-send-email-stuart.haslam@linaro.org> References: <1448372101-27580-1-git-send-email-stuart.haslam@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv3 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