Extend Boost support through at least v1.67, per upstream (#916000).
authorAaron M. Ucko <ucko@debian.org>
Thu, 13 Dec 2018 03:19:19 +0000 (22:19 -0500)
committerAaron M. Ucko <ucko@debian.org>
Thu, 13 Dec 2018 03:19:19 +0000 (22:19 -0500)
d/patches/support_boost_1_67: New patch to extend Boost support
(used for uninstalled tests) through at least version 1.67, per
upstream (https://www.ncbi.nlm.nih.gov/viewvc/v1/trunk/c%2B%2B)
revisions 79910, 79926, 79928, and 79929.

debian/changelog
debian/patches/series
debian/patches/support_boost_1_67 [new file with mode: 0644]

index 8e8d8f00115daf7dc23d39759207c2c1313e4942..3b09900ca65db4bc4d04d651ba32caceecfab074 100644 (file)
@@ -4,8 +4,12 @@ ncbi-blast+ (2.7.1-2) UNRELEASED; urgency=medium
   * d/control: fix Vcs-* links to point to salsa
 
   [ Aaron M. Ucko ]
+  * d/patches/support_boost_1_67: New patch to extend Boost support
+    (used for uninstalled tests) through at least version 1.67, per
+    upstream (https://www.ncbi.nlm.nih.gov/viewvc/v1/trunk/c%2B%2B)
+    revisions 79910, 79926, 79928, and 79929.  (Closes: #916000.)
 
- -- Aaron M. Ucko <ucko@debian.org>  Wed, 12 Dec 2018 22:13:37 -0500
+ -- Aaron M. Ucko <ucko@debian.org>  Wed, 12 Dec 2018 22:19:18 -0500
 
 ncbi-blast+ (2.7.1-1) unstable; urgency=medium
 
index 5d8459620e395b8cfa47c1b8bf25a1fef773da45..a0ae2e07cc083a482b908afc962becbb342b79d9 100644 (file)
@@ -12,3 +12,4 @@ support_x32
 suppress_gnutls_version_check
 optionally_keep_sequence
 fix_unit_tests
+support_boost_1_67
diff --git a/debian/patches/support_boost_1_67 b/debian/patches/support_boost_1_67
new file mode 100644 (file)
index 0000000..40d2a78
--- /dev/null
@@ -0,0 +1,274 @@
+--- a/c++/include/corelib/teamcity_messages.h
++++ b/c++/include/corelib/teamcity_messages.h
+@@ -33,9 +33,9 @@ protected:
+     std::ostream *m_out;
+ public:
+-    std::string escape(std::string s);
++    std::string escape(const std::string &s);
+     void openMsg(const std::string &name);
+-    void writeProperty(std::string name, std::string value);
++    void writeProperty(const std::string &name, const std::string &value);
+     void closeMsg();
+ public:
+@@ -46,14 +46,14 @@ public:
+     void setOutput(std::ostream &);
+-    void suiteStarted(std::string name, std::string flowid =  std::string());
+-    void suiteFinished(std::string name, std::string flowid =  std::string());
++    void suiteStarted(const std::string &name, const std::string &flowid =  std::string());
++    void suiteFinished(const std::string &name, const std::string &flowid =  std::string());
+-    void testStarted(std::string name, std::string flowid =  std::string(), bool captureStandardOutput = false);
+-    void testFailed(std::string name, std::string message, std::string details, std::string flowid =  std::string());
+-    void testIgnored(std::string name, std::string message, std::string flowid =  std::string());
+-    void testOutput(std::string name, std::string output, std::string flowid, bool isStdErr = StdOut);
+-    void testFinished(std::string name, int durationMs = -1, std::string flowid = std::string());
++    void testStarted(const std::string &name, const std::string &flowid =  std::string(), bool captureStandardOutput = false);
++    void testFailed(const std::string &name, const std::string &message, const std::string &details, const std::string &flowid =  std::string());
++    void testIgnored(const std::string &name, const std::string &message, const std::string &flowid =  std::string());
++    void testOutput(const std::string &name, const std::string &output, const std::string &flowid, bool isStdErr = StdOut);
++    void testFinished(const std::string &name, int durationMs = -1, const std::string &flowid = std::string());
+ };
+ }
+--- a/c++/src/corelib/teamcity_boost.cpp
++++ b/c++/src/corelib/teamcity_boost.cpp
+@@ -83,6 +83,17 @@ public:
+     virtual void entry_context_start(std::ostream&, boost::unit_test::log_level);
+     virtual void log_entry_context(std::ostream&, boost::unit_test::const_string);
+     virtual void entry_context_finish(std::ostream&);
++
++#if BOOST_VERSION >= 106500
++     // Since v1.65.0 the log level is passed to the formatters for the contexts
++     // See boostorg/test.git:fcb302b66ea09c25f0682588d22fbfdf59eac0f7
++     void log_entry_context(std::ostream& os, boost::unit_test::log_level, boost::unit_test::const_string ctx) override {
++         log_entry_context(os, ctx);
++     }
++     void entry_context_finish(std::ostream& os, boost::unit_test::log_level) override {
++         entry_context_finish(os);
++     }
++#endif
+ };
+ // Fake fixture to register formatter
+@@ -90,14 +101,17 @@ struct TeamcityFormatterRegistrar {
+     TeamcityFormatterRegistrar() {
+         if (underTeamcity()) {
+             boost::unit_test::unit_test_log.set_formatter(new TeamcityBoostLogFormatter());
+-            boost::unit_test::unit_test_log.set_threshold_level
+-                (RTCFG(but::log_level, LOG_LEVEL, log_level));
++            boost::unit_test::unit_test_log.set_threshold_level(boost::unit_test::log_test_units);
+         }
+     }
+ };
+ BOOST_GLOBAL_FIXTURE(TeamcityFormatterRegistrar);
++// Dummy method used to keep object file in case of static library linking
++// See README.md and https://github.com/JetBrains/teamcity-cpp/pull/19
++void TeamcityGlobalFixture() {}
++
+ // Formatter implementation
+ static std::string toString(boost::unit_test::const_string bstr) {
+     std::stringstream ss;
+--- a/c++/src/corelib/teamcity_messages.cpp
++++ b/c++/src/corelib/teamcity_messages.cpp
+@@ -26,7 +26,7 @@ namespace jetbrains {
+ namespace teamcity {
+ std::string getFlowIdFromEnvironment() {
+-#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)) && 0
++#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32)) && !defined(__CYGWIN__) && !defined(__MINGW32__) && 0
+     char *flowId = NULL;
+     size_t sz = 0;
+     std::string result;
+@@ -43,7 +43,7 @@ std::string getFlowIdFromEnvironment() {
+ }
+ bool underTeamcity() {
+-#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)) && 0
++#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32)) && !defined(__CYGWIN__) && !defined(__MINGW32__) && 0
+     char *teamCityProjectName = 0;
+     size_t sz = 0;
+     bool result = false;
+@@ -66,8 +66,9 @@ void TeamcityMessages::setOutput(std::os
+     m_out = &out;
+ }
+-std::string TeamcityMessages::escape(std::string s) {
++std::string TeamcityMessages::escape(const std::string &s) {
+     std::string result;
++    result.reserve(s.length());
+     for (size_t i = 0; i < s.length(); i++) {
+         char c = s[i];
+@@ -86,8 +87,7 @@ std::string TeamcityMessages::escape(std
+ }
+ void TeamcityMessages::openMsg(const std::string &name) {
+-    // endl for http://jetbrains.net/tracker/issue/TW-4412
+-    *m_out << std::endl << "##teamcity[" << name;
++    *m_out << "##teamcity[" << name;
+ }
+ void TeamcityMessages::closeMsg() {
+@@ -96,11 +96,11 @@ void TeamcityMessages::closeMsg() {
+     *m_out << std::endl;
+ }
+-void TeamcityMessages::writeProperty(std::string name, std::string value) {
++void TeamcityMessages::writeProperty(const std::string &name, const std::string &value) {
+     *m_out << " " << name << "='" << escape(value) << "'";
+ }
+-void TeamcityMessages::suiteStarted(std::string name, std::string flowid) {
++void TeamcityMessages::suiteStarted(const std::string &name, const std::string &flowid) {
+     openMsg("testSuiteStarted");
+     writeProperty("name", name);
+     if(flowid.length() > 0) {
+@@ -110,7 +110,7 @@ void TeamcityMessages::suiteStarted(std:
+     closeMsg();
+ }
+-void TeamcityMessages::suiteFinished(std::string name, std::string flowid) {
++void TeamcityMessages::suiteFinished(const std::string &name, const std::string &flowid) {
+     openMsg("testSuiteFinished");
+     writeProperty("name", name);
+     if(flowid.length() > 0) {
+@@ -120,7 +120,7 @@ void TeamcityMessages::suiteFinished(std
+     closeMsg();
+ }
+-void TeamcityMessages::testStarted(std::string name, std::string flowid, bool captureStandardOutput) {
++void TeamcityMessages::testStarted(const std::string &name, const std::string &flowid, bool captureStandardOutput) {
+     openMsg("testStarted");
+     writeProperty("name", name);
+     if(flowid.length() > 0) {
+@@ -134,7 +134,7 @@ void TeamcityMessages::testStarted(std::
+     closeMsg();
+ }
+-void TeamcityMessages::testFinished(std::string name, int durationMs, std::string flowid) {
++void TeamcityMessages::testFinished(const std::string &name, int durationMs, const std::string &flowid) {
+     openMsg("testFinished");
+     writeProperty("name", name);
+@@ -152,7 +152,7 @@ void TeamcityMessages::testFinished(std:
+     closeMsg();
+ }
+-void TeamcityMessages::testFailed(std::string name, std::string message, std::string details, std::string flowid) {
++void TeamcityMessages::testFailed(const std::string &name, const std::string &message, const std::string &details, const std::string &flowid) {
+     openMsg("testFailed");
+     writeProperty("name", name);
+     writeProperty("message", message);
+@@ -164,7 +164,7 @@ void TeamcityMessages::testFailed(std::s
+     closeMsg();
+ }
+-void TeamcityMessages::testIgnored(std::string name, std::string message, std::string flowid) {
++void TeamcityMessages::testIgnored(const std::string &name, const std::string &message, const std::string &flowid) {
+     openMsg("testIgnored");
+     writeProperty("name", name);
+     writeProperty("message", message);
+@@ -175,7 +175,7 @@ void TeamcityMessages::testIgnored(std::
+     closeMsg();
+ }
+-void TeamcityMessages::testOutput(std::string name, std::string output, std::string flowid, bool isStdError) {
++void TeamcityMessages::testOutput(const std::string &name, const std::string &output, const std::string &flowid, bool isStdError) {
+     openMsg(isStdError ? "testStdErr" : "testStdOut");
+     writeProperty("name", name);
+     writeProperty("out", output);
+--- a/c++/src/corelib/test_boost.cpp
++++ b/c++/src/corelib/test_boost.cpp
+@@ -95,8 +95,15 @@
+ #if BOOST_VERSION >= 106000
+ #  define attr_value utils::attr_value
+-#  define RTCFG(type, new_name, old_name) \
+-    but::runtime_config::get<type >(but::runtime_config::new_name)
++#  if BOOST_VERSION >= 106400
++     // Everything old is new again, apparently...
++#    define RTCFG(type, new_name, old_name) \
++      but::runtime_config::get<type >(but::runtime_config::btrt_##old_name)
++#    define CONFIGURED_FILTERS RTCFG(std::vector<std::string>, _, run_filters)
++#  else
++#    define RTCFG(type, new_name, old_name) \
++      but::runtime_config::get<type >(but::runtime_config::new_name)
++#  endif
+ #else
+ #  define RTCFG(type, new_name, old_name) but::runtime_config::old_name()
+ #  if BOOST_VERSION >= 105900
+@@ -112,8 +119,10 @@
+ #  endif
+ #endif
+-#define CONFIGURED_FILTERS \
++#ifndef CONFIGURED_FILTERS
++  #define CONFIGURED_FILTERS \
+     RTCFG(std::vector<std::string>, RUN_FILTERS, test_to_run)
++#endif
+ #ifdef NCBI_COMPILER_MSVC
+ #  pragma warning(pop)
+@@ -278,11 +287,19 @@ public:
+     virtual
+     void entry_context_start(ostream& ostr, but::log_level l);
++#  if BOOST_VERSION >= 106500
++    virtual
++    void log_entry_context(ostream& os, but::log_level l, but::const_string v);
++
++    virtual
++    void entry_context_finish(ostream& os, but::log_level l);
++#  else
+     virtual
+     void log_entry_context(ostream& ostr, but::const_string value);
+     virtual
+     void entry_context_finish (ostream& ostr);
++#  endif
+ #endif
+ private:
+@@ -2124,6 +2141,19 @@ void CNcbiBoostLogger::entry_context_sta
+     m_Upper->entry_context_start(ostr, l);
+ }
++#  if BOOST_VERSION >= 106500
++void CNcbiBoostLogger::log_entry_context(ostream& ostr,
++                                         but::log_level l,
++                                         but::const_string value)
++{
++    m_Upper->log_entry_context(ostr, l, value);
++}
++
++void CNcbiBoostLogger::entry_context_finish(ostream& ostr, but::log_level l)
++{
++    m_Upper->entry_context_finish(ostr, l);
++}
++#  else
+ void CNcbiBoostLogger::log_entry_context(ostream& ostr,
+                                          but::const_string value)
+ {
+@@ -2134,6 +2164,7 @@ void CNcbiBoostLogger::entry_context_fin
+ {
+     m_Upper->entry_context_finish(ostr);
+ }
++#  endif
+ #endif
+ void
+@@ -2316,7 +2347,7 @@ main(int argc, char* argv[])
+         if (
+ #if BOOST_VERSION >= 106000
+-            runtime_config::get<bool>( runtime_config::RESULT_CODE )
++            RTCFG(bool, RESULT_CODE, result_code)
+ #else
+             !runtime_config::no_result_code()
+ #endif