summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonstantin Ananyev <konstantin.ananyev@intel.com>2018-02-09 13:12:27 +0000
committerKonstantin Ananyev <konstantin.ananyev@intel.com>2018-02-09 13:13:22 +0000
commitd8967fb1c34964dd1205214e38ce0739d328ded4 (patch)
treeab6d5f53ced850de1b7d10d67c574082c8234078
parent9c72413c6cca6525089c12a39d21d6c34d6bee62 (diff)
tldk: introduce versioning, follow DPDK notationv18.02
Change-Id: I9d83b254fa66ff72dd2faddf366f35ecda13a6ea Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
-rw-r--r--lib/libtle_misc/Makefile1
-rw-r--r--lib/libtle_misc/tle_version.h86
-rw-r--r--test/gtest/main.cpp4
3 files changed, 91 insertions, 0 deletions
diff --git a/lib/libtle_misc/Makefile b/lib/libtle_misc/Makefile
index 287d533..9fc26f9 100644
--- a/lib/libtle_misc/Makefile
+++ b/lib/libtle_misc/Makefile
@@ -31,5 +31,6 @@ EXPORT_MAP := tle_misc_version.map
LIBABIVER := 1
SYMLINK-y-include += tle_dpdk_wrapper.h
+SYMLINK-y-include += tle_version.h
include $(TLDK_ROOT)/mk/tle.lib.mk
diff --git a/lib/libtle_misc/tle_version.h b/lib/libtle_misc/tle_version.h
new file mode 100644
index 0000000..f2ef714
--- /dev/null
+++ b/lib/libtle_misc/tle_version.h
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2018 Intel Corporation.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file
+ * Definitions of TLDK version numbers
+ * Follows DPDK version convention.
+ */
+
+#ifndef _TLE_VERSION_H_
+#define _TLE_VERSION_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <rte_common.h>
+
+/**
+ * Major version/year number i.e. the yy in yy.mm.z
+ */
+#define TLE_VER_YEAR 18
+
+/**
+ * Minor version/month number i.e. the mm in yy.mm.z
+ */
+#define TLE_VER_MONTH 2
+
+/**
+ * Patch level number i.e. the z in yy.mm.z
+ */
+#define TLE_VER_MINOR 0
+
+/**
+ * Patch release number
+ * 0-15 = release candidates
+ * 16 = release
+ */
+#define TLE_VER_RELEASE 16
+
+/**
+ * Macro to compute a version number usable for comparisons
+ */
+#define TLE_VERSION_NUM(a, b, c, d) ((a) << 24 | (b) << 16 | (c) << 8 | (d))
+
+/**
+ * All version numbers in one to compare with RTE_VERSION_NUM()
+ */
+#define TLE_VERSION TLE_VERSION_NUM( \
+ TLE_VER_YEAR, \
+ TLE_VER_MONTH, \
+ TLE_VER_MINOR, \
+ TLE_VER_RELEASE)
+
+static const char * const tle_version = "TLDK "
+#if (TLE_VER_YEAR < 10)
+ "0"
+#endif
+ RTE_STR(TLE_VER_YEAR) "."
+#if (TLE_VER_MONTH < 10)
+ "0"
+#endif
+ RTE_STR(TLE_VER_MONTH) "."
+ RTE_STR(TLE_VER_MINOR)
+#if (TLE_VER_RELEASE < 16)
+ "rc-" RTE_STR(TLE_VER_RELEASE)
+#endif
+ "";
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _TLE_VERSION_H_ */
diff --git a/test/gtest/main.cpp b/test/gtest/main.cpp
index 53dcf78..862e847 100644
--- a/test/gtest/main.cpp
+++ b/test/gtest/main.cpp
@@ -25,6 +25,8 @@
#include <rte_mbuf.h>
#include <rte_errno.h>
+#include <tle_version.h>
+
#include "test_common.h"
struct rte_mempool *mbuf_pool;
@@ -46,6 +48,8 @@ main(int argc, char *argv[])
argc -= ret;
argv += ret;
+ printf("%s UT\n", tle_version);
+
/* get the path of binary and save in a global variable to be used later*/
realpath(argv[0], binpath);
slash = NULL;