Opened 10 years ago
Closed 4 years ago
#7397 closed Patches (fixed)
Boost.Test, since boost 1.48 is using the deprecated Boost.Timer class
Reported by: | Owned by: | Raffi Enficiaud | |
---|---|---|---|
Milestone: | Boost 1.69 | Component: | test |
Version: | Boost Development Trunk | Severity: | Problem |
Keywords: | 1.70 | Cc: |
Description
Boost 1.48 introduced a new Boost.Timer library, deprecating the old one. Boost.Test still depends on the old class. This causes compilation problems. See thread Timer & Boost.Test incompatibility from the gmane.lib.boost.devel list. From the thread:
When boost/test/included/unit_test.hpp
is included in a unit test suite, you get compilation errors where boost::timer
is declared as a class where previously it's defined as a namespace:
boost/timer.hpp(45): error C2869: 'boost::timer' : has already been defined to be a namespace boost/test/impl/framework.ipp(153): error C2882: 'timer' : illegal use of namespace identifier in expression boost/test/impl/framework.ipp(153): fatal error C1903: unable to recover from previous error(s); stopping compilation
I've attached a first attempt at a patch based on one I use in production from boost 1.49.
Of note:
- Use of the new timer classes can be disabled by defining the macro
BOOST_TEST_USE_DEPRECATED_TIMER
- Two new files are added to the
boost/test/utils
directory:timer.hpp
andprogress.hpp
progress.hpp
is there to support progress output as was available in the deprecated boost timer but which is no longer part of the new timer classes as I recall
- I tried to keep the formatting essentially the same as other files in boost test with one exception - I refrained from adding $ tags as these are just noise.
- I tried to maintain backwards compatibility for report output, notably XML output.
- The new Boost.Timer is a compiled library and requires Boost.System. If you can't stomach that then the macro choosing the old version of Boost.Timer will help.
Attachments (1)
Change History (11)
by , 10 years ago
Attachment: | boost_test_new_timer.diff added |
---|
comment:1 by , 10 years ago
These patches, attached to:
- #7397
- Boost.Test, since boost 1.48 is using the deprecated Boost.Timer class
- #7410
- Test Units (Cases and Suites) in Boost.Test do not capture __FILE__ and __LINE__ at declaration point making it impossible to provide source file linking using external test management tools
- #7417
- Detailed test status is not available in the Boost.Test log (status, assertions, passed) and so live test case status cannot be tracked
...taken together allow for sophisticated test tools to be built on top of the Boost.Test output.
comment:2 by , 10 years ago
Hi, do you know if there exists a workarround to use the new boost timers (boost::timer::cpu_timer) together with boost::test ? I tried, in a new header my_timer.h to do the following thing:
namespace my { #include <boost/timer/timer.hpp> }
and then use my::boost::timer::cpu_timer instead of boost::timer::cpu_timer. Unfortunately, this seems to create other compilation problems:
In file included from /usr/include/boost/ratio/ratio.hpp:37:0, from /usr/include/boost/chrono/duration.hpp:41, from /usr/include/boost/chrono/chrono.hpp:11, from /usr/include/boost/timer/timer.hpp:14, /usr/include/boost/ratio/detail/mpl/abs.hpp:42:16: error: expected type-specifier before ‘na’
and a whole series of other errors in boost/raio/detail/mpl. I am using boost 1.48 and gcc 4.4 on a ubuntu 64-bit.
comment:4 by , 8 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Version: | Boost 1.52.0 → Boost Development Trunk |
Merged into develop at 043a11ab711246eb69ea2b3209efcde401fc4ca0
See pull request https://github.com/boostorg/test/pull/15
comment:5 by , 8 years ago
Status: | assigned → new |
---|
comment:6 by , 8 years ago
Status: | new → assigned |
---|
comment:7 by , 7 years ago
Milestone: | To Be Determined → Boost 1.59.0 |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
comment:8 by , 7 years ago
Milestone: | Boost 1.59.0 → To Be Determined |
---|---|
Resolution: | fixed |
Status: | closed → reopened |
Mistake: this work has been postponed because it broke the header only version of boost.test (indirect inclusion of boost.system)
comment:9 by , 4 years ago
Keywords: | 1.70 added |
---|---|
Milestone: | To Be Determined → Boost 1.69 |
Summary: | Boost.Test, since boost 1.48 is using the deprecated Boost.Timer class - it should be updated to use the new class → Boost.Test, since boost 1.48 is using the deprecated Boost.Timer class |
In branch topic/GH-202-boost-timer-deprecation
for boost 1.70
comment:10 by , 4 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
In master, for 1.70 rev 412e3d5855cc7bee690cfc8d99ba7c3c0b043124
boost_test_new_timer.diff