netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Varsha Rao <rvarsha016@gmail.com>
To: Pablo Neira Ayuso <pablo@netfilter.org>, netfilter-devel@vger.kernel.org
Cc: Varsha Rao <rvarsha016@gmail.com>
Subject: [PATCH nft 12/16] tests: files: Test for meta expressions.
Date: Mon, 30 Oct 2017 02:19:27 +0530	[thread overview]
Message-ID: <20171029204931.7792-12-rvarsha016@gmail.com> (raw)
In-Reply-To: <20171029204931.7792-1-rvarsha016@gmail.com>

This patch adds test case for meta expressions.

Signed-off-by: Varsha Rao <rvarsha016@gmail.com>
---
 tests/shell/testcases/transactions/0026rule_0 | 44 +++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)
 create mode 100755 tests/shell/testcases/transactions/0026rule_0

diff --git a/tests/shell/testcases/transactions/0026rule_0 b/tests/shell/testcases/transactions/0026rule_0
new file mode 100755
index 0000000..4111ce9
--- /dev/null
+++ b/tests/shell/testcases/transactions/0026rule_0
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+# Test for meta expressions.
+
+set -e
+
+$NFT add table x
+$NFT add chain x y { type filter hook output priority 0\; }
+$NFT add rule x y meta length 1000
+$NFT add rule x y meta protocol 0x0800
+$NFT add rule x y meta mark 0
+$NFT add rule x y meta iif lo
+$NFT add rule x y meta iifname "eth0"
+$NFT add rule x y meta oif lo
+$NFT add rule x y meta oifname "eth0"
+$NFT add rule x y meta skuid 1000
+$NFT add rule x y meta nftrace set 1
+$NFT add rule x y meta rtclassid cosmos
+
+usr=$"$USER"
+
+EXPECTED="table ip x {
+	chain y {
+		type filter hook output priority 0; policy accept;
+		meta length 1000
+		meta protocol ip
+		mark 0x00000000
+		iif \"lo\"
+		iifname \"eth0\"
+		oif \"lo\"
+		oifname \"eth0\"
+		skuid \"$usr\"
+		nftrace set 1
+		rtclassid \"cosmos\"
+	}
+}"
+
+GET="$($NFT list ruleset)"
+
+if [ "$EXPECTED" != "$GET" ] ; then
+	DIFF="$(which diff)"
+	[ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
+	exit 1
+fi
-- 
2.13.6


  parent reply	other threads:[~2017-10-29 20:50 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-29 20:39 [PATCH nft 00/16] tests: files: Remove test files Varsha Rao
2017-10-29 20:49 ` [PATCH nft 01/16] tests: files: Remove tests for ipv4 Varsha Rao
2017-10-29 20:49   ` [PATCH nft 02/16] tests: files: Remove tests for ipv6 Varsha Rao
2017-10-29 20:49   ` [PATCH nft 03/16] tests: shell: Add test for log statement Varsha Rao
2017-10-29 20:49   ` [PATCH nft 04/16] tests: files: Remove log statement tests Varsha Rao
2017-10-29 20:49   ` [PATCH nft 05/16] tests: shell: Add test for log flags Varsha Rao
2017-10-29 20:49   ` [PATCH nft 06/16] tests: shell: Add tests for payload expression Varsha Rao
2017-10-29 20:49   ` [PATCH nft 07/16] tests: files: Remove payload expression tests Varsha Rao
2017-10-29 20:49   ` [PATCH nft 08/16] tests: files: Remove test for syntactical errors Varsha Rao
2017-10-29 20:49   ` [PATCH nft 09/16] tests: shell: Add test for ct expression Varsha Rao
2017-10-29 20:49   ` [PATCH nft 10/16] tests: files: Remove " Varsha Rao
2017-10-29 20:49   ` [PATCH nft 11/16] tests: files: Remove prefix file Varsha Rao
2017-10-29 20:49   ` Varsha Rao [this message]
2017-10-29 20:49   ` [PATCH nft 13/16] tests: files: Remove test for meta expression Varsha Rao
2017-10-29 20:49   ` [PATCH nft 14/16] tests: shell: Add tests for concat expression Varsha Rao
2017-10-29 20:49   ` [PATCH nft 15/16] tests: files: Remove " Varsha Rao
2017-10-29 20:49   ` [PATCH nft 16/16] tests: shell: Add test case for map expression Varsha Rao
2017-11-06 15:04 ` [PATCH nft 00/16] tests: files: Remove test files Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171029204931.7792-12-rvarsha016@gmail.com \
    --to=rvarsha016@gmail.com \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).