From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id sIf1CT8bjGLn7QAAbAwnHQ (envelope-from ) for ; Tue, 24 May 2022 01:39:43 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id MC67CT8bjGIYZQEAauVa8A (envelope-from ) for ; Tue, 24 May 2022 01:39:43 +0200 Received: from mail.notmuchmail.org (yantan.tethera.net [IPv6:2a01:4f9:c011:7a79::1]) (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 aspmx1.migadu.com (Postfix) with ESMTPS id D48F442B3E for ; Tue, 24 May 2022 01:39:42 +0200 (CEST) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id BAAD45F7A1; Mon, 23 May 2022 23:39:16 +0000 (UTC) Received: from fethera.tethera.net (fethera.tethera.net [IPv6:2607:5300:60:c5::1]) by mail.notmuchmail.org (Postfix) with ESMTP id 7C16C5F787 for ; Mon, 23 May 2022 23:39:13 +0000 (UTC) Received: by fethera.tethera.net (Postfix, from userid 1001) id D2B615FBD7; Mon, 23 May 2022 19:39:12 -0400 (EDT) Received: (nullmailer pid 3506938 invoked by uid 1000); Mon, 23 May 2022 23:39:02 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: [PATCH 1/8] test: define test_private_C Date: Mon, 23 May 2022 20:38:54 -0300 Message-Id: <20220523233901.3506880-2-david@tethera.net> X-Mailer: git-send-email 2.35.2 In-Reply-To: <20220523233901.3506880-1-david@tethera.net> References: <20220523233901.3506880-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: U4DSSODO7HNYKLS423XMLNYZEULQUD4K X-Message-ID-Hash: U4DSSODO7HNYKLS423XMLNYZEULQUD4K X-MailFrom: bremner@tethera.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.3 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: DE ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1653349182; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-owner:list-unsubscribe:list-subscribe:list-post; bh=34m2QUnokLa8Kfa2RFaQk8fWVd12HRO5Ja5u8zYFWFs=; b=ZX4ggOBILlk2O+wXY/VLMl+u6dhezyioKhKouJO9Qt2LGfqjt5TsfSmA8o70lZRttb6LJV lPnq7GnfZSgPbNnzsbp095jO4KL5HB/cY4buvAic2tWlKQ7eL32X2WllmylOulY1C/vEtY zo22Un+DnanfZ04a4TRz/c2UmbGqQ8NtYemCwnz3ZeTxalIjrM3nCr+NY5odj3kQOEwtBN EWUT18aWaqcZF8Im24wBG5dduFmgq46vFam7XNrc/G2fN72HGKdUmBe1FEYwyKyAYvqzSN vFoeFlZAoFptiyLSdDQab7WPmkBnD5BERi9Ixns6jK3Z6EnESVm7bppyr3oAYw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1653349182; a=rsa-sha256; cv=none; b=YUoG6aqqpA3TlU72lE7GDaH2tV0q8NdRlYkbVEFxB+LGsBAPjAAvv2P8NhzkMJ5f6A05ha jarr/vppY0RosqM0hryv6gmkRDvSteIA6teD6Y65vYIq1Mo9rfMvdEiPQoIt3Xjz+Emitm ug9Wq9wViqbNMeMfgYbx5RqCYhEazO6YeW8jHB6mngY/5YTdb3J1TNq8U6DLFb87WYtVgd sYrEFwClz9uFoipYT3/RWZwMvW9eKz5oD8Fy+u/wLhdyb9FRlMD5/NKYe1AhvkANbYgeYd V99wjdI0YOiG0RXxjhAVpGGULRXcfeDIDB0/IOPfboQVwEYtlZ6U798eGZd5wg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -1.52 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: D48F442B3E X-Spam-Score: -1.52 X-Migadu-Scanner: scn0.migadu.com X-TUID: jkEC/UybnJ6Z When testing error handling, it is sometimes difficult to cover a particular error path deterministically. Introduce a test function to allow calling lower level functions directly. --- configure | 16 ++++++++++++++++ test/test-lib.sh | 13 +++++++++++++ 2 files changed, 29 insertions(+) diff --git a/configure b/configure index 30fee6ab..5247e05a 100755 --- a/configure +++ b/configure @@ -1566,9 +1566,17 @@ cat > sh.config < OUTPUT } +test_private_C () { + local exec_file test_file + exec_file="test${test_count}" + test_file="${exec_file}.c" + echo '#include ' > ${test_file} + cat >> ${test_file} + ${TEST_CC} ${TEST_CFLAGS} -I${NOTMUCH_SRCDIR}/test -I${NOTMUCH_SRCDIR}/lib -I${NOTMUCH_SRCDIR}/util -I${NOTMUCH_SRCDIR}/compat ${NOTMUCH_GMIME_CFLAGS} -o ${exec_file} ${test_file} ${NOTMUCH_BUILDDIR}/lib/libnotmuch.a ${NOTMUCH_GMIME_LDFLAGS} ${NOTMUCH_XAPIAN_LDFLAGS} ${NOTMUCH_BUILDDIR}/util/libnotmuch_util.a ${NOTMUCH_SFSEXP_LDFLAGS} ${NOTMUCH_BUILDDIR}/parse-time-string/libparse-time-string.a -ltalloc -lstdc++ + echo "== stdout ==" > OUTPUT.stdout + echo "== stderr ==" > OUTPUT.stderr + ./${exec_file} "$@" 1>>OUTPUT.stdout 2>>OUTPUT.stderr + notmuch_dir_sanitize OUTPUT.stdout OUTPUT.stderr | notmuch_exception_sanitize | notmuch_debug_sanitize > OUTPUT +} + make_shim () { local base_name test_file shim_file base_name="$1" -- 2.35.2