summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2016-05-16 10:42:01 +0200
committerJohnny Willemsen <jwillemsen@remedy.nl>2016-05-16 10:42:01 +0200
commita34b1737a2b4f43e9f8b58c7a067edb28b3c8c00 (patch)
tree2e74450b1d8efd63a8bed9994bb12aa5f8f5f378
parentfffa9f0bcd8a8e73c6929938c9deee404c97a7b7 (diff)
parentc7413893facd6208ccd3dec05c802f641aec5f1f (diff)
downloadATCD-a34b1737a2b4f43e9f8b58c7a067edb28b3c8c00.tar.gz
Merge pull request #257 from ops/master
Added helper macros to compare ACE/TAO versions
-rw-r--r--ACE/ace/Version.h2
-rwxr-xr-xACE/bin/make_release.py16
-rw-r--r--ACE/tests/OS_Test.cpp28
-rw-r--r--TAO/tao/Version.h2
4 files changed, 45 insertions, 3 deletions
diff --git a/ACE/ace/Version.h b/ACE/ace/Version.h
index 3644fdb9f66..2bb2d9b7889 100644
--- a/ACE/ace/Version.h
+++ b/ACE/ace/Version.h
@@ -6,3 +6,5 @@
#define ACE_MINOR_VERSION 3
#define ACE_BETA_VERSION 4
#define ACE_VERSION "6.3.4"
+#define ACE_VERSION_CODE 393988
+#define ACE_MAKE_VERSION_CODE(a,b,c) (((a) << 16) + ((b) << 8) + (c))
diff --git a/ACE/bin/make_release.py b/ACE/bin/make_release.py
index f487339197d..4ca54f170ec 100755
--- a/ACE/bin/make_release.py
+++ b/ACE/bin/make_release.py
@@ -40,7 +40,8 @@ This dict contains entries of the form
COMPONENT_version
COMPONENT_beta
COMPONENT_minor
-COMPONENT_major """
+COMPONENT_major
+COMPONENT_code """
comp_versions = dict ()
old_comp_versions = dict ()
@@ -231,16 +232,20 @@ def update_version_files (component):
## Update component/component/Version.h
version_header = """
// -*- C++ -*-
-// This is file was automatically generated by \$ACE_ROOT/bin/make_release.py
+// This is file was automatically generated by $ACE_ROOT/bin/make_release.py
#define %s_MAJOR_VERSION %s
#define %s_MINOR_VERSION %s
#define %s_BETA_VERSION %s
#define %s_VERSION \"%s\"
+#define %s_VERSION_CODE %s
+#define %s_MAKE_VERSION_CODE(a,b,c) (((a) << 16) + ((b) << 8) + (c))
""" % (component, comp_versions[component + "_major"],
component, comp_versions[component + "_minor"],
component, comp_versions[component + "_beta"],
- component, comp_versions[component + "_version"])
+ component, comp_versions[component + "_version"],
+ component, comp_versions[component + "_code"],
+ component)
if opts.take_action:
with open (component + '/' + component.lower () + "/Version.h", 'r+') as version_h:
@@ -529,6 +534,11 @@ def get_comp_versions (component):
str (comp_versions[component + "_minor"]) + '_' + \
str (comp_versions[component + "_beta"])
+ comp_versions [component + "_code"] = \
+ str((comp_versions[component + "_major"] << 16) + \
+ (comp_versions[component + "_minor"] << 8) + \
+ comp_versions[component + "_beta"])
+
old_comp_versions [component + "_version"] = \
str (old_comp_versions[component + "_major"]) + '.' + \
str (old_comp_versions[component + "_minor"]) + '.' + \
diff --git a/ACE/tests/OS_Test.cpp b/ACE/tests/OS_Test.cpp
index 232aee46b7c..789610fddba 100644
--- a/ACE/tests/OS_Test.cpp
+++ b/ACE/tests/OS_Test.cpp
@@ -698,6 +698,31 @@ compiler_test (void)
}
static int
+version_test (void)
+{
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing version macros\n")));
+
+ int code = ACE_MAKE_VERSION_CODE(ACE_MAJOR_VERSION, ACE_MINOR_VERSION, ACE_BETA_VERSION);
+ bool run_time_check = code == ACE_VERSION_CODE;
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("ACE release time version code: %d, runtime version code: %d, %s\n"),
+ ACE_VERSION_CODE, code, run_time_check ? ACE_TEXT ("OK") : ACE_TEXT ("FAIL")));
+
+ // Compile time check. Check we have ACE version 6.x
+#if ACE_VERSION_CODE > ACE_MAKE_VERSION_CODE(5, 88, 99)
+ bool compile_time_check = true;
+#else
+ bool compile_time_check = false;
+#endif
+
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Compile time version check, %s\n"),
+ compile_time_check ? ACE_TEXT ("OK") : ACE_TEXT ("FAIL")));
+
+ if(run_time_check && compile_time_check)
+ return 0;
+ return 1;
+}
+
+static int
ctime_r_test (void)
{
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Testing ctime_r\n")));
@@ -1669,6 +1694,9 @@ run_main (int, ACE_TCHAR *[])
if ((result = compiler_test ()) != 0)
status = result;
+ if ((result = version_test ()) != 0)
+ status = result;
+
ACE_END_TEST;
return status;
}
diff --git a/TAO/tao/Version.h b/TAO/tao/Version.h
index 25390580a30..3aeda303154 100644
--- a/TAO/tao/Version.h
+++ b/TAO/tao/Version.h
@@ -6,3 +6,5 @@
#define TAO_MINOR_VERSION 3
#define TAO_BETA_VERSION 4
#define TAO_VERSION "2.3.4"
+#define TAO_VERSION_CODE 131844
+#define TAO_MAKE_VERSION_CODE(a,b,c) (((a) << 16) + ((b) << 8) + (c))