From patchwork Wed Aug 24 14:45:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pablo Neira Ayuso X-Patchwork-Id: 662330 X-Patchwork-Delegate: pablo@netfilter.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3sK99Z2pRnz9sXx for ; Thu, 25 Aug 2016 00:46:26 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756618AbcHXOqZ (ORCPT ); Wed, 24 Aug 2016 10:46:25 -0400 Received: from mail.us.es ([193.147.175.20]:43030 "EHLO mail.us.es" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756085AbcHXOqY (ORCPT ); Wed, 24 Aug 2016 10:46:24 -0400 Received: from antivirus1-rhel7.int (unknown [192.168.2.11]) by mail.us.es (Postfix) with ESMTP id D665B231664 for ; Wed, 24 Aug 2016 16:45:18 +0200 (CEST) Received: from antivirus1-rhel7.int (localhost [127.0.0.1]) by antivirus1-rhel7.int (Postfix) with ESMTP id C7E04100A59 for ; Wed, 24 Aug 2016 16:45:18 +0200 (CEST) Received: by antivirus1-rhel7.int (Postfix, from userid 99) id BD0E8100A57; Wed, 24 Aug 2016 16:45:18 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on antivirus1-rhel7.int X-Spam-Level: X-Spam-Status: No, score=-103.2 required=7.5 tests=BAYES_50,SMTPAUTH_US, USER_IN_WHITELIST autolearn=disabled version=3.4.1 Received: from antivirus1-rhel7.int (localhost [127.0.0.1]) by antivirus1-rhel7.int (Postfix) with ESMTP id CC320100A59 for ; Wed, 24 Aug 2016 16:45:13 +0200 (CEST) Received: from 192.168.1.13 (192.168.1.13) by antivirus1-rhel7.int (F-Secure/fsigk_smtp/530/antivirus1-rhel7.int); Wed, 24 Aug 2016 16:45:13 +0200 (CEST) X-Virus-Status: clean(F-Secure/fsigk_smtp/530/antivirus1-rhel7.int) Received: (qmail 12050 invoked from network); 24 Aug 2016 16:45:13 +0200 Received: from 129.166.216.87.static.jazztel.es (HELO salvia.here) (pneira@us.es@87.216.166.129) by mail.us.es with SMTP; 24 Aug 2016 16:45:13 +0200 From: Pablo Neira Ayuso To: netfilter-devel@vger.kernel.org Subject: [PATCH nft 4/4] tests: shell: cover add and create set command Date: Wed, 24 Aug 2016 16:45:07 +0200 Message-Id: <1472049907-7935-4-git-send-email-pablo@netfilter.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1472049907-7935-1-git-send-email-pablo@netfilter.org> References: <1472049907-7935-1-git-send-email-pablo@netfilter.org> X-Virus-Scanned: ClamAV using ClamSMTP Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org This patch validates that creation of an already existing element bails out with EEXIST. Signed-off-by: Pablo Neira Ayuso --- tests/shell/testcases/sets/0007create_element_0 | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 tests/shell/testcases/sets/0007create_element_0 diff --git a/tests/shell/testcases/sets/0007create_element_0 b/tests/shell/testcases/sets/0007create_element_0 new file mode 100755 index 0000000..47b3559 --- /dev/null +++ b/tests/shell/testcases/sets/0007create_element_0 @@ -0,0 +1,15 @@ +#!/bin/bash + +# This testcase checks for add and create element commands. + +set -e +$NFT add table t +$NFT add set t s { type ipv4_addr \; } +$NFT add element t s { 1.1.1.1 } +if $NFT create element t s { 1.1.1.1 } 2>/dev/null ; then + echo "E: accepted element creation that already exists" >&2 + exit 1 +fi +$NFT add element t s { 1.1.1.1 } + +exit 0