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 <tomasz.zawadzki@intel.com>
Change-Id: Ia4aa9fcbc3ad810755cfecd745c5c1ecd2a70717
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4240
Community-CI: Broadcom CI
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Tomasz Zawadzki 2020-09-15 04:17:22 -04:00
parent a06628195e
commit 9b294aeaa6

View File

@ -34,7 +34,8 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../../../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
CUNIT_VERSION = $(shell echo "\#include <CUnit/CUnit.h>" | $(CC) -E -dM - | sed -n -e 's/.*VERSION "\([0-9\.\-]*\).*/\1/p')
HASH = \#
CUNIT_VERSION = $(shell echo "$(HASH)include <CUnit/CUnit.h>" | $(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