netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shyam Saini <mayhs11saini@gmail.com>
To: netfilter-devel@vger.kernel.org
Cc: Shyam Saini <mayhs11saini@gmail.com>
Subject: [PATCH 1/2] tests: shell: Add test for incomplete set add set command
Date: Fri, 23 Jun 2017 17:35:55 +0530	[thread overview]
Message-ID: <1498219556-25179-1-git-send-email-mayhs11saini@gmail.com> (raw)

Before the [Test] commit if we run nft with incomplete "add set"
command it caused segmentation fault and exit with error code 139 and
further it didn't throw any error message.

  For example:
    $ sudo nft add set t s

But after the [Test] commit it throws syntax error message and exits with
return value 1.

  For example:
    $ sudo nft add set t s
    <cmdline>:1:12-12: Error: syntax error, unexpected newline, expecting '{'
    add set t s
               ^

This commit tests changes made in the [Test] commit.

Test:c6cd7c22548a ( "src: fix crash when inputting an incomplete set add
command" )
Signed-off-by: Shyam Saini <mayhs11saini@gmail.com>
---
 .../testcases/sets/0023incomplete_add_set_command_0      | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100755 tests/shell/testcases/sets/0023incomplete_add_set_command_0

diff --git a/tests/shell/testcases/sets/0023incomplete_add_set_command_0 b/tests/shell/testcases/sets/0023incomplete_add_set_command_0
new file mode 100755
index 000000000000..b7535f7059db
--- /dev/null
+++ b/tests/shell/testcases/sets/0023incomplete_add_set_command_0
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+# This testscase checks bug identified and fixed in the commit Id "c6cd7c22548a"
+# Before the commit c6cd7c22548a, nft returns 139 (i.e, segmentation fault) which
+# indicates the bug but after the commit it returns 1.
+
+$NFT add table t
+$NFT add set t c
+
+ret=$?
+if [ $ret -ne 1 ] ;
+then
+	echo "E: returned $ret instead of 1" >&2
+	exit 1
+fi
+
-- 
1.9.1


             reply	other threads:[~2017-06-23 12:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-23 12:05 Shyam Saini [this message]
2017-06-23 12:05 ` [PATCH 2/2] tests: shell: Test input descriptors for included files Shyam Saini
2017-06-26 16:59   ` Pablo Neira Ayuso
2017-06-26 16:59 ` [PATCH 1/2] tests: shell: Add test for incomplete set add set command Pablo Neira Ayuso
2017-06-26 17:32   ` Shyam Saini
2017-06-26 17:37     ` Pablo Neira Ayuso
2017-06-26 17:54       ` Shyam Saini
2017-06-26 18:08         ` Pablo Neira Ayuso
2017-06-26 18:16           ` Shyam Saini

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=1498219556-25179-1-git-send-email-mayhs11saini@gmail.com \
    --to=mayhs11saini@gmail.com \
    --cc=netfilter-devel@vger.kernel.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).