From patchwork Fri Nov 13 11:15:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stuart Haslam X-Patchwork-Id: 56497 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp972033lbb; Fri, 13 Nov 2015 03:16:09 -0800 (PST) X-Received: by 10.50.112.100 with SMTP id ip4mr2906880igb.78.1447413369017; Fri, 13 Nov 2015 03:16:09 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id jf2si4813903igb.62.2015.11.13.03.16.08; Fri, 13 Nov 2015 03:16:08 -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 1DC38610F7; Fri, 13 Nov 2015 11:16:08 +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 49ED761D60; Fri, 13 Nov 2015 11:16:04 +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 B014061D60; Fri, 13 Nov 2015 11:16:02 +0000 (UTC) Received: from mail-wm0-f47.google.com (mail-wm0-f47.google.com [74.125.82.47]) by lists.linaro.org (Postfix) with ESMTPS id 81004610F7 for ; Fri, 13 Nov 2015 11:16:01 +0000 (UTC) Received: by wmww144 with SMTP id w144so24279632wmw.1 for ; Fri, 13 Nov 2015 03:16:00 -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=1R2qhT1H3OyqHdf92LMms+ThDY37/PSAiOZBhVMnHdE=; b=p+K4NZW2v6GM/rzcVPLG6tao7clkPvYTAHGAaxsXwUjBinS0TQYyWNID5ydCVcQZ/k vZiT37j0JSrc7Wii+ZjvKzcnSZHquxHmJzkWl5W4VitBiKNo02RGvjb45IgDIJT6ZJfb C2kIU6Xw7QVOyeqlRDLMbgl1HXKVqPOhh+WvDqqN5lCZWXaXQcIfXgdvLurZQC5fN7zs G1czuoTKZl//i5v/QCero5boS5nz+5TFz6r+sCQju5AFJaGoOzQj4HsVuCK6nlUHnWC4 NYJYy+LDs4e/KoASenqMULjYJk1jxcGf//k9qoO6DMzRggJy+DQEPSgiE+R651t5H18R DciQ== 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=1R2qhT1H3OyqHdf92LMms+ThDY37/PSAiOZBhVMnHdE=; b=TGkh8FpTCtNsPXcawwK3SDiHkAuGXNh4u2263xwIadKmHh/gl8XulLW9YoTOJJGV+6 9gCDsaY/dfDWoMMNUxAS+QgS+i2zTTFRkolOvk8CocLZ/R4o5y3ZqHfPUZahHUMmPq15 /v9eqF6LQHlfb3XIEjWy/TI0a7Kwg0ef5SVRL94dzExvh9WRcw4JPP0YImuvxjX8qV1E +Tup+i5TkTwWlk9QKUoFcQRG5xc3007nM9XzwxmFhKuEFNSuYMe3NjEgC6gSgvM5MmmF 6fH2GgoyOOhb4nmOKEfQtnOtFH8RaM9xvKYvdDa4LMsIHOi6ci7KqvCMrRCPHhpSUZ86 bgIw== X-Gm-Message-State: ALoCoQm5uu9WnX5cp2QqRW8UeQEhyFMBLBwskPdQRyLHakzSPyg6yJ+3EhlUgCnQYOp0N2bAr+SK X-Received: by 10.194.76.178 with SMTP id l18mr22124717wjw.75.1447413360670; Fri, 13 Nov 2015 03:16:00 -0800 (PST) Received: from e106441.emea.arm.com ([2001:41d0:a:3cb4::abcd]) by smtp.gmail.com with ESMTPSA id lx4sm11075646wjb.5.2015.11.13.03.15.59 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 13 Nov 2015 03:16:00 -0800 (PST) From: Stuart Haslam To: lng-odp@lists.linaro.org Date: Fri, 13 Nov 2015 11:15:13 +0000 Message-Id: <1447413314-24174-2-git-send-email-stuart.haslam@linaro.org> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1447413314-24174-1-git-send-email-stuart.haslam@linaro.org> References: <1447413314-24174-1-git-send-email-stuart.haslam@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH 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 --- 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..4b54549 100644 --- a/platform/linux-generic/test/Makefile.am +++ b/platform/linux-generic/test/Makefile.am @@ -31,6 +31,19 @@ if HAVE_PCAP TESTS += pktio/pktio_run_pcap 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 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