From patchwork Sun Nov 5 15:08:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Haller X-Patchwork-Id: 1859474 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=QujmL92g; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=netfilter-devel-owner@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by legolas.ozlabs.org (Postfix) with ESMTP id 4SNdGd1KNhz1yR9 for ; Mon, 6 Nov 2023 02:11:05 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229437AbjKEPLB (ORCPT ); Sun, 5 Nov 2023 10:11:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229562AbjKEPK7 (ORCPT ); Sun, 5 Nov 2023 10:10:59 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B667BCC for ; Sun, 5 Nov 2023 07:10:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1699197008; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=l4o637IieqGGXjY5WhWShm2SP5CqQEfH1r4xLgHXmAw=; b=QujmL92g6B1i6hafqneF1HYKWcUBTGX+qLC9r/No+iOur4Y3o4Kbd34g3Z9bTrBcepBtuo Qq5Gxzkgis62/JFVoDZmHG4pY9sWu/Npkgz6xO9yExic1YP6qTpbGbWiek3W+IuSqwApHa 9AdM1QbWk27wpOlVe+S1e0aIU7qkZcQ= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-562-Oo0dbqEsNB2XAFnd4POwBA-1; Sun, 05 Nov 2023 10:10:06 -0500 X-MC-Unique: Oo0dbqEsNB2XAFnd4POwBA-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B53B3811000 for ; Sun, 5 Nov 2023 15:10:06 +0000 (UTC) Received: from localhost.localdomain (unknown [10.39.193.47]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 30F27492BFA; Sun, 5 Nov 2023 15:10:06 +0000 (UTC) From: Thomas Haller To: NetFilter Cc: Thomas Haller Subject: [PATCH nft v2 0/5] add infrastructure for unit tests Date: Sun, 5 Nov 2023 16:08:36 +0100 Message-ID: <20231105150955.349966-1-thaller@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, 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: netfilter-devel@vger.kernel.org Changes to v1: - rename some `make targets` - add `make check-unit` to alias `make check-TESTS`. These targets run the tests hooked up as "TESTS=" (which for now are the tests in tests/unit). - improve commit messages and various minor code changes. Thomas Haller (5): build: add basic "check-{local,more,all}" and "build-all" make targets build: add `make check-build` to run `./tests/build/run-tests.sh` build: add `make check-tree` to check consistency of source tree build: cleanup if-blocks for conditional compilation in "Makefile.am" tests/unit: add unit tests for libnftables .gitignore | 15 +- Makefile.am | 134 ++++++++++++--- src/.gitignore | 5 - tests/unit/nft-test.h | 14 ++ tests/unit/test-libnftables-static.c | 16 ++ tests/unit/test-libnftables.c | 21 +++ tools/test-runner.sh | 235 +++++++++++++++++++++++++++ 7 files changed, 412 insertions(+), 28 deletions(-) create mode 100644 tests/unit/nft-test.h create mode 100644 tests/unit/test-libnftables-static.c create mode 100644 tests/unit/test-libnftables.c create mode 100755 tools/test-runner.sh