From patchwork Sat Jul 7 08:38:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arushi Singhal X-Patchwork-Id: 940761 X-Patchwork-Delegate: pablo@netfilter.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netfilter-devel-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="bdNoVc7c"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 41N4kh4pqCz9s01 for ; Sat, 7 Jul 2018 18:38:52 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752836AbeGGIiv (ORCPT ); Sat, 7 Jul 2018 04:38:51 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:44875 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751736AbeGGIit (ORCPT ); Sat, 7 Jul 2018 04:38:49 -0400 Received: by mail-pf0-f193.google.com with SMTP id j3-v6so10208579pfh.11 for ; Sat, 07 Jul 2018 01:38:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=iNdYyK9fd+A3A5XxOc2Iqtxpj8XUFK3GXoQjeOpjZhk=; b=bdNoVc7cbicXAquvs49ouDMK1L8J/VjCkX3ZXnO6YZqFBDlAtXP+uTE8d/Zp5mBbfJ dnhYOSlDg41TXB8omwXmMxQYFaD7ghwhPiu6JJXiS/auctvYUIM/T+WcDZVhqG7X+42e sV3bDOSFwueAxNfJwvyOoJqb1JUYPFOaD++5T2a+EUHjR18ahCByDaKbgyzfu3zd8jPh /Gd857284FiUtSKLl3SudNCBGnPP3Je/XQ+z3XdrO+yHJXqF1+uRzlHFAVqLDnv8Ed5Q xfEH22wZSV4BwsOqTQiBkdhM1SUXqRvglszzMjw7j2L6OpM136O6kCG4g1KW4Br1zG2Q V4Sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=iNdYyK9fd+A3A5XxOc2Iqtxpj8XUFK3GXoQjeOpjZhk=; b=XlmXT4aob3O0jZS/5m23hBzFWmHA34RFSew2MRRco/YB9aDsaZZILfQgD31W8eB7hC jV4dHSz2NC9FpGK/aT/cJGIScus1dReSvtpOEIJdvXZ0gHhSdraSJ1YkoSEpiOJc1J7q uj7iskZtiLuH6tLPdljDQfcCf3Xar0alilUhNSOwrldiB07I/XJAZnhqH/OEIJiRPRoI mnsCNSxPO5WGnRyNsOThasX+y90WrD0dzneu3uzxpOdkdOTbp/CQm4E4c9p6XydzhRDX hOFDf0L7DwHfUaisH4NPOqaDwkbB2TLU1jE+nfgVMVx7zekrlidnAjTZX16naxOBd5O7 +nzQ== X-Gm-Message-State: APt69E1toy1dtw+JgwZYwUrPYP5+fz7G347nARhblSHOlJl/sEN7IM81 UT1p+kE8w24dYzIDseyw2BtFtkY9 X-Google-Smtp-Source: AAOMgpf2x17EZ5xl/1V/Wifra8TndLtxtt0+twAwTNR/3fyYIYVC5oomBdC440xMAlYj6ns8IS10lg== X-Received: by 2002:a62:6cc7:: with SMTP id h190-v6mr13671407pfc.113.1530952728198; Sat, 07 Jul 2018 01:38:48 -0700 (PDT) Received: from arushi-HP-Laptop-15-bs1xx ([2405:204:5681:a0af:c012:9dbb:7f66:d733]) by smtp.gmail.com with ESMTPSA id l4-v6sm4378795pgn.46.2018.07.07.01.38.46 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 07 Jul 2018 01:38:47 -0700 (PDT) Date: Sat, 7 Jul 2018 14:08:38 +0530 From: Arushi Singhal To: pablo@netfilter.org Cc: netfilter-devel@vger.kernel.org Subject: [PATCH] iptables: tests: shell: Add README Message-ID: <20180707083838.GA12761@arushi-HP-Laptop-15-bs1xx> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org 1) README is added to run test suite. 2) Rename two test-case scripts to follow proper numerical order. 3) "echo -en "\033[1A\033[K" # clean the [EXECUTING] foobar line" command should only used when verbose("-v") option is not there else instead of clearing "[EXECUTING]" prompt it is clearing last prompt of the test file. Signed-off-by: Arushi Singhal --- iptables/tests/shell/README | 17 +++++++++++++++++ iptables/tests/shell/run-tests.sh | 2 +- iptables/tests/shell/testcases/chain/0002newchain_0 | 9 +++++++++ iptables/tests/shell/testcases/chain/0003rename_1 | 12 ++++++++++++ iptables/tests/shell/testcases/chain/0004newchain_0 | 9 --------- iptables/tests/shell/testcases/chain/0005rename_1 | 12 ------------ 6 files changed, 39 insertions(+), 22 deletions(-) create mode 100644 iptables/tests/shell/README create mode 100755 iptables/tests/shell/testcases/chain/0002newchain_0 create mode 100755 iptables/tests/shell/testcases/chain/0003rename_1 delete mode 100755 iptables/tests/shell/testcases/chain/0004newchain_0 delete mode 100755 iptables/tests/shell/testcases/chain/0005rename_1 diff --git a/iptables/tests/shell/README b/iptables/tests/shell/README new file mode 100644 index 0000000..08da486 --- /dev/null +++ b/iptables/tests/shell/README @@ -0,0 +1,17 @@ +To run the test suite (as root): + $ cd iptables/tests/shell + # ./run-tests.sh + +Test files are executable files with the pattern <> , where N is the +expected return code of the executable. Since they are located with `find', +test-files can be spreaded in any sub-directories. + +You can turn on a verbose execution by calling: + # ./run-tests.sh -v + +And to run test suite for pariticular test files: + # ./run-tests.sh + +Also, test-files will receive the environment variable $XT_MULTI which contains +the path to the old iptables (xtables-legacy-multi) or new iptables (xtables-nft-multi) +binary being tested. diff --git a/iptables/tests/shell/run-tests.sh b/iptables/tests/shell/run-tests.sh index a984a45..a39aecb 100755 --- a/iptables/tests/shell/run-tests.sh +++ b/iptables/tests/shell/run-tests.sh @@ -67,10 +67,10 @@ do_test() { XT_MULTI=$xtables_multi unshare -n ${testfile} else XT_MULTI=$xtables_multi unshare -n ${testfile} > /dev/null 2>&1 + echo -en "\033[1A\033[K" # clean the [EXECUTING] foobar line fi rc_got=$? - echo -en "\033[1A\033[K" # clean the [EXECUTING] foobar line if [ "$rc_got" == "$rc_spec" ] ; then msg_info "[OK] $testfile" diff --git a/iptables/tests/shell/testcases/chain/0002newchain_0 b/iptables/tests/shell/testcases/chain/0002newchain_0 new file mode 100755 index 0000000..53f8a3a --- /dev/null +++ b/iptables/tests/shell/testcases/chain/0002newchain_0 @@ -0,0 +1,9 @@ +#!/bin/bash + +set -e + +$XT_MULTI iptables -N c1 +$XT_MULTI ip6tables -N c1 + +$XT_MULTI iptables -N c2 +$XT_MULTI ip6tables -N c2 diff --git a/iptables/tests/shell/testcases/chain/0003rename_1 b/iptables/tests/shell/testcases/chain/0003rename_1 new file mode 100755 index 0000000..975c8e1 --- /dev/null +++ b/iptables/tests/shell/testcases/chain/0003rename_1 @@ -0,0 +1,12 @@ +#!/bin/bash + +$XT_MULTI iptables -N c1 || exit 0 +$XT_MULTI iptables -N c2 || exit 0 +$XT_MULTI iptables -E c1 c2 || exit 1 + +$XT_MULTI ip6tables -N c1 || exit 0 +$XT_MULTI ip6tables -N c2 || exit 0 +$XT_MULTI ip6tables -E c1 c2 || exit 1 + +echo "E: Renamed with existing chain" >&2 +exit 0 diff --git a/iptables/tests/shell/testcases/chain/0004newchain_0 b/iptables/tests/shell/testcases/chain/0004newchain_0 deleted file mode 100755 index 53f8a3a..0000000 --- a/iptables/tests/shell/testcases/chain/0004newchain_0 +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -set -e - -$XT_MULTI iptables -N c1 -$XT_MULTI ip6tables -N c1 - -$XT_MULTI iptables -N c2 -$XT_MULTI ip6tables -N c2 diff --git a/iptables/tests/shell/testcases/chain/0005rename_1 b/iptables/tests/shell/testcases/chain/0005rename_1 deleted file mode 100755 index 975c8e1..0000000 --- a/iptables/tests/shell/testcases/chain/0005rename_1 +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -$XT_MULTI iptables -N c1 || exit 0 -$XT_MULTI iptables -N c2 || exit 0 -$XT_MULTI iptables -E c1 c2 || exit 1 - -$XT_MULTI ip6tables -N c1 || exit 0 -$XT_MULTI ip6tables -N c2 || exit 0 -$XT_MULTI ip6tables -E c1 c2 || exit 1 - -echo "E: Renamed with existing chain" >&2 -exit 0