Add SUSE Linux Enterprise kernel version tests
authorMichael Jeanson <mjeanson@efficios.com>
Wed, 7 Dec 2016 16:09:30 +0000 (11:09 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 7 Dec 2016 17:59:19 +0000 (12:59 -0500)
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Makefile.ABI.workarounds
abi-sle-version.sh [new file with mode: 0755]
lttng-kernel-version.h

index 470bdef71b4a89182969afb473bb618aeb2e406d..c3717f814d8c544ef5be9eb444e024196ba89ef4 100644 (file)
@@ -16,6 +16,12 @@ ifneq ($(RHEL_API_VERSION), 0)
   ccflags-y += -DRHEL_API_VERSION=$(RHEL_API_VERSION)
 endif
 
+SLE_API_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/abi-sle-version.sh $(CURDIR))
+
+ifneq ($(SLE_API_VERSION), 0)
+  ccflags-y += -DSLE_API_VERSION=$(SLE_API_VERSION)
+endif
+
 RT_PATCH_VERSION:=$(shell $(TOP_LTTNG_MODULES_DIR)/rt-patch-version.sh $(CURDIR))
 
 ifneq ($(RT_PATCH_VERSION), 0)
diff --git a/abi-sle-version.sh b/abi-sle-version.sh
new file mode 100755 (executable)
index 0000000..0bd65b1
--- /dev/null
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+# First argument is the path to the kernel headers.
+KPATH=$1
+
+if [ ! -f "${KPATH}/include/generated/autoconf.h" ]; then
+       echo 0
+       exit 0
+fi
+
+# Check if we are building against a Suse kernel
+SUSE_KERNEL="$(sed -rn 's/^#define CONFIG_SUSE_KERNEL (.*)/\1/p' "${KPATH}/include/generated/autoconf.h")"
+
+if [ "$SUSE_KERNEL" != "1" ]; then
+       echo 0
+       exit 0
+fi
+
+
+if [ ! -f "${KPATH}/include/generated/utsrelease.h" ]; then
+       echo 0
+       exit 0
+fi
+
+SLE_RELEASE="$(sed -rn 's/^#define UTS_RELEASE "(.*)-([0-9\.]+)-(.*)"/\2/p' "${KPATH}/include/generated/utsrelease.h")"
+
+SLE_RELEASE_MAJOR="$(echo "${SLE_RELEASE}" | sed -rn 's/^([0-9]+)(.*)$/\1/p')"
+SLE_RELEASE_MINOR="$(echo "${SLE_RELEASE}" | sed -rn 's/^([0-9]+)\.([0-9]+)(.*)$/\2/p')"
+SLE_RELEASE_PATCH="$(echo "${SLE_RELEASE}" | sed -rn 's/^([0-9]+)\.([0-9]+)\.([0-9]+)(.*)$/\3/p')"
+
+# Minor and patch versions can be omitted
+if [ "x$SLE_RELEASE_MINOR" = "x" ]; then
+       SLE_RELEASE_MINOR=0
+fi
+if [ "x$SLE_RELEASE_PATCH" = "x" ]; then
+       SLE_RELEASE_PATCH=0
+fi
+
+# Combine all update numbers into one
+SLE_API_VERSION="$((SLE_RELEASE_MAJOR * 10000 + SLE_RELEASE_MINOR * 100 + SLE_RELEASE_PATCH))"
+
+echo ${SLE_API_VERSION}
index d9a5f13cfb27e1f4c5f8ce038842546fa94cf0ca..387aa0ab4322cec99753f6982cd2a35867ef1124 100644 (file)
                LTTNG_RHEL_VERSION_CODE < \
                LTTNG_RHEL_KERNEL_VERSION(a_high, b_high, c_high, d_high, e_high, f_high))
 
+/* SUSE Linux enterprise */
+
+#define LTTNG_SLE_KERNEL_VERSION(a, b, c, d, e, f) \
+       (((((a) << 16) + ((b) << 8) + (c)) * 10000000ULL) + ((d) * 10000) + ((e) * 100) + (f))
+
+#ifdef SLE_API_VERSION
+#define LTTNG_SLE_VERSION_CODE \
+       ((LINUX_VERSION_CODE * 10000000ULL) + SLE_API_VERSION)
+#else
+#define LTTNG_SLE_VERSION_CODE         0
+#endif
+
+#define LTTNG_SLE_KERNEL_RANGE(a_low, b_low, c_low, d_low, e_low, f_low, \
+               a_high, b_high, c_high, d_high, e_high, f_high) \
+       (LTTNG_SLE_VERSION_CODE >= \
+               LTTNG_SLE_KERNEL_VERSION(a_low, b_low, c_low, d_low, e_low, f_low) && \
+               LTTNG_SLE_VERSION_CODE < \
+               LTTNG_SLE_KERNEL_VERSION(a_high, b_high, c_high, d_high, e_high, f_high))
+
 /* RT patch */
 
 #define LTTNG_RT_KERNEL_VERSION(a, b, c, d) \
This page took 0.028027 seconds and 4 git commands to generate.