From patchwork Fri Nov 8 13:16:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13868174 Received: from fhigh-a1-smtp.messagingengine.com (fhigh-a1-smtp.messagingengine.com [103.168.172.152]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 32743197A82 for ; Fri, 8 Nov 2024 13:16:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.152 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731071810; cv=none; b=nYJl+/UTEED03mXsm8VRtQFSAyFPURxk8V3FvSyCWN232HcexpYgrnQ40EGkuQthSkqSuNydLfkOPQKYZIapOz6w0kY37kJGrcXFh+XSUywNAD19sL7u5iRFVCNw5n/XmAqsswBENcfIIu14MJ/muI1bwo083ZsvQ/4vxUXyGJY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731071810; c=relaxed/simple; bh=BAeSfJBcDqLtOJyWhvWt6T2ttSXwwmJ5dgC56yEfPnM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uGwu4GxZ3jVdfbhAh1dZ1Mqg0ukkE0q2O2i4cU6b2SANqjrjoiDccSou/h4snHIbPq34bMt2C/T+O78BhyMcdRQztd2atHOExZzvDFC2ml8GYZelTRjGSDG/loOjmyuxJ/fn4MUTupEh6ZtpghlO4AYvjUSeMjZkexUdSMeL1oE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=3uQDuHGb; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=HeGRWU9i; arc=none smtp.client-ip=103.168.172.152 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="3uQDuHGb"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="HeGRWU9i" Received: from phl-compute-06.internal (phl-compute-06.phl.internal [10.202.2.46]) by mailfhigh.phl.internal (Postfix) with ESMTP id 4D48211400EF; Fri, 8 Nov 2024 08:16:47 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Fri, 08 Nov 2024 08:16:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1731071807; x=1731158207; bh=Oh6BzHxnewDNyRMnOENDzQWAIzEkKRCVZm+v1eCjTcw=; b= 3uQDuHGb3oUrvQpku4DF/jdBJ4S/LFe1eIYez3REiYLcs4M3X0709aMrSNeY1S3y q7fQg+1Eoow+FMbe5IctkjZ7cBDYQSVFhhnbhl8eZg6RVdpmhDi1MXUfd/86G6fh O+qwJZxTu5t2CUbl0TpoFPq+MArGHVkEjOQuTtPVlB5dO/LebBYumyrcvp0BBX0I uL2KUvmAnTG4RNGg6NJ49CVQUBA+0qPAscNc7H44cLBwIgFtm0QarR5RtjX7n7h8 lTO3c+HHOGgHk8q4aJ2wHjUiwLHfox2VWNy9Pekmc1dz7/XFOg/NoxMPZxeJOp9y MN5rhX+9nDudAipqomKRTQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1731071807; x= 1731158207; bh=Oh6BzHxnewDNyRMnOENDzQWAIzEkKRCVZm+v1eCjTcw=; b=H eGRWU9ikp93pFUQ54CVQK+Zjs899IqYQanppOgmGxwu9r28Ii4B0YmCqDUaX/haM SAeJz5KFGIfkox57RjkflnjHpINKFuyb/5alrFmxvHuq1ckoyxuCi4g1UQrhbpFU //TKqGRJ3Dx9szYSfjdJltpegjFa4XrvgEPdVikWWyJhhXRt91pAWMEg6NNI8o06 733IWvM7ttDCyESEVSoAbEV5uN3DdtabGG1PE4NzHadDHESjUKFTPSzv3lRK253G b+1XXnYb4/IuhzNEcv2DU3ILe7txsSkuUdMrqGGrJEnAorOYLKgld4oKDtGWg7pI FkjIPexlW/E21m4Q1+pgA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrtdeigdegjecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnth hsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredtjeen ucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimh eqnecuggftrfgrthhtvghrnhepffeuiedujedvkeehuedvkeefffeivdeuleetkeduheej teekgedvudfgtdfgieelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomhepphhssehpkhhsrdhimhdpnhgspghrtghpthhtohepfedpmhhouggvpehs mhhtphhouhhtpdhrtghpthhtohepghhithesvhhgvghrrdhkvghrnhgvlhdrohhrghdprh gtphhtthhopehphhhilhhlihhprdifohhougduvdefsehgmhgrihhlrdgtohhmpdhrtghp thhtohepjhhohhgrnhhnvghsrdhstghhihhnuggvlhhinhesghhmgidruggv X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 8 Nov 2024 08:16:46 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id b45f375a (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 8 Nov 2024 13:16:15 +0000 (UTC) From: Patrick Steinhardt Date: Fri, 08 Nov 2024 14:16:23 +0100 Subject: [PATCH 1/3] t/unit-tests: convert "clar-generate.awk" into a shell script Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241108-pks-clar-build-improvements-v1-1-25c1fe65ce37@pks.im> References: <20241108-pks-clar-build-improvements-v1-0-25c1fe65ce37@pks.im> In-Reply-To: <20241108-pks-clar-build-improvements-v1-0-25c1fe65ce37@pks.im> To: git@vger.kernel.org Cc: Johannes Schindelin , Phillip Wood X-Mailer: b4 0.14.2 Convert "clar-generate.awk" into a shell script that invokes awk(1). This allows us to avoid the shell redirect in the build system, which may otherwise be a problem with build systems on platforms that use a different shell. Signed-off-by: Patrick Steinhardt --- Makefile | 2 +- contrib/buildsystems/CMakeLists.txt | 4 +-- t/unit-tests/clar-generate.awk | 50 ---------------------------- t/unit-tests/generate-clar-suites.sh | 63 ++++++++++++++++++++++++++++++++++++ 4 files changed, 66 insertions(+), 53 deletions(-) diff --git a/Makefile b/Makefile index d06c9a8ffa7b637050c9619a367fbe61e7243a74..5232b913fd20f01a7e5f41d46178e93d52c9f534 100644 --- a/Makefile +++ b/Makefile @@ -3907,7 +3907,7 @@ GIT-TEST-SUITES: FORCE $(UNIT_TEST_DIR)/clar-decls.h: $(patsubst %,$(UNIT_TEST_DIR)/%.c,$(CLAR_TEST_SUITES)) GIT-TEST-SUITES $(QUIET_GEN)$(SHELL_PATH) $(UNIT_TEST_DIR)/generate-clar-decls.sh "$@" $(filter %.c,$^) $(UNIT_TEST_DIR)/clar.suite: $(UNIT_TEST_DIR)/clar-decls.h - $(QUIET_GEN)awk -f $(UNIT_TEST_DIR)/clar-generate.awk $< >$(UNIT_TEST_DIR)/clar.suite + $(QUIET_GEN)$(SHELL_PATH) $(UNIT_TEST_DIR)/generate-clar-suites.sh $< $(UNIT_TEST_DIR)/clar.suite $(UNIT_TEST_DIR)/clar/clar.o: $(UNIT_TEST_DIR)/clar.suite $(CLAR_TEST_OBJS): $(UNIT_TEST_DIR)/clar-decls.h $(CLAR_TEST_OBJS): EXTRA_CPPFLAGS = -I$(UNIT_TEST_DIR) diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index 8974bb9fa202a0556fd9b16d105836d8cb66f543..f31936e5c8dea76a4bc1eba75d87468c809f59ee 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -1008,8 +1008,8 @@ add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/t/unit-tests/clar-decls.h" COMMAND ${CMAKE_SOURCE_DIR}/t/unit-tests/generate-clar-decls.sh "${CMAKE_BINARY_DIR}/t/unit-tests/clar-decls.h" ${clar_test_SUITES} DEPENDS ${CMAKE_SOURCE_DIR}/t/unit-tests/generate-clar-decls.sh ${clar_test_SUITES}) add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/t/unit-tests/clar.suite" - COMMAND awk -f "${CMAKE_SOURCE_DIR}/t/unit-tests/clar-generate.awk" "${CMAKE_BINARY_DIR}/t/unit-tests/clar-decls.h" > "${CMAKE_BINARY_DIR}/t/unit-tests/clar.suite" - DEPENDS "${CMAKE_SOURCE_DIR}/t/unit-tests/clar-generate.awk" "${CMAKE_BINARY_DIR}/t/unit-tests/clar-decls.h") + COMMAND "${CMAKE_SOURCE_DIR}/t/unit-tests/generate-clar-suites.sh" "${CMAKE_BINARY_DIR}/t/unit-tests/clar-decls.h" "${CMAKE_BINARY_DIR}/t/unit-tests/clar.suite" + DEPENDS "${CMAKE_SOURCE_DIR}/t/unit-tests/generate-clar-suites.sh" "${CMAKE_BINARY_DIR}/t/unit-tests/clar-decls.h") add_library(unit-tests-lib ${clar_test_SUITES} "${CMAKE_SOURCE_DIR}/t/unit-tests/clar/clar.c" diff --git a/t/unit-tests/clar-generate.awk b/t/unit-tests/clar-generate.awk deleted file mode 100644 index ab71ce6c9fc2c3d49d826f3550a95be893114508..0000000000000000000000000000000000000000 --- a/t/unit-tests/clar-generate.awk +++ /dev/null @@ -1,50 +0,0 @@ -function add_suite(suite, initialize, cleanup, count) { - if (!suite) return - suite_count++ - callback_count += count - suites = suites " {\n" - suites = suites " \"" suite "\",\n" - suites = suites " " initialize ",\n" - suites = suites " " cleanup ",\n" - suites = suites " _clar_cb_" suite ", " count ", 1\n" - suites = suites " },\n" -} - -BEGIN { - suites = "static struct clar_suite _clar_suites[] = {\n" -} - -{ - print - name = $3; sub(/\(.*$/, "", name) - suite = name; sub(/^test_/, "", suite); sub(/__.*$/, "", suite) - short_name = name; sub(/^.*__/, "", short_name) - cb = "{ \"" short_name "\", &" name " }" - if (suite != prev_suite) { - add_suite(prev_suite, initialize, cleanup, count) - if (callbacks) callbacks = callbacks "};\n" - callbacks = callbacks "static const struct clar_func _clar_cb_" suite "[] = {\n" - initialize = "{ NULL, NULL }" - cleanup = "{ NULL, NULL }" - count = 0 - prev_suite = suite - } - if (short_name == "initialize") { - initialize = cb - } else if (short_name == "cleanup") { - cleanup = cb - } else { - callbacks = callbacks " " cb ",\n" - count++ - } -} - -END { - add_suite(suite, initialize, cleanup, count) - suites = suites "};" - if (callbacks) callbacks = callbacks "};" - print callbacks - print suites - print "static const size_t _clar_suite_count = " suite_count ";" - print "static const size_t _clar_callback_count = " callback_count ";" -} diff --git a/t/unit-tests/generate-clar-suites.sh b/t/unit-tests/generate-clar-suites.sh new file mode 100755 index 0000000000000000000000000000000000000000..d5c712221e46a2eaa288fff5262438e5f04d6f72 --- /dev/null +++ b/t/unit-tests/generate-clar-suites.sh @@ -0,0 +1,63 @@ +#!/bin/sh + +if test $# -lt 2 +then + echo "USAGE: $0 " 2>&1 + exit 1 +fi + +CLAR_DECLS_H="$1" +OUTPUT="$2" + +awk ' + function add_suite(suite, initialize, cleanup, count) { + if (!suite) return + suite_count++ + callback_count += count + suites = suites " {\n" + suites = suites " \"" suite "\",\n" + suites = suites " " initialize ",\n" + suites = suites " " cleanup ",\n" + suites = suites " _clar_cb_" suite ", " count ", 1\n" + suites = suites " },\n" + } + + BEGIN { + suites = "static struct clar_suite _clar_suites[] = {\n" + } + + { + print + name = $3; sub(/\(.*$/, "", name) + suite = name; sub(/^test_/, "", suite); sub(/__.*$/, "", suite) + short_name = name; sub(/^.*__/, "", short_name) + cb = "{ \"" short_name "\", &" name " }" + if (suite != prev_suite) { + add_suite(prev_suite, initialize, cleanup, count) + if (callbacks) callbacks = callbacks "};\n" + callbacks = callbacks "static const struct clar_func _clar_cb_" suite "[] = {\n" + initialize = "{ NULL, NULL }" + cleanup = "{ NULL, NULL }" + count = 0 + prev_suite = suite + } + if (short_name == "initialize") { + initialize = cb + } else if (short_name == "cleanup") { + cleanup = cb + } else { + callbacks = callbacks " " cb ",\n" + count++ + } + } + + END { + add_suite(suite, initialize, cleanup, count) + suites = suites "};" + if (callbacks) callbacks = callbacks "};" + print callbacks + print suites + print "static const size_t _clar_suite_count = " suite_count ";" + print "static const size_t _clar_callback_count = " callback_count ";" + } +' "$CLAR_DECLS_H" >"$OUTPUT" From patchwork Fri Nov 8 13:16:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13868175 Received: from fhigh-a1-smtp.messagingengine.com (fhigh-a1-smtp.messagingengine.com [103.168.172.152]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B9C711E0DEE for ; Fri, 8 Nov 2024 13:16:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.152 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731071810; cv=none; b=pjqHSq/aGBlkNGA6jfELJaiM51XLn+GVoteHLEB2OW6DLyhJdQyiSUJtz22evXTPGImtRuaO1fMCAJuY0EnnHBkSU0blJgG7zF3z8W2uVszbPAMm1e0xvxAlC5Yr0/1IRez8i3V8ANyKy5mqZy7VXU7MQ3esYgBTU28NrUi1+NU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731071810; c=relaxed/simple; bh=G7xU4yN3UU10MOnvinAd/adQUnB5Jr2ylgPitHF6K9o=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qyA+Hdcm35BL+oQUXlgtZUU6BLTPVi3+Tqu8kYTcjDgHkk0K6awRZqrceLj0X2duYL8brFlDf3+J9Zv/0Yjvnv/vTiuvIYoXSlAwl4hB/rzfU4ZHhs4vZCRKwMUglCuUZYMmvfW5M+NLsmwC7pcjqcaveETn4kHvpJ2BQETWoVA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=qBdg+k3v; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=mr+Uf0Ax; arc=none smtp.client-ip=103.168.172.152 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="qBdg+k3v"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="mr+Uf0Ax" Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44]) by mailfhigh.phl.internal (Postfix) with ESMTP id C15F91140171; Fri, 8 Nov 2024 08:16:47 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-04.internal (MEProxy); Fri, 08 Nov 2024 08:16:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1731071807; x=1731158207; bh=9t9dsn5gpzcpy78WvofQbDLwsiSUtREWkK4IGm4W1K0=; b= qBdg+k3v+Luh/wcxaKYQ6zT+wIBzNfapTgsfjGyytd7HIPlq7CmLjfhtnwgugcu4 5sM2RzJP8ZPHnsh15rIuTI+jLk4l6PB3auktrlfNwjDpNqs7pimqrdOFKxwVQ+0b vvbmhSlK39RK8BDSf0fwdmmdlRj5/pJX4D8viIOt9L425B5qdx2rCA2K4NxPWFoe sgLx4U9Wwth2+HwiU8RbxGPiW4Nrorpdk1niD6YCzjBDQfw5xliIhylMidFXy3JV CZ0jqoitP2kR1N63jSbompSA/b4YwT9T2/1svOTJlCF2TV28QfdxIcD5OLAkphlk kwfx94kPg0sTU4luLV3hWw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1731071807; x= 1731158207; bh=9t9dsn5gpzcpy78WvofQbDLwsiSUtREWkK4IGm4W1K0=; b=m r+Uf0Ax9hSZE2hTmhNUXsox40SnQhR6scTbnfWav/7m5UNjATxaSnK+JFC0N7ox+ vhbNsSfwH5GSs2iyuPHapSIylGTvP07ksk/SGYtSVBUYiSXvyrQERjvSBPWFvyyF HSBAoOI3a34Z7Qql8mfGhBbBL9k09sh0HWEZARMRasuZCh/q1wnTSLAup6vis/i8 bBV4Gm0fkzCtCRGDRdTUkm9idvL0r5lkR008+HcXTB2i3CFIMSNQPklXaxSOBAV5 GRozYv8efXzEJ1sKMlo3z9ChsskUH9+k1Hc7IKPEtTCf5NHrWRfMOTjfOJjbWlBl dJo8gorP2mzoHQGKgfTyw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrtdeigdegjecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnth hsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredtjeen ucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimh eqnecuggftrfgrthhtvghrnhepffeuiedujedvkeehuedvkeefffeivdeuleetkeduheej teekgedvudfgtdfgieelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomhepphhssehpkhhsrdhimhdpnhgspghrtghpthhtohepfedpmhhouggvpehs mhhtphhouhhtpdhrtghpthhtohepghhithesvhhgvghrrdhkvghrnhgvlhdrohhrghdprh gtphhtthhopehphhhilhhlihhprdifohhougduvdefsehgmhgrihhlrdgtohhmpdhrtghp thhtohepjhhohhgrnhhnvghsrdhstghhihhnuggvlhhinhesghhmgidruggv X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 8 Nov 2024 08:16:46 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id e61387be (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 8 Nov 2024 13:16:16 +0000 (UTC) From: Patrick Steinhardt Date: Fri, 08 Nov 2024 14:16:24 +0100 Subject: [PATCH 2/3] cmake: use SH_EXE to execute clar scripts Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241108-pks-clar-build-improvements-v1-2-25c1fe65ce37@pks.im> References: <20241108-pks-clar-build-improvements-v1-0-25c1fe65ce37@pks.im> In-Reply-To: <20241108-pks-clar-build-improvements-v1-0-25c1fe65ce37@pks.im> To: git@vger.kernel.org Cc: Johannes Schindelin , Phillip Wood X-Mailer: b4 0.14.2 In 30bf9f0aaa (cmake: set up proper dependencies for generated clar headers, 2024-10-21), we have deduplicated the logic to generate our clar headers by reusing the same scripts that our Makefile does. Despite the deduplication, this refactoring also made us rebuild the headers in case the source files change, which didn't happen previously. The commit also introduced an issue though: we execute the scripts directly, so when the host does not have "/bin/sh" available they will fail. This is for example the case on Windows when importing the CMake project into Microsoft Visual Studio. Address the issue by invoking the scripts with `SH_EXE`, which contains the discovered path of the shell interpreter. Signed-off-by: Patrick Steinhardt --- contrib/buildsystems/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index f31936e5c8dea76a4bc1eba75d87468c809f59ee..041967e2e187476cb9d26b329deb388765c48420 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -1005,10 +1005,10 @@ parse_makefile_for_scripts(clar_test_SUITES "CLAR_TEST_SUITES" "") list(TRANSFORM clar_test_SUITES PREPEND "${CMAKE_SOURCE_DIR}/t/unit-tests/") list(TRANSFORM clar_test_SUITES APPEND ".c") add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/t/unit-tests/clar-decls.h" - COMMAND ${CMAKE_SOURCE_DIR}/t/unit-tests/generate-clar-decls.sh "${CMAKE_BINARY_DIR}/t/unit-tests/clar-decls.h" ${clar_test_SUITES} + COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/t/unit-tests/generate-clar-decls.sh "${CMAKE_BINARY_DIR}/t/unit-tests/clar-decls.h" ${clar_test_SUITES} DEPENDS ${CMAKE_SOURCE_DIR}/t/unit-tests/generate-clar-decls.sh ${clar_test_SUITES}) add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/t/unit-tests/clar.suite" - COMMAND "${CMAKE_SOURCE_DIR}/t/unit-tests/generate-clar-suites.sh" "${CMAKE_BINARY_DIR}/t/unit-tests/clar-decls.h" "${CMAKE_BINARY_DIR}/t/unit-tests/clar.suite" + COMMAND ${SH_EXE} "${CMAKE_SOURCE_DIR}/t/unit-tests/generate-clar-suites.sh" "${CMAKE_BINARY_DIR}/t/unit-tests/clar-decls.h" "${CMAKE_BINARY_DIR}/t/unit-tests/clar.suite" DEPENDS "${CMAKE_SOURCE_DIR}/t/unit-tests/generate-clar-suites.sh" "${CMAKE_BINARY_DIR}/t/unit-tests/clar-decls.h") add_library(unit-tests-lib ${clar_test_SUITES} From patchwork Fri Nov 8 13:16:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13868176 Received: from fhigh-a1-smtp.messagingengine.com (fhigh-a1-smtp.messagingengine.com [103.168.172.152]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 350181E573A for ; Fri, 8 Nov 2024 13:16:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.152 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731071810; cv=none; b=Cjk9bZz93MeN4SLIXmoh3NYZ/LybFapbZoi5RqvBrIWtk9wqaOommpEThnZfrqyFEEB4v1p0YkCQGN7RO7VGprk/hS2o58Bwg0b9keP1UuV/1kiEQgKtf5egkexcH+Pp65XfXVVOOC41ycmgnRZqvZzRAZ/clu346ECw3/d+jJQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731071810; c=relaxed/simple; bh=tgNZSXqJpeH71x7Y2HLTACO6t9mU0604RxK7SjwYtdk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=aivmnG8hFKnvqC+NfELqMRBKakDnbU/g1w/o+iEVLQaSDBbEHCA84svtjrouv7rQ4oupqJPcoXuWIruhDOmXSKStd8qvYxYqx1F0+AU6qf4snb6IHH+JnwJ243Y2ZppKCJDL99yJia2bQKEPmOtduzMjrcieUOvxlRvm1RwxAb0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=qf9Xcs9/; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=jIPSXfO4; arc=none smtp.client-ip=103.168.172.152 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="qf9Xcs9/"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="jIPSXfO4" Received: from phl-compute-10.internal (phl-compute-10.phl.internal [10.202.2.50]) by mailfhigh.phl.internal (Postfix) with ESMTP id 65632114018C; Fri, 8 Nov 2024 08:16:48 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-10.internal (MEProxy); Fri, 08 Nov 2024 08:16:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1731071808; x=1731158208; bh=KwtD8ze5cB8D+bzP2jTyF8fb8nPUFTuMcWWrHTQdBl8=; b= qf9Xcs9/AOih5lr1t9SHjlS6lxaTZ1h4ATmiGmD27kJxrNPPME4B8CGITX8ElNox OjZubCLm0CxVt/4n7VXwjKmJl98m6OYbHS7ZhWUaTSSqxENisOzugdq4T+tNrVJb jDgrIvUjQB53BpPpCoFivK7GqEVAwqL7NvDuF+eyv/krnhWhZW02SmnP+e1DFbQ1 8s0qRotJpxXtDnnqiaZu9BRR4bm7tkVUzgw/QJT/sfF0RTsBh6E2GlBuA1ZNxNVj +B/1YLpFE14RyrjyoU143eBK1m/qUdQOlhnxeJsnTwgJFaN/TxAq0gzNYyULG+aj kn/Se0khHJQo4UbddhO2Ag== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1731071808; x= 1731158208; bh=KwtD8ze5cB8D+bzP2jTyF8fb8nPUFTuMcWWrHTQdBl8=; b=j IPSXfO40tQ/qpI5A15jcwVTsDDEsFFgVDxJjuq7UoB/wENVqrIhhad5nHaS2sJvS X8JL/veUztYA4IeMjiXkPfFEQrzr5Gx9rx3pyA/tIqW3eSnlNNJi6+U99OgyXQwl k5VEsXNQ5QuftAE0LoNxNZNyH0WO4pJwM8OjldMhjNb3/H/LXKvgiIo/ENZZLa19 hed2xR6PGmFok9DxW+A0SfHhc3m9ezzPXNwCo7dQAh0x0ihsHHTiArBssHEIaIhd 2cdBPmvx5ggG6A5xH1+2Z2zIug4bayHhQBzoQMkdoPlzoH0XK6snVYKdUA8w8LAG gDcpc8njYoJLcsDD60OkQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrtdeigdegjecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnth hsucdlqddutddtmdenucfjughrpefhfffugggtgffkfhgjvfevofesthejredtredtjeen ucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimh eqnecuggftrfgrthhtvghrnhepffeuiedujedvkeehuedvkeefffeivdeuleetkeduheej teekgedvudfgtdfgieelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomhepphhssehpkhhsrdhimhdpnhgspghrtghpthhtohepfedpmhhouggvpehs mhhtphhouhhtpdhrtghpthhtohepphhhihhllhhiphdrfihoohguuddvfeesghhmrghilh drtghomhdprhgtphhtthhopehgihhtsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghp thhtohepjhhohhgrnhhnvghsrdhstghhihhnuggvlhhinhesghhmgidruggv X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 8 Nov 2024 08:16:47 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 0ef58038 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 8 Nov 2024 13:16:17 +0000 (UTC) From: Patrick Steinhardt Date: Fri, 08 Nov 2024 14:16:25 +0100 Subject: [PATCH 3/3] Makefile: let clar header targets depend on their scripts Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241108-pks-clar-build-improvements-v1-3-25c1fe65ce37@pks.im> References: <20241108-pks-clar-build-improvements-v1-0-25c1fe65ce37@pks.im> In-Reply-To: <20241108-pks-clar-build-improvements-v1-0-25c1fe65ce37@pks.im> To: git@vger.kernel.org Cc: Johannes Schindelin , Phillip Wood X-Mailer: b4 0.14.2 The targets that generate clar headers depend on their source files, but not on the script that is actually generating the output. Fix the issue by adding the missing dependencies. Signed-off-by: Patrick Steinhardt --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 5232b913fd20f01a7e5f41d46178e93d52c9f534..549b24e7fdbbdc173dfec79cdaddf67ccba52e14 100644 --- a/Makefile +++ b/Makefile @@ -3904,9 +3904,9 @@ GIT-TEST-SUITES: FORCE echo "$$FLAGS" >GIT-TEST-SUITES; \ fi -$(UNIT_TEST_DIR)/clar-decls.h: $(patsubst %,$(UNIT_TEST_DIR)/%.c,$(CLAR_TEST_SUITES)) GIT-TEST-SUITES +$(UNIT_TEST_DIR)/clar-decls.h: $(patsubst %,$(UNIT_TEST_DIR)/%.c,$(CLAR_TEST_SUITES)) $(UNIT_TEST_DIR)/generate-clar-decls.sh GIT-TEST-SUITES $(QUIET_GEN)$(SHELL_PATH) $(UNIT_TEST_DIR)/generate-clar-decls.sh "$@" $(filter %.c,$^) -$(UNIT_TEST_DIR)/clar.suite: $(UNIT_TEST_DIR)/clar-decls.h +$(UNIT_TEST_DIR)/clar.suite: $(UNIT_TEST_DIR)/clar-decls.h $(UNIT_TEST_DIR)/generate-clar-suites.sh $(QUIET_GEN)$(SHELL_PATH) $(UNIT_TEST_DIR)/generate-clar-suites.sh $< $(UNIT_TEST_DIR)/clar.suite $(UNIT_TEST_DIR)/clar/clar.o: $(UNIT_TEST_DIR)/clar.suite $(CLAR_TEST_OBJS): $(UNIT_TEST_DIR)/clar-decls.h