From patchwork Fri Mar 13 15:03:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 45787 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CB78D214CB for ; Fri, 13 Mar 2015 15:04:38 +0000 (UTC) Received: by widex7 with SMTP id ex7sf4085375wid.2 for ; Fri, 13 Mar 2015 08:04:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=XvNm/l4Yf0RbMFC4sm+rxm7Dc7a6Z3qgbf/1nPTrzEo=; b=C/ijwtS8+q1k+D+LO4PezxYKBGsqBzTm0hOkUwhQQ5zDYbrAvmJH/JcXsXudZGY73e WJ1/z4EV8MBl3o/viw+uQ9WOXprX/yzXgypugiwf2ObWkbf/W4qXcSa/SKexb5aUbVQe ZoIwW0bXkm5/eQxzB/8uNQqQcZX4KB7kVmKZdBnEja+QSdjvtXhL6b0twDw0QRu5to0w yHmGHr3Nd6MbdBwtEkGx08qJQGjlX0kDmysrDp76kGUNNRrdl88v7lSHPganEimGyvh/ 7eypiAwBFXiBRl0/Oat9sG//MTe2xjw9YIeiOTI4Q+9HThcGfZaueaYA8Ukb39PHsw/h 2F4A== X-Gm-Message-State: ALoCoQl5aKPoOtgMG2ortfBnc3G0jvRmlsYCfuVIBEES8/ZokT3rw6bOPEQ3jqoZL3y4ITiwsDhB X-Received: by 10.112.219.102 with SMTP id pn6mr7187389lbc.12.1426259077932; Fri, 13 Mar 2015 08:04:37 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.179.4 with SMTP id dc4ls425688lac.73.gmail; Fri, 13 Mar 2015 08:04:37 -0700 (PDT) X-Received: by 10.112.130.100 with SMTP id od4mr21044733lbb.86.1426259077709; Fri, 13 Mar 2015 08:04:37 -0700 (PDT) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com. [209.85.217.173]) by mx.google.com with ESMTPS id f2si1563899laa.111.2015.03.13.08.04.37 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Mar 2015 08:04:37 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) client-ip=209.85.217.173; Received: by lbvp9 with SMTP id p9so23380065lbv.10 for ; Fri, 13 Mar 2015 08:04:37 -0700 (PDT) X-Received: by 10.112.212.106 with SMTP id nj10mr25005714lbc.36.1426259077596; Fri, 13 Mar 2015 08:04:37 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.35.133 with SMTP id h5csp973382lbj; Fri, 13 Mar 2015 08:04:36 -0700 (PDT) X-Received: by 10.140.201.8 with SMTP id w8mr63476716qha.51.1426259075905; Fri, 13 Mar 2015 08:04:35 -0700 (PDT) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id 191si2114928qhg.118.2015.03.13.08.04.34 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 13 Mar 2015 08:04:35 -0700 (PDT) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YWR8Z-0001PP-V3; Fri, 13 Mar 2015 15:04:31 +0000 Received: from mail-lb0-f181.google.com ([209.85.217.181]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YWR88-0001IM-QP for lng-odp@lists.linaro.org; Fri, 13 Mar 2015 15:04:04 +0000 Received: by lbiz12 with SMTP id z12so23381964lbi.12 for ; Fri, 13 Mar 2015 08:03:59 -0700 (PDT) X-Received: by 10.112.97.228 with SMTP id ed4mr29411960lbb.79.1426259039156; Fri, 13 Mar 2015 08:03:59 -0700 (PDT) Received: from localhost.localdomain (ppp91-76-169-66.pppoe.mtu-net.ru. [91.76.169.66]) by mx.google.com with ESMTPSA id i9sm450231lbs.26.2015.03.13.08.03.57 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 13 Mar 2015 08:03:58 -0700 (PDT) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Fri, 13 Mar 2015 18:03:47 +0300 Message-Id: <1426259027-14083-3-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1426259027-14083-1-git-send-email-maxim.uvarov@linaro.org> References: <1426259027-14083-1-git-send-email-maxim.uvarov@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCHv2 2/2] tests: performance add l2fwd to run script X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: maxim.uvarov@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Move common pktio linux-generic functions to setup virtual net to linux-generic folder and add running l2fwd test for make check. Signed-off-by: Maxim Uvarov --- platform/linux-generic/test/pktio_env | 90 ++++++++++++++++++++++++++++++++++ test/performance/Makefile.am | 4 +- test/performance/odp_example_l2fwd_run | 31 ++++++++++++ test/validation/odp_pktio_run | 83 +++---------------------------- 4 files changed, 132 insertions(+), 76 deletions(-) create mode 100755 platform/linux-generic/test/pktio_env create mode 100755 test/performance/odp_example_l2fwd_run diff --git a/platform/linux-generic/test/pktio_env b/platform/linux-generic/test/pktio_env new file mode 100755 index 0000000..a6d0597 --- /dev/null +++ b/platform/linux-generic/test/pktio_env @@ -0,0 +1,90 @@ +#!/bin/sh +# +# Test script wrapper for running ODP pktio tests on linux-generic. +# +# For platforms other than linux-generic this script does nothing other +# than running the odp_pktio binary, odp_pktio will then attempt to +# open and use the special device named "loop" for testing. +# +# For linux-generic the default behaviour is to create a pair of +# virtual Ethernet interfaces and provide the names of these via +# environment variables to odp_pktio, the interfaces will be removed +# before the script exits. Note that the creation of virtual Ethernet +# devices depends on having CONFIG_VETH enabled in the kernel, if not +# enabled the test will be skipped. +# +# The evironment variable ODP_PLATFORM is used to determine the +# platform under test, when this script is invoked via 'make check' +# this variable is set automatically. +# +# It's also possible to split up the steps, which makes it easier when +# debugging, for example; +# +# export ODP_PLATFORM=linux-generic +# odp_pktio_run setup +# wireshark -i pktio-p0 -k & +# odp_pktio_run +# (repeat running test multiple times..) +# odp_pktio_run cleanup +# +TEST_DIR=$(dirname $0) +# Network set up +# IF0 <---> IF1 +# IF2 <---> IF3 +IF0=pktio-p0-p1 +IF1=pktio-p1-p0 +IF2=pktio-p2-p3 +IF3=pktio-p3-p2 + +# exit codes expected by automake for skipped tests +TEST_SKIPPED=77 + +setup_env1() +{ + ip link show $IF0 2> /dev/null + if [ $? = 0 ]; then + ip link show $IF1 2> /dev/null + if [ $? = 0 ]; then + echo "pktio: interfaces $IF0 and $IF1 already exist" + return + fi + fi + + echo "pktio: setting up test interfaces $IF0, $IF1, $IF2, $IF3." + + if [ "$1" = "clean" ]; then + trap cleanup_env1 EXIT + fi + + ip link add $IF0 type veth peer name $IF1 + if [ $? != 0 ]; then + echo "pktio: error: unable to create veth pair" + exit $TEST_SKIPPED + fi + ip link add $IF2 type veth peer name $IF3 + if [ $? != 0 ]; then + echo "pktio: error: unable to create veth pair" + exit $TEST_SKIPPED + fi + + ip link set $IF0 mtu 9216 up + ip link set $IF1 mtu 9216 up + ip link set $IF2 mtu 9216 up + ip link set $IF3 mtu 9216 up + ifconfig $IF0 -arp + ifconfig $IF1 -arp + ifconfig $IF2 -arp + ifconfig $IF3 -arp + + # network needs a little time to come up + sleep 1 +} + +cleanup_env1() +{ + echo "pktio: removing test interfaces $IF0 - $IF3" + ip link del $IF0 2> /dev/null + ip link del $IF1 2> /dev/null + ip link del $IF2 2> /dev/null + ip link del $IF3 2> /dev/null +} diff --git a/test/performance/Makefile.am b/test/performance/Makefile.am index 3be3721..4f480c3 100644 --- a/test/performance/Makefile.am +++ b/test/performance/Makefile.am @@ -1,10 +1,12 @@ include $(top_srcdir)/test/Makefile.inc +TESTS_ENVIRONMENT = ODP_PLATFORM=${with_platform} + EXECUTABLES = COMPILE_ONLY = odp_scheduling -TESTSCRIPTS = odp_scheduling_run +TESTSCRIPTS = odp_scheduling_run odp_example_l2fwd_run if test_perf TESTS = $(EXECUTABLES) $(TESTSCRIPTS) diff --git a/test/performance/odp_example_l2fwd_run b/test/performance/odp_example_l2fwd_run new file mode 100755 index 0000000..69784f9 --- /dev/null +++ b/test/performance/odp_example_l2fwd_run @@ -0,0 +1,31 @@ +#!/bin/sh + +TEST_DIR=$(dirname $0) + +if [ "$ODP_PLATFORM" = "" ]; then + echo "pktio: error: ODP_PLATFORM must be defined" + # not skipped as this should never happen via "make check" + exit 1 +fi + +if [ "$ODP_PLATFORM" = "linux-generic" ]; then +echo "source ${TEST_DIR}/../../platform/linux-generic/test/pktio_env" +. ${TEST_DIR}/../../platform/linux-generic/test/pktio_env +fi + +run_l2fwd_example() +{ + setup_env1 + #ping is too slow, needed to replace it with odp generator + (ping -w 65 -I $IF0 -f 1.1.1.1 2>&1 > /dev/null) & + echo "Run $TEST_DIR/../../example/l2fwd/odp_l2fwd -i $IF1,$IF2 -m 0 -t 60" + $TEST_DIR/../../example/l2fwd/odp_l2fwd -i $IF1,$IF2 -m 0 -t 60 + cleanup_env1 + exit 0 +} + +case "$1" in + setup) setup_env1 ;; + cleanup) cleanup_env1 ;; + *) run_l2fwd_example ;; +esac diff --git a/test/validation/odp_pktio_run b/test/validation/odp_pktio_run index 6177caa..37b775f 100755 --- a/test/validation/odp_pktio_run +++ b/test/validation/odp_pktio_run @@ -1,76 +1,15 @@ #!/bin/sh -# -# Test script wrapper for running ODP pktio tests on linux-generic. -# -# For platforms other than linux-generic this script does nothing other -# than running the odp_pktio binary, odp_pktio will then attempt to -# open and use the special device named "loop" for testing. -# -# For linux-generic the default behaviour is to create a pair of -# virtual Ethernet interfaces and provide the names of these via -# environment variables to odp_pktio, the interfaces will be removed -# before the script exits. Note that the creation of virtual Ethernet -# devices depends on having CONFIG_VETH enabled in the kernel, if not -# enabled the test will be skipped. -# -# The evironment variable ODP_PLATFORM is used to determine the -# platform under test, when this script is invoked via 'make check' -# this variable is set automatically. -# -# It's also possible to split up the steps, which makes it easier when -# debugging, for example; -# -# export ODP_PLATFORM=linux-generic -# odp_pktio_run setup -# wireshark -i pktio-p0 -k & -# odp_pktio_run -# (repeat running test multiple times..) -# odp_pktio_run cleanup -# TEST_DIR=$(dirname $0) -IF0=pktio-p0 -IF1=pktio-p1 -# exit codes expected by automake for skipped tests -TEST_SKIPPED=77 +if [ "$ODP_PLATFORM" = "" ]; then + echo "pktio: error: ODP_PLATFORM must be defined" + # not skipped as this should never happen via "make check" + exit 1 +fi -setup_env1() -{ - ip link show $IF0 2> /dev/null - if [ $? = 0 ]; then - ip link show $IF1 2> /dev/null - if [ $? = 0 ]; then - echo "pktio: interfaces $IF0 and $IF1 already exist" - return - fi - fi - - echo "pktio: setting up test interfaces $IF0 and $IF1" - - if [ "$1" = "clean" ]; then - trap cleanup_env1 EXIT - fi - - ip link add $IF0 type veth peer name $IF1 - if [ $? != 0 ]; then - echo "pktio: error: unable to create veth pair" - exit $TEST_SKIPPED - fi - ip link set $IF0 mtu 9216 up - ip link set $IF1 mtu 9216 up - ifconfig $IF0 -arp - ifconfig $IF1 -arp - - # network needs a little time to come up - sleep 1 -} - -cleanup_env1() -{ - echo "pktio: removing test interfaces $IF0 and $IF1" - ip link del $IF0 2> /dev/null - ip link del $IF1 2> /dev/null -} +if [ "$ODP_PLATFORM" = "linux-generic" ]; then +. ${TEST_DIR}/../../platform/linux-generic/test/pktio_env +fi run_test() { @@ -118,12 +57,6 @@ run() run_test } -if [ "$ODP_PLATFORM" = "" ]; then - echo "pktio: error: ODP_PLATFORM must be defined" - # not skipped as this should never happen via "make check" - exit 1 -fi - case "$1" in setup) setup_env1 ;; cleanup) cleanup_env1 ;;