From 9b294aeaa686bf6b115775daa756efa526884775 Mon Sep 17 00:00:00 2001 From: Tomasz Zawadzki Date: Tue, 15 Sep 2020 04:17:22 -0400 Subject: [PATCH] ut/blob: fix CU_VERSION check for clear linux On clear linux the # was interpreted as bash comment. The result was that no file was included and CU_VERSION was undetected. Removing the backslash before hash resolves it on clearlinux, but breaks on fedora 31. Workaround in this patch portable for both, as strange as it looks. For future reference: Fedora 32, Make 4.2.1, gcc 10.2.1, bash 5.0.17 Clearlinux, Make 4.3, gcc 10.1.1, bash 5.0.16 While here, added more specific string detection for CU_VERSION. Before patch e7a86c42 only CUnit header was scanned, now other output from CC is. This will prevent accidental matches in the future. Fixes #1562 Signed-off-by: Tomasz Zawadzki Change-Id: Ia4aa9fcbc3ad810755cfecd745c5c1ecd2a70717 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4240 Community-CI: Broadcom CI Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto Tested-by: SPDK CI Jenkins --- test/unit/lib/blob/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/unit/lib/blob/Makefile b/test/unit/lib/blob/Makefile index a039a423e..516a8f758 100644 --- a/test/unit/lib/blob/Makefile +++ b/test/unit/lib/blob/Makefile @@ -34,7 +34,8 @@ SPDK_ROOT_DIR := $(abspath $(CURDIR)/../../../..) include $(SPDK_ROOT_DIR)/mk/spdk.common.mk -CUNIT_VERSION = $(shell echo "\#include " | $(CC) -E -dM - | sed -n -e 's/.*VERSION "\([0-9\.\-]*\).*/\1/p') +HASH = \# +CUNIT_VERSION = $(shell echo "$(HASH)include " | $(CC) -E -dM - | sed -n -e 's/\#define CU_VERSION "\([0-9\.\-]*\).*/\1/p') ifeq ($(CUNIT_VERSION),2.1-3) DIRS-y = blob.c else