Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp7210587rwp; Tue, 18 Jul 2023 11:40:38 -0700 (PDT) X-Google-Smtp-Source: APBJJlFPF9TFgydfBM0TI4e9NLfy8GTpUbyNLJ9PatupACmyjErPMY9XAnHhYERPyGoohTotGWYT X-Received: by 2002:aa7:80d8:0:b0:682:59aa:178d with SMTP id a24-20020aa780d8000000b0068259aa178dmr12734078pfn.1.1689705638548; Tue, 18 Jul 2023 11:40:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689705638; cv=none; d=google.com; s=arc-20160816; b=p+m0IGGJqJQSJHVZV26D+meog6Xq+afV7LjMl0Ox46yrdlTtOAjdNWTxmXguSlG5nu eWPJdVddOgOgY6QO5VUIkPvJEb61V1I3MpSMokfXEiCFFdoegh0b9Kl5OhUpEZdkMTO4 TphFN3vxMcsJINDf7sNk+u4bS9zlDS+AQyTvz6OfyvfUL+TwtLfMAxE43t4Ub0+EbOco Sl9YLPBtvcWAsuobkYEHv3+JaKtp7kD8FrNfIFrg75OysaHcBK9E0TwuTLNblOtGryI2 pRQ7yUpIOKfAQXdf2dl79dmMvrjI45/vErvnoIhsJhY2IF2PVF47F+4orpi7dwVATJu4 Qjmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature:dkim-signature; bh=R+6Tnp931IyBcl2iaeUM92xllYJUo44zUhu/fA+9Cjk=; fh=AYBt84mxTmcrc5hfCWkM+bCOywuTG/0TpbAIXsznBBI=; b=sqqOdaeS/NNlmg/bnqdw9GlHMJkx3Ctqo7fLStMQFLV3s+fo2BM/NY/VykllruJpyd AVeOrzRsKYfgPUI1t+rZw7NhzXGDongvl3n+Q9tu0b7Uk0n+IcQhcAlQ1wg2uoKjT0Yu faNmyIB2EVF5VlHp9T57S3MEAf7PouWPPedaQrkgByVyXYbYlKCNFbwPcR/xT/GQRrdA lKzqbjHo0zWjjsNEsgOTFeZyCjJrqAq2vq3yiQ7olOpwiosgqgKUYWYalCa75ZrFDtJS I2RWh+6IYVarMOPeG7oqbAd1q8PWF5KxBjuk9yUwjORQkSVu/xKL3BCCvndxxsNfhqsL rx+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@alu.unizg.hr header.s=mail header.b=HnP58nuv; dkim=fail header.i=@alu.unizg.hr header.s=mail header.b=RvPlWcAx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alu.unizg.hr Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fc8-20020a056a002e0800b00670ab28fac3si1981185pfb.378.2023.07.18.11.40.25; Tue, 18 Jul 2023 11:40:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@alu.unizg.hr header.s=mail header.b=HnP58nuv; dkim=fail header.i=@alu.unizg.hr header.s=mail header.b=RvPlWcAx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alu.unizg.hr Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230126AbjGRSaB (ORCPT + 99 others); Tue, 18 Jul 2023 14:30:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230061AbjGRSaA (ORCPT ); Tue, 18 Jul 2023 14:30:00 -0400 Received: from domac.alu.hr (domac.alu.unizg.hr [161.53.235.3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32C46F0; Tue, 18 Jul 2023 11:29:55 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by domac.alu.hr (Postfix) with ESMTP id 9F9C160173; Tue, 18 Jul 2023 20:29:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=alu.unizg.hr; s=mail; t=1689704993; bh=bKf3k2/RTiFBgasJXYefOyYbEo1QftCSqaKXXL+HykU=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=HnP58nuvgHbSJYtjH+wJmMVL5ucmPUPkSiyHqPZOUTrxItxvMDZSln2uAJJerJTsQ q0I79EMPDqQAO96a/SsS6Kwb1DZwZdcuWguomrgmpFSoIE8MVgLsQbfq8UaIRRdp6O CUCk1gcNdzdWNwVTT2b8MnhtAVWa8cWr1EWOzQRvV4rq7CJn8J5ojWqowoesp5viCU ba8BCDCjuBRK5sWjP0GSkwpRQ0xcPsPbI5HCIt+OcKGdv+xQK4URMGXStaKznGU8PJ 2hcggu0qEeLJ//UYCn4BLF6kM9KFj+Ew3LZq+Bd53lmS/UZXpubyjOnORPeDFEb52b MWRJbE8PC3QDw== X-Virus-Scanned: Debian amavisd-new at domac.alu.hr Received: from domac.alu.hr ([127.0.0.1]) by localhost (domac.alu.hr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kqPzTlKKJVYQ; Tue, 18 Jul 2023 20:29:51 +0200 (CEST) Received: from [192.168.1.6] (unknown [94.250.191.183]) by domac.alu.hr (Postfix) with ESMTPSA id 0BA4760171; Tue, 18 Jul 2023 20:29:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=alu.unizg.hr; s=mail; t=1689704991; bh=bKf3k2/RTiFBgasJXYefOyYbEo1QftCSqaKXXL+HykU=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=RvPlWcAxnK/fXWgADhdPhGvCYfrP8fURIqy5NIH9FCa6eCH0m1I7tU/G8q5Eyh4uo uL2rmDetScW8ebzXgrUMRGUqIUXNtrEoj+XHxMsYnBVgzNsousKLbxqP9qdglk1G/k cKz6QRWPcpWH5EIxhf96AitR9Z3gz6Ils8YBFE5UFAOUglnImKfSwjTFcmy95z7SpE RSSjSv2FbV/U3pNVMELC4yKX0Z7ErLouaokxDerJ3x4Av4439NvAWuy8aAYwGs0y6A zFHY3hGlA8yQX7K093W+VeSB7A75tFzcmsm/1S3+mmliqZZY8yvzbeX+f6kdPnkw27 4igSi1sHQj7dA== Message-ID: <65bf9c7a-361a-7848-6667-a599187ddce7@alu.unizg.hr> Date: Tue, 18 Jul 2023 20:29:51 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PROBLEM] selftests: net/forwarding/*.sh: 'Command line is not complete. Try option "help"' Content-Language: en-US To: Petr Machata , Ido Schimmel Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shuah Khan , Ido Schimmel , Nikolay Aleksandrov , Linux Kernel Mailing List References: <856d454e-f83c-20cf-e166-6dc06cbc1543@alu.unizg.hr> <87edl5a4fm.fsf@nvidia.com> From: Mirsad Todorovac In-Reply-To: <87edl5a4fm.fsf@nvidia.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,NICE_REPLY_A,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/18/23 12:35, Petr Machata wrote: > > Ido Schimmel writes: > >> On Mon, Jul 17, 2023 at 10:51:04PM +0200, Mirsad Todorovac wrote: >>> Tests fail with error message: >>> >>> Command line is not complete. Try option "help" >>> Failed to create netif >>> >>> The script >>> >>> # tools/testing/seltests/net/forwarding/bridge_igmp.sh >>> >>> bash `set -x` ends with an error: >>> >>> ++ create_netif_veth >>> ++ local i >>> ++ (( i = 1 )) >>> ++ (( i <= NUM_NETIFS )) >>> ++ local j=2 >>> ++ ip link show dev >>> ++ [[ 255 -ne 0 ]] >>> ++ ip link add type veth peer name >>> Command line is not complete. Try option "help" >>> ++ [[ 255 -ne 0 ]] >>> ++ echo 'Failed to create netif' >>> Failed to create netif >>> ++ exit 1 >>> >>> The problem seems to be linked with this piece of code of "lib.sh": >>> >>> create_netif_veth() >>> { >>> local i >>> >>> for ((i = 1; i <= NUM_NETIFS; ++i)); do >>> local j=$((i+1)) >>> >>> ip link show dev ${NETIFS[p$i]} &> /dev/null >>> if [[ $? -ne 0 ]]; then >>> ip link add ${NETIFS[p$i]} type veth \ >>> peer name ${NETIFS[p$j]} >>> if [[ $? -ne 0 ]]; then >>> echo "Failed to create netif" >>> exit 1 >>> fi >>> fi >>> i=$j >>> done >>> } >>> >>> Somehow, ${NETIFS[p$i]} is evaluated to an empty string? >> >> You need to provide a configuration file in >> tools/testing/selftests/net/forwarding/forwarding.config. See >> tools/testing/selftests/net/forwarding/forwarding.config.sample for >> example. >> >> Another option is to provide the interfaces on the command line. >> >> ./bridge_igmp.sh veth0 veth1 veth2 veth3 >> >> If no configuration file is present, we can try to assume that the >> tests are meant to be run with veth pairs and not with physical >> loopbacks. Something like: >> >> diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh >> index 71f7c0c49677..5b0183013017 100755 >> --- a/tools/testing/selftests/net/forwarding/lib.sh >> +++ b/tools/testing/selftests/net/forwarding/lib.sh >> @@ -16,8 +16,6 @@ TEAMD=${TEAMD:=teamd} >> WAIT_TIME=${WAIT_TIME:=5} >> PAUSE_ON_FAIL=${PAUSE_ON_FAIL:=no} >> PAUSE_ON_CLEANUP=${PAUSE_ON_CLEANUP:=no} >> -NETIF_TYPE=${NETIF_TYPE:=veth} >> -NETIF_CREATE=${NETIF_CREATE:=yes} >> MCD=${MCD:=smcrouted} >> MC_CLI=${MC_CLI:=smcroutectl} >> PING_COUNT=${PING_COUNT:=10} >> @@ -30,6 +28,20 @@ REQUIRE_MZ=${REQUIRE_MZ:=yes} >> REQUIRE_MTOOLS=${REQUIRE_MTOOLS:=no} >> STABLE_MAC_ADDRS=${STABLE_MAC_ADDRS:=no} >> TCPDUMP_EXTRA_FLAGS=${TCPDUMP_EXTRA_FLAGS:=} >> +NETIF_TYPE=${NETIF_TYPE:=veth} >> +NETIF_CREATE=${NETIF_CREATE:=yes} >> +declare -A NETIFS=( >> + [p1]=veth0 >> + [p2]=veth1 >> + [p3]=veth2 >> + [p4]=veth3 >> + [p5]=veth4 >> + [p6]=veth5 >> + [p7]=veth6 >> + [p8]=veth7 >> + [p9]=veth8 >> + [p10]=veth9 >> +) >> >> relative_path="${BASH_SOURCE%/*}" >> if [[ "$relative_path" == "${BASH_SOURCE}" ]]; then > > Or maybe this so that we get the exactly right number of interfaces? > > diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh > index 8491c97475ab..4fefdf9716dc 100755 > --- a/tools/testing/selftests/net/forwarding/lib.sh > +++ b/tools/testing/selftests/net/forwarding/lib.sh > @@ -36,6 +36,16 @@ if [[ "$relative_path" == "${BASH_SOURCE}" ]]; then > relative_path="." > fi > > +if [[ ! -v NUM_NETIFS ]]; then > + echo "SKIP: importer does not define \"NUM_NETIFS\"" > + exit $ksft_skip > +fi > + > +declare -A NETIFS > +for i in $(seq $NUM_NETIFS); do > + NETIFS[p$i]=veth$i > +done > + > if [[ -f $relative_path/forwarding.config ]]; then > source "$relative_path/forwarding.config" > fi > @@ -195,11 +205,6 @@ if [[ "$REQUIRE_MTOOLS" = "yes" ]]; then > require_command mreceive > fi > > -if [[ ! -v NUM_NETIFS ]]; then > - echo "SKIP: importer does not define \"NUM_NETIFS\"" > - exit $ksft_skip > -fi > - > ############################################################################## > # Command line options handling > This leaves the user with the output: root@defiant:# ./bridge_igmp.sh SKIP: could not find all required interfaces root@defiant:# Arguably it might be prudent to offer some sensible defaults, as a novice developer running all selftests might not have the net stack insight required to modify those, but be lucky instead to get away with the `make kselftest` run ... :-) Best regards, Mirsad Todorovac