Boost logo

Boost-Commit :

From: john.groups_at_[hidden]
Date: 2008-01-30 22:24:49


Author: jtorjo
Date: 2008-01-30 22:24:48 EST (Wed, 30 Jan 2008)
New Revision: 43028
URL: http://svn.boost.org/trac/boost/changeset/43028

Log:
[logging]
v0.21.8, 31 jan 2008
- updated Jamfile.v2 to actually build the tests + the tests to use BOOST_CHECK
Text files modified:
   sandbox/logging/boost/logging/detail/raw_doc/changelog.hpp | 3
   sandbox/logging/lib/logging/internal/vc8/loggingvc8/loggingvc8.vcproj | 2
   sandbox/logging/lib/logging/internal/vc8/loggingvc8/test_now.cpp | 131 +++++++++++++++++++++++---------------
   sandbox/logging/lib/logging/tests/Jamfile.v2 | 18 ++++
   sandbox/logging/lib/logging/tests/all_tests.sln | 6 -
   sandbox/logging/lib/logging/tests/test_file/test.cpp | 10 +-
   sandbox/logging/lib/logging/tests/test_log_output/test_log_output.cpp | 16 ++-
   sandbox/logging/lib/logging/tests/test_named/test.cpp | 135 ++++++++++++++++++++-------------------
   sandbox/logging/lib/logging/tests/test_named_spacer/test.cpp | 31 +++++----
   sandbox/logging/lib/logging/tests/test_rolling_file/test.cpp | 18 +++--
   sandbox/logging/lib/logging/tests/test_simple_tss/test_simple_tss.cpp | 14 ++-
   sandbox/logging/lib/logging/tests/test_tags/test_tags.cpp | 21 +++--
   sandbox/logging/lib/logging/tests/test_ts_resouce_with_cache/test_ts_resource.cpp | 17 +++-
   sandbox/logging/lib/logging/tests/test_tss/test_tss.cpp | 3
   sandbox/logging/lib/logging/tests/test_tss/test_tss.vcproj | 2
   sandbox/logging/lib/logging/tests/test_tss/test_tss_objects.cpp | 3
   sandbox/logging/lib/logging/tests/test_tss/test_tss_on_end_delete.cpp | 3
   17 files changed, 246 insertions(+), 187 deletions(-)

Modified: sandbox/logging/boost/logging/detail/raw_doc/changelog.hpp
==============================================================================
--- sandbox/logging/boost/logging/detail/raw_doc/changelog.hpp (original)
+++ sandbox/logging/boost/logging/detail/raw_doc/changelog.hpp 2008-01-30 22:24:48 EST (Wed, 30 Jan 2008)
@@ -1,7 +1,8 @@
 /**
 @page page_changelog Changelog
 
-_at_section changelog_cur_ver Current Version: v0.21.7, 30 jan 2008
+@section changelog_cur_ver Current Version: v0.21.8, 31 jan 2008
+- updated Jamfile.v2 to actually build the tests + the tests to use BOOST_CHECK
 - updated docs : about caching/destruction
 - not using after_being_destroyed.hpp anymore - no need (see @ref after_destruction).
 - made it much easier to include Boost Logging Lib headers: format_fwd.hpp, named_write_fwd.hpp, which internally accomodate for slow compilation

Modified: sandbox/logging/lib/logging/internal/vc8/loggingvc8/loggingvc8.vcproj
==============================================================================
--- sandbox/logging/lib/logging/internal/vc8/loggingvc8/loggingvc8.vcproj (original)
+++ sandbox/logging/lib/logging/internal/vc8/loggingvc8/loggingvc8.vcproj 2008-01-30 22:24:48 EST (Wed, 30 Jan 2008)
@@ -212,7 +212,7 @@
                         <Tool
                                 Name="VCLinkerTool"
                                 LinkIncremental="2"
- AdditionalLibraryDirectories="D:\boosts\boost_1_33_1\bin\boost\libs\thread\build\libboost_thread.lib\vc-8_0\debug\threading-multi;D:\boosts\boost_1_33_1\bin\boost\libs\date_time\build\libboost_date_time.lib\vc-8_0\debug\threading-multi;D:\boosts\boost_1_33_1\bin\boost\libs\filesystem\build\libboost_filesystem.lib\vc-8_0\debug\threading-multi"
+ AdditionalLibraryDirectories="D:\boosts\boost_1_34_1\bin.v2\libs\filesystem\build\msvc-8.0\debug\link-static\threading-multi;D:\boosts\boost_1_34_1\bin.v2\libs\thread\build\msvc-8.0\debug\link-static\threading-multi\"
                                 GenerateDebugInformation="true"
                                 SubSystem="1"
                                 TargetMachine="1"

Modified: sandbox/logging/lib/logging/internal/vc8/loggingvc8/test_now.cpp
==============================================================================
--- sandbox/logging/lib/logging/internal/vc8/loggingvc8/test_now.cpp (original)
+++ sandbox/logging/lib/logging/internal/vc8/loggingvc8/test_now.cpp 2008-01-30 22:24:48 EST (Wed, 30 Jan 2008)
@@ -1,70 +1,95 @@
-/**
-_at_example mul_levels_one_logger.cpp
 
-_at_copydoc mul_levels_one_logger
+/*
+ Tests formatter::file
+*/
+#include <boost/test/minimal.hpp>
 
-_at_page mul_levels_one_logger mul_levels_one_logger.cpp Example
+#include <boost/logging/format.hpp>
+#include <string>
 
-This usage:
-- You have multiple levels (in this example: debug < info < error)
-- You want to format the message before it's written
- (in this example: prefix it by time, by index, and append newline to it)
-- You have <b>one log</b>, which writes to several log destinations
- (in this example: the console, the debug output window, and a file)
-
-In this example, all output will be written to the console, debug output window, and "out.txt" file.
-It will look similar to this one:
-
-_at_code
-21:03.17.243 [1] this is so cool 1
-21:03.17.243 [2] first error 2
-21:03.17.243 [3] hello, world
-21:03.17.243 [4] second error 3
-21:03.17.243 [5] good to be back ;) 4
-21:03.17.243 [6] third error 5
-_at_endcode
+using namespace boost::logging;
 
-*/
+typedef logger_format_write< > log_type;
 
+BOOST_DEFINE_LOG_FILTER(g_log_filter, filter::no_ts )
+BOOST_DEFINE_LOG(g_l, log_type)
 
-#include <boost/logging/format/named_write.hpp>
-typedef boost::logging::named_logger<>::type logger_type;
+#define L_ BOOST_LOG_USE_LOG_IF_FILTER(g_l(), g_log_filter()->is_enabled() )
 
-#define L_(lvl) BOOST_LOG_USE_LOG_IF_LEVEL(g_l(), g_log_level(), lvl )
 
-BOOST_DEFINE_LOG_FILTER(g_log_level, boost::logging::level::holder ) // holds the application log level
-BOOST_DEFINE_LOG(g_l, logger_type)
+void write_to_clean_file() {
+ // first, write to a clean file (that is, don't append to it)
+ g_l()->writer().add_destination( destination::file("out.txt", destination::file_settings().initial_overwrite(true) ));
+ g_l()->writer().add_formatter( formatter::append_newline_if_needed() );
+ g_l()->writer().add_destination( destination::cout() );
+ g_l()->turn_cache_off();
 
-void test_mul_levels_one_logger() {
- // formatting : time [idx] message \n
- // destinations : console, file "out.txt" and debug window
- g_l()->writer().write("%time%($hh:$mm.$ss.$mili) [%idx%] |\n", "cout file(out.txt) debug");
- g_l()->mark_as_initialized();
-
- int i = 1;
- L_(debug) << "this is so cool " << i++;
- L_(error) << "first error " << i++;
-
- std::string hello = "hello", world = "world";
- L_(debug) << hello << ", " << world;
-
- using namespace boost::logging;
- g_log_level()->set_enabled(level::error);
- L_(debug) << "this will not be written anywhere";
- L_(info) << "this won't be written anywhere either";
- L_(error) << "second error " << i++;
-
- g_log_level()->set_enabled(level::info);
- L_(info) << "good to be back ;) " << i++;
- L_(error) << "third error " << i++;
+ // read this .cpp file - every other line is logged (odd lines)
+ std::ifstream in("test.cpp");
+ bool enabled = true;
+ std::string line;
+ while ( std::getline(in, line) ) {
+ g_log_filter()->set_enabled(enabled);
+ L_ << "line odd " << line;
+ enabled = !enabled;
+ }
 }
 
+void append_to_file() {
+ // second, append to the same file
 
+ // ... first, remove old destination
+ g_l()->writer().del_destination( destination::file("out.txt"));
+ // ... now, re-add the same file - but now, for appending
+ g_l()->writer().add_destination( destination::file("out.txt",
+ destination::file_settings().initial_overwrite(false).do_append(true) ));
+
+ // read this .cpp file - every other line is logged (even lines now)
+ std::ifstream in("test.cpp");
+ bool enabled = false;
+ std::string line;
+ while ( std::getline(in, line) ) {
+ g_log_filter()->set_enabled(enabled);
+ L_ << "line even " << line;
+ enabled = !enabled;
+ }
+
+ g_l()->writer().del_destination( destination::file("out.txt"));
+ g_log_filter()->set_enabled(true);
+ L_ << "should not be written to file, only to console";
+}
 
-int main() {
- test_mul_levels_one_logger();
+// now, see that what we've written was ok
+void test_write_ok() {
+ std::ifstream test("test.cpp");
+ std::ifstream out("out.txt");
+ std::string test_line, out_line;
+ // first, odd lines
+ while ( std::getline(test, test_line) ) {
+ std::getline(out, out_line);
+ BOOST_CHECK( "line odd " + test_line == out_line );
+ std::getline(test, test_line); // ignore even line
+ }
+
+ test.close();
+ std::ifstream test2("test.cpp");
+
+ // second, even lines
+ while ( std::getline(test2, test_line) && std::getline(test2, test_line) ) {
+ std::getline(out, out_line);
+ BOOST_CHECK( "line even " + test_line == out_line );
+ }
+
+ // out.txt - should have no more lines
+ std::getline(out, out_line);
+ BOOST_CHECK( out_line.empty() );
 }
 
 
-// End of file
+int test_main(int, char *[]) {
+ write_to_clean_file();
+ append_to_file();
+ test_write_ok();
+ return 0;
+}
 

Modified: sandbox/logging/lib/logging/tests/Jamfile.v2
==============================================================================
--- sandbox/logging/lib/logging/tests/Jamfile.v2 (original)
+++ sandbox/logging/lib/logging/tests/Jamfile.v2 2008-01-30 22:24:48 EST (Wed, 30 Jan 2008)
@@ -5,20 +5,34 @@
 # accompanying file LICENSE_1_0.txt or copy at
 # http://www.boost.org/LICENSE_1_0.txt)
 
+
+import modules ;
+
+# Look for BOOST_ROOT_DIR environment variable
+local BOOST_ROOT = [ modules.peek : BOOST_ROOT_DIR ] ;
+
+use-project /boost : $(BOOST_ROOT) ;
+
 project
     : requirements
- <include>../../../..
+ <include>../../..
       <include>$(BOOST_ROOT)
- <library>/boost/thread//boost_thread
+ <library>/boost//thread
     ;
 
 # bring in rules for testing
 import testing ;
 
 test-suite log_tests :
+ [ run test_file/test.cpp ]
     [ run test_log_output/test_log_output.cpp ]
+ [ run test_named/test.cpp : : : : test2 ]
+ [ run test_named_spacer/test.cpp : : : : test3 ]
+ [ run test_rolling_file/test.cpp : : : : test4 ]
     [ run test_simple_tss/test_simple_tss.cpp ]
+ [ run test_tags/test_tags.cpp ]
     [ run test_ts_resouce_with_cache/test_ts_resource.cpp ]
+ [ run test_tss/test_tss.cpp test_tss/test_tss_objects.cpp test_tss/test_tss_on_end_delete.cpp : : : : test5 ]
 # [ run ]
 # [ run ]
     ;

Modified: sandbox/logging/lib/logging/tests/all_tests.sln
==============================================================================
--- sandbox/logging/lib/logging/tests/all_tests.sln (original)
+++ sandbox/logging/lib/logging/tests/all_tests.sln 2008-01-30 22:24:48 EST (Wed, 30 Jan 2008)
@@ -1,8 +1,6 @@
 ï»¿
 Microsoft Visual Studio Solution File, Format Version 9.00
 # Visual Studio 2005
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_after_destroyed", "test_after_destroyed\test_after_destroyed.vcproj", "{C5897099-5FA2-4E12-AFFC-2015364347FA}"
-EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_file", "test_file\test_file.vcproj", "{A098514E-1836-49C4-8309-03291403A994}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_named", "test_named\test_named.vcproj", "{279DABB5-79C6-4188-BB0D-330C5D6C2EFA}"
@@ -25,10 +23,6 @@
                 Release|Win32 = Release|Win32
         EndGlobalSection
         GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {C5897099-5FA2-4E12-AFFC-2015364347FA}.Debug|Win32.ActiveCfg = Debug|Win32
- {C5897099-5FA2-4E12-AFFC-2015364347FA}.Debug|Win32.Build.0 = Debug|Win32
- {C5897099-5FA2-4E12-AFFC-2015364347FA}.Release|Win32.ActiveCfg = Release|Win32
- {C5897099-5FA2-4E12-AFFC-2015364347FA}.Release|Win32.Build.0 = Release|Win32
                 {A098514E-1836-49C4-8309-03291403A994}.Debug|Win32.ActiveCfg = Debug|Win32
                 {A098514E-1836-49C4-8309-03291403A994}.Debug|Win32.Build.0 = Debug|Win32
                 {A098514E-1836-49C4-8309-03291403A994}.Release|Win32.ActiveCfg = Release|Win32

Modified: sandbox/logging/lib/logging/tests/test_file/test.cpp
==============================================================================
--- sandbox/logging/lib/logging/tests/test_file/test.cpp (original)
+++ sandbox/logging/lib/logging/tests/test_file/test.cpp 2008-01-30 22:24:48 EST (Wed, 30 Jan 2008)
@@ -2,6 +2,7 @@
 /*
     Tests formatter::file
 */
+#include <boost/test/minimal.hpp>
 
 #include <boost/logging/format.hpp>
 #include <string>
@@ -66,7 +67,7 @@
     // first, odd lines
     while ( std::getline(test, test_line) ) {
         std::getline(out, out_line);
- BOOST_ASSERT( "line odd " + test_line == out_line );
+ BOOST_CHECK( "line odd " + test_line == out_line );
         std::getline(test, test_line); // ignore even line
     }
 
@@ -76,18 +77,19 @@
     // second, even lines
     while ( std::getline(test2, test_line) && std::getline(test2, test_line) ) {
         std::getline(out, out_line);
- BOOST_ASSERT( "line even " + test_line == out_line );
+ BOOST_CHECK( "line even " + test_line == out_line );
     }
 
     // out.txt - should have no more lines
     std::getline(out, out_line);
- BOOST_ASSERT( out_line.empty() );
+ BOOST_CHECK( out_line.empty() );
 }
 
 
-int main() {
+int test_main(int, char *[]) {
     write_to_clean_file();
     append_to_file();
     test_write_ok();
+ return 0;
 }
 

Modified: sandbox/logging/lib/logging/tests/test_log_output/test_log_output.cpp
==============================================================================
--- sandbox/logging/lib/logging/tests/test_log_output/test_log_output.cpp (original)
+++ sandbox/logging/lib/logging/tests/test_log_output/test_log_output.cpp 2008-01-30 22:24:48 EST (Wed, 30 Jan 2008)
@@ -1,3 +1,4 @@
+
 // test_log_output.cpp
 //
 // Tests that logging messages are output correctly
@@ -15,11 +16,10 @@
 // See http://www.boost.org for updates, documentation, and revision history.
 // See http://www.torjo.com/log2/ for more details
 
-
+#include <boost/test/minimal.hpp>
 
 #define BOOST_LOG_COMPILE_FAST_OFF
 #include <boost/logging/format_fwd.hpp>
-#include <boost/logging/tags.hpp>
 
 using namespace boost::logging;
 
@@ -28,7 +28,6 @@
 typedef logger_format_write< > log_type;
 
 #include <boost/logging/format.hpp>
-#include <boost/logging/writer/ts_write.hpp>
 
 
 // Step 4: declare which filters and loggers you'll use (usually in a header file)
@@ -42,10 +41,11 @@
 void test_log_output() {
     std::ostringstream out_str;
     destination::stream dest_out(out_str);
- g_l()->writer().add_formatter( formatter::idx() );
+ g_l()->writer().add_formatter( formatter::idx(), "[%] " );
     g_l()->writer().add_formatter( formatter::append_newline() );
     g_l()->writer().add_destination( destination::cout() );
     g_l()->writer().add_destination( dest_out );
+ g_l()->mark_as_initialized();
 
     // Step 8: use it...
     int i = 1;
@@ -57,9 +57,13 @@
     L_ << "only to console " << i++;
 
     std::string logged_msg = out_str.str();
- BOOST_ASSERT( logged_msg == "[1] this is so cool 1\n[2] this is so cool again 2\n");
+ BOOST_CHECK( logged_msg == "[1] this is so cool 1\n[2] this is so cool again 2\n");
 }
 
 
 
-int main() { test_log_output() ; }
+int test_main(int, char *[]) {
+ test_log_output() ;
+ return 0;
+}
+

Modified: sandbox/logging/lib/logging/tests/test_named/test.cpp
==============================================================================
--- sandbox/logging/lib/logging/tests/test_named/test.cpp (original)
+++ sandbox/logging/lib/logging/tests/test_named/test.cpp 2008-01-30 22:24:48 EST (Wed, 30 Jan 2008)
@@ -3,6 +3,8 @@
     - I have 3 stream destinations. I do simple logging (no formatting), and see that the message gets written to the destinations I specified
 */
 
+#include <boost/test/minimal.hpp>
+
 #include <boost/logging/format.hpp>
 #include <boost/logging/format/destination/named.hpp>
 
@@ -21,7 +23,7 @@
 std::stringstream g_second;
 std::stringstream g_third;
 
-destination::named_t<lock_resource_finder::single_thread> g_n;
+destination::named_t<boost::logging::default_, lock_resource_finder::single_thread> g_n;
 
 // we're constantly writing hello world
 std::string g_msg = "hello world";
@@ -34,42 +36,42 @@
 
     g_l()->writer().add_formatter( formatter::append_newline() );
     g_l()->writer().add_destination( destination::cout() );
- g_l()->turn_cache_off();
+ g_l()->mark_as_initialized();
 }
 
 void test_use_all() {
     g_n.string("first second third");
     L_ << g_msg;
- BOOST_ASSERT( g_first.str() == "hello world\n");
- BOOST_ASSERT( g_second.str() == "hello world\n");
- BOOST_ASSERT( g_third.str() == "hello world\n");
+ BOOST_CHECK( g_first.str() == "hello world\n");
+ BOOST_CHECK( g_second.str() == "hello world\n");
+ BOOST_CHECK( g_third.str() == "hello world\n");
     g_first.str("");
     g_second.str("");
     g_third.str("");
 
     g_n.string("first +second third");
     L_ << g_msg;
- BOOST_ASSERT( g_first.str() == "hello world\n");
- BOOST_ASSERT( g_second.str() == "hello world\n");
- BOOST_ASSERT( g_third.str() == "hello world\n");
+ BOOST_CHECK( g_first.str() == "hello world\n");
+ BOOST_CHECK( g_second.str() == "hello world\n");
+ BOOST_CHECK( g_third.str() == "hello world\n");
     g_first.str("");
     g_second.str("");
     g_third.str("");
 
     g_n.string("+first second +third");
     L_ << g_msg;
- BOOST_ASSERT( g_first.str() == "hello world\n");
- BOOST_ASSERT( g_second.str() == "hello world\n");
- BOOST_ASSERT( g_third.str() == "hello world\n");
+ BOOST_CHECK( g_first.str() == "hello world\n");
+ BOOST_CHECK( g_second.str() == "hello world\n");
+ BOOST_CHECK( g_third.str() == "hello world\n");
     g_first.str("");
     g_second.str("");
     g_third.str("");
 
     g_n.string("+first +second +third");
     L_ << g_msg;
- BOOST_ASSERT( g_first.str() == "hello world\n");
- BOOST_ASSERT( g_second.str() == "hello world\n");
- BOOST_ASSERT( g_third.str() == "hello world\n");
+ BOOST_CHECK( g_first.str() == "hello world\n");
+ BOOST_CHECK( g_second.str() == "hello world\n");
+ BOOST_CHECK( g_third.str() == "hello world\n");
     g_first.str("");
     g_second.str("");
     g_third.str("");
@@ -78,54 +80,54 @@
 void test_use_2() {
     g_n.string("first second -third");
     L_ << g_msg;
- BOOST_ASSERT( g_first.str() == "hello world\n");
- BOOST_ASSERT( g_second.str() == "hello world\n");
- BOOST_ASSERT( g_third.str() == "");
+ BOOST_CHECK( g_first.str() == "hello world\n");
+ BOOST_CHECK( g_second.str() == "hello world\n");
+ BOOST_CHECK( g_third.str() == "");
     g_first.str("");
     g_second.str("");
     g_third.str("");
 
     g_n.string("first second ");
     L_ << g_msg;
- BOOST_ASSERT( g_first.str() == "hello world\n");
- BOOST_ASSERT( g_second.str() == "hello world\n");
- BOOST_ASSERT( g_third.str() == "");
+ BOOST_CHECK( g_first.str() == "hello world\n");
+ BOOST_CHECK( g_second.str() == "hello world\n");
+ BOOST_CHECK( g_third.str() == "");
     g_first.str("");
     g_second.str("");
     g_third.str("");
 
     g_n.string("first third -second");
     L_ << g_msg;
- BOOST_ASSERT( g_first.str() == "hello world\n");
- BOOST_ASSERT( g_second.str() == "");
- BOOST_ASSERT( g_third.str() == "hello world\n");
+ BOOST_CHECK( g_first.str() == "hello world\n");
+ BOOST_CHECK( g_second.str() == "");
+ BOOST_CHECK( g_third.str() == "hello world\n");
     g_first.str("");
     g_second.str("");
     g_third.str("");
 
     g_n.string("first -third +second");
     L_ << g_msg;
- BOOST_ASSERT( g_first.str() == "hello world\n");
- BOOST_ASSERT( g_second.str() == "hello world\n");
- BOOST_ASSERT( g_third.str() == "");
+ BOOST_CHECK( g_first.str() == "hello world\n");
+ BOOST_CHECK( g_second.str() == "hello world\n");
+ BOOST_CHECK( g_third.str() == "");
     g_first.str("");
     g_second.str("");
     g_third.str("");
 
     g_n.string("+third +second");
     L_ << g_msg;
- BOOST_ASSERT( g_first.str() == "");
- BOOST_ASSERT( g_second.str() == "hello world\n");
- BOOST_ASSERT( g_third.str() == "hello world\n");
+ BOOST_CHECK( g_first.str() == "");
+ BOOST_CHECK( g_second.str() == "hello world\n");
+ BOOST_CHECK( g_third.str() == "hello world\n");
     g_first.str("");
     g_second.str("");
     g_third.str("");
 
     g_n.string(" second third ");
     L_ << g_msg;
- BOOST_ASSERT( g_first.str() == "");
- BOOST_ASSERT( g_second.str() == "hello world\n");
- BOOST_ASSERT( g_third.str() == "hello world\n");
+ BOOST_CHECK( g_first.str() == "");
+ BOOST_CHECK( g_second.str() == "hello world\n");
+ BOOST_CHECK( g_third.str() == "hello world\n");
     g_first.str("");
     g_second.str("");
     g_third.str("");
@@ -135,63 +137,63 @@
 void test_use_1() {
     g_n.string(" second -third -first ");
     L_ << g_msg;
- BOOST_ASSERT( g_first.str() == "");
- BOOST_ASSERT( g_second.str() == "hello world\n");
- BOOST_ASSERT( g_third.str() == "");
+ BOOST_CHECK( g_first.str() == "");
+ BOOST_CHECK( g_second.str() == "hello world\n");
+ BOOST_CHECK( g_third.str() == "");
     g_first.str("");
     g_second.str("");
     g_third.str("");
 
     g_n.string(" second -third ");
     L_ << g_msg;
- BOOST_ASSERT( g_first.str() == "");
- BOOST_ASSERT( g_second.str() == "hello world\n");
- BOOST_ASSERT( g_third.str() == "");
+ BOOST_CHECK( g_first.str() == "");
+ BOOST_CHECK( g_second.str() == "hello world\n");
+ BOOST_CHECK( g_third.str() == "");
     g_first.str("");
     g_second.str("");
     g_third.str("");
 
     g_n.string(" second ");
     L_ << g_msg;
- BOOST_ASSERT( g_first.str() == "");
- BOOST_ASSERT( g_second.str() == "hello world\n");
- BOOST_ASSERT( g_third.str() == "");
+ BOOST_CHECK( g_first.str() == "");
+ BOOST_CHECK( g_second.str() == "hello world\n");
+ BOOST_CHECK( g_third.str() == "");
     g_first.str("");
     g_second.str("");
     g_third.str("");
 
     g_n.string("second");
     L_ << g_msg;
- BOOST_ASSERT( g_first.str() == "");
- BOOST_ASSERT( g_second.str() == "hello world\n");
- BOOST_ASSERT( g_third.str() == "");
+ BOOST_CHECK( g_first.str() == "");
+ BOOST_CHECK( g_second.str() == "hello world\n");
+ BOOST_CHECK( g_third.str() == "");
     g_first.str("");
     g_second.str("");
     g_third.str("");
 
     g_n.string(" -second third -first ");
     L_ << g_msg;
- BOOST_ASSERT( g_first.str() == "");
- BOOST_ASSERT( g_second.str() == "");
- BOOST_ASSERT( g_third.str() == "hello world\n");
+ BOOST_CHECK( g_first.str() == "");
+ BOOST_CHECK( g_second.str() == "");
+ BOOST_CHECK( g_third.str() == "hello world\n");
     g_first.str("");
     g_second.str("");
     g_third.str("");
 
     g_n.string(" third -first ");
     L_ << g_msg;
- BOOST_ASSERT( g_first.str() == "");
- BOOST_ASSERT( g_second.str() == "");
- BOOST_ASSERT( g_third.str() == "hello world\n");
+ BOOST_CHECK( g_first.str() == "");
+ BOOST_CHECK( g_second.str() == "");
+ BOOST_CHECK( g_third.str() == "hello world\n");
     g_first.str("");
     g_second.str("");
     g_third.str("");
 
     g_n.string(" third");
     L_ << g_msg;
- BOOST_ASSERT( g_first.str() == "");
- BOOST_ASSERT( g_second.str() == "");
- BOOST_ASSERT( g_third.str() == "hello world\n");
+ BOOST_CHECK( g_first.str() == "");
+ BOOST_CHECK( g_second.str() == "");
+ BOOST_CHECK( g_third.str() == "hello world\n");
     g_first.str("");
     g_second.str("");
     g_third.str("");
@@ -200,45 +202,46 @@
 void test_use_0() {
     g_n.string(" -second -third -first ");
     L_ << g_msg;
- BOOST_ASSERT( g_first.str() == "");
- BOOST_ASSERT( g_second.str() == "");
- BOOST_ASSERT( g_third.str() == "");
+ BOOST_CHECK( g_first.str() == "");
+ BOOST_CHECK( g_second.str() == "");
+ BOOST_CHECK( g_third.str() == "");
     g_first.str("");
     g_second.str("");
     g_third.str("");
 
     g_n.string(" -second -third ");
     L_ << g_msg;
- BOOST_ASSERT( g_first.str() == "");
- BOOST_ASSERT( g_second.str() == "");
- BOOST_ASSERT( g_third.str() == "");
+ BOOST_CHECK( g_first.str() == "");
+ BOOST_CHECK( g_second.str() == "");
+ BOOST_CHECK( g_third.str() == "");
     g_first.str("");
     g_second.str("");
     g_third.str("");
 
     g_n.string(" -second ");
     L_ << g_msg;
- BOOST_ASSERT( g_first.str() == "");
- BOOST_ASSERT( g_second.str() == "");
- BOOST_ASSERT( g_third.str() == "");
+ BOOST_CHECK( g_first.str() == "");
+ BOOST_CHECK( g_second.str() == "");
+ BOOST_CHECK( g_third.str() == "");
     g_first.str("");
     g_second.str("");
     g_third.str("");
 
     g_n.string(" ");
     L_ << g_msg;
- BOOST_ASSERT( g_first.str() == "");
- BOOST_ASSERT( g_second.str() == "");
- BOOST_ASSERT( g_third.str() == "");
+ BOOST_CHECK( g_first.str() == "");
+ BOOST_CHECK( g_second.str() == "");
+ BOOST_CHECK( g_third.str() == "");
     g_first.str("");
     g_second.str("");
     g_third.str("");
 }
 
-int main() {
+int test_main(int, char *[]) {
     init_logs();
     test_use_all();
     test_use_2();
     test_use_1();
     test_use_0();
+ return 0;
 }

Modified: sandbox/logging/lib/logging/tests/test_named_spacer/test.cpp
==============================================================================
--- sandbox/logging/lib/logging/tests/test_named_spacer/test.cpp (original)
+++ sandbox/logging/lib/logging/tests/test_named_spacer/test.cpp 2008-01-30 22:24:48 EST (Wed, 30 Jan 2008)
@@ -2,6 +2,8 @@
     Tests named_spacer
 */
 
+#include <boost/test/minimal.hpp>
+
 #include <boost/logging/format.hpp>
 #include <boost/logging/format/formatter/named_spacer.hpp>
 
@@ -34,7 +36,7 @@
 };
 
 // our named spacer - the one we're testing
-formatter::named_spacer_t<boost::logging::default_, lock_resource_finder::single_thread > g_ns;
+formatter::named_spacer_t<boost::logging::default_, boost::logging::default_, lock_resource_finder::single_thread > g_ns;
 
 // we're constantly writing hello world
 std::string g_msg = "hello world";
@@ -56,34 +58,34 @@
 void test_with_all_formatters() {
     g_ns.string("[%idx%] {%tid%} (%abc%)-");
     L_ << g_msg;
- BOOST_ASSERT( g_out.str() == "[1] {" + g_thread_id + "} (a)-hello world\n");
+ BOOST_CHECK( g_out.str() == "[1] {" + g_thread_id + "} (a)-hello world\n");
     g_out.str("");
 
     g_ns.string("[%idx%] (%abc%)-{%tid%}/");
     L_ << g_msg;
- BOOST_ASSERT( g_out.str() == "[2] (b)-{" + g_thread_id + "}/hello world\n");
+ BOOST_CHECK( g_out.str() == "[2] (b)-{" + g_thread_id + "}/hello world\n");
     g_out.str("");
 
     g_ns.string("[%idx%]/[%abc%]/[%tid%]/ ");
     L_ << g_msg;
- BOOST_ASSERT( g_out.str() == "[3]/[c]/[" + g_thread_id + "]/ hello world\n");
+ BOOST_CHECK( g_out.str() == "[3]/[c]/[" + g_thread_id + "]/ hello world\n");
     g_out.str("");
 }
 
 void test_with_2_formatters() {
     g_ns.string("[%idx%] (%abc%)-");
     L_ << g_msg;
- BOOST_ASSERT( g_out.str() == "[4] (d)-hello world\n");
+ BOOST_CHECK( g_out.str() == "[4] (d)-hello world\n");
     g_out.str("");
 
     g_ns.string("[%tid%] (%idx%)-");
     L_ << g_msg;
- BOOST_ASSERT( g_out.str() == "[" + g_thread_id + "] (5)-hello world\n");
+ BOOST_CHECK( g_out.str() == "[" + g_thread_id + "] (5)-hello world\n");
     g_out.str("");
 
     g_ns.string("[%abc%] [%tid%]: ");
     L_ << g_msg;
- BOOST_ASSERT( g_out.str() == "[e] [" + g_thread_id + "]: hello world\n");
+ BOOST_CHECK( g_out.str() == "[e] [" + g_thread_id + "]: hello world\n");
     g_out.str("");
 
 }
@@ -91,17 +93,17 @@
 void test_with_1_formatter() {
     g_ns.string("[%idx%]/ ");
     L_ << g_msg;
- BOOST_ASSERT( g_out.str() == "[6]/ hello world\n");
+ BOOST_CHECK( g_out.str() == "[6]/ hello world\n");
     g_out.str("");
 
     g_ns.string("{%tid%}- ");
     L_ << g_msg;
- BOOST_ASSERT( g_out.str() == "{" + g_thread_id + "}- hello world\n");
+ BOOST_CHECK( g_out.str() == "{" + g_thread_id + "}- hello world\n");
     g_out.str("");
 
     g_ns.string("%abc%/ ");
     L_ << g_msg;
- BOOST_ASSERT( g_out.str() == "f/ hello world\n");
+ BOOST_CHECK( g_out.str() == "f/ hello world\n");
     g_out.str("");
 
 }
@@ -110,23 +112,23 @@
 void test_with_no_formatters() {
     g_ns.string("/ ");
     L_ << g_msg;
- BOOST_ASSERT( g_out.str() == "/ hello world\n");
+ BOOST_CHECK( g_out.str() == "/ hello world\n");
     g_out.str("");
 
     g_ns.string("abc ");
     L_ << g_msg;
- BOOST_ASSERT( g_out.str() == "abc hello world\n");
+ BOOST_CHECK( g_out.str() == "abc hello world\n");
     g_out.str("");
 
     g_ns.string("");
     L_ << g_msg;
- BOOST_ASSERT( g_out.str() == "hello world\n");
+ BOOST_CHECK( g_out.str() == "hello world\n");
     g_out.str("");
 
 }
 
 
-int main() {
+int test_main(int, char *[]) {
     init_logs();
     std::ostringstream out;
     out << detail::get_thread_id();
@@ -136,4 +138,5 @@
     test_with_2_formatters();
     test_with_1_formatter();
     test_with_no_formatters();
+ return 0;
 }

Modified: sandbox/logging/lib/logging/tests/test_rolling_file/test.cpp
==============================================================================
--- sandbox/logging/lib/logging/tests/test_rolling_file/test.cpp (original)
+++ sandbox/logging/lib/logging/tests/test_rolling_file/test.cpp 2008-01-30 22:24:48 EST (Wed, 30 Jan 2008)
@@ -6,6 +6,8 @@
       thus, we should start writing from the first file
 */
 
+#include <boost/test/minimal.hpp>
+
 #include <boost/logging/format.hpp>
 #include <boost/logging/writer/ts_write.hpp>
 #include <boost/logging/format/destination/rolling_file.hpp>
@@ -15,6 +17,8 @@
 #include <boost/filesystem/convenience.hpp>
 namespace fs = boost::filesystem;
 
+const char INPUT_FILE_NAME []= "test.cpp";
+
 using namespace boost::logging;
 
 typedef logger_format_write< > log_type;
@@ -56,7 +60,7 @@
 
 void write_to_clean_rolling_file() {
     // read this .cpp file - every other line is logged (odd lines)
- std::ifstream in("test.cpp");
+ std::ifstream in(INPUT_FILE_NAME);
     bool enabled = true;
     std::string line;
     while ( std::getline(in, line) ) {
@@ -80,7 +84,7 @@
             ));
 
     // read this .cpp file - every other line is logged (even lines now)
- std::ifstream in("test.cpp");
+ std::ifstream in(INPUT_FILE_NAME);
     bool enabled = false;
     std::string line;
     while ( std::getline(in, line) ) {
@@ -109,7 +113,7 @@
         out << cur_file.rdbuf();
         std::string cur_file_contents = out.str();
         std::string & cur_block = g_blocks[idx];
- BOOST_ASSERT( cur_file_contents == cur_block);
+ BOOST_CHECK( cur_file_contents == cur_block);
     }
 }
 
@@ -144,7 +148,7 @@
         out << cur_file.rdbuf();
         std::string cur_file_contents = out.str();
         std::string & cur_block = g_blocks[idx];
- BOOST_ASSERT( cur_file_contents == cur_block);
+ BOOST_CHECK( cur_file_contents == cur_block);
     }
 }
 
@@ -180,7 +184,7 @@
 
     // read this .cpp file - every Xth line is written
     const int LINE_PERIOD = 6;
- std::ifstream in("test.cpp");
+ std::ifstream in(INPUT_FILE_NAME);
     int line_idx = 0;
     std::string line;
     while ( std::getline(in, line) ) {
@@ -214,8 +218,7 @@
     test_contents();
 }
 
-
-int main() {
+int test_main(int, char *[]) {
     fs::path::default_name_check( fs::no_check);
 
     init_logs();
@@ -224,4 +227,5 @@
     test_contents_after_write_to_existing_rolling_file();
     write_to_too_full_rolling_file();
     test_contents_after_writing_to_full_rolling_file();
+ return 0;
 }

Modified: sandbox/logging/lib/logging/tests/test_simple_tss/test_simple_tss.cpp
==============================================================================
--- sandbox/logging/lib/logging/tests/test_simple_tss/test_simple_tss.cpp (original)
+++ sandbox/logging/lib/logging/tests/test_simple_tss/test_simple_tss.cpp 2008-01-30 22:24:48 EST (Wed, 30 Jan 2008)
@@ -21,6 +21,7 @@
     the same object is returned.
 
 */
+#include <boost/test/minimal.hpp>
 
 #define BOOST_LOG_TSS_USE_INTERNAL
 // this includes tss_value class
@@ -51,7 +52,7 @@
     void decrement() {
         scoped_lock lk(m_cs);
         --m_count;
- BOOST_ASSERT(m_count >= 0);
+ BOOST_CHECK(m_count >= 0);
     }
 
     int count() const {
@@ -112,14 +113,14 @@
         dummy * cur_dummy = &*g_dummy;
         if ( cur_dummy != local_dummy) {
             std::cout << "thread " << thread_idx << ": assertion failed - dummy - at try " << try_idx;
- BOOST_ASSERT( false);
+ BOOST_CHECK( false);
         }
 
         local_str += thread_idx_str;
         copy_str += thread_idx_str;
         if ( copy_str != g_dummy->str) {
             std::cout << "thread " << thread_idx << ": assertion failed - local_str - at try " << try_idx;
- BOOST_ASSERT( false);
+ BOOST_CHECK( false);
         }
     }
 
@@ -130,14 +131,15 @@
 
 int g_total_thread_count = 20;
 
-int g_run_test_secs = 20;
+int g_run_test_secs = 10;
 
-int main()
-{
+int test_main(int, char *[]) {
     for ( int i = 0; i < g_total_thread_count ; ++i)
         thread t( &use_dummy_thread);
 
+ std::cout << "running test for " << g_run_test_secs << " secs " << std::endl;
     do_sleep( g_run_test_secs * 1000 );
+ std::cout << "done " << std::endl;
         return 0;
 }
 

Modified: sandbox/logging/lib/logging/tests/test_tags/test_tags.cpp
==============================================================================
--- sandbox/logging/lib/logging/tests/test_tags/test_tags.cpp (original)
+++ sandbox/logging/lib/logging/tests/test_tags/test_tags.cpp 2008-01-30 22:24:48 EST (Wed, 30 Jan 2008)
@@ -4,9 +4,9 @@
     - tests dumping the module and the thread_id
     
 */
+#include <boost/test/minimal.hpp>
 
 #include <boost/logging/format_fwd.hpp>
-#include <boost/logging/tags.hpp>
 
 // Optimize : use tags
 namespace bl = boost::logging;
@@ -58,13 +58,13 @@
 void test_fileline_function() {
     init_logs_fileline_function();
     LOG_FILE_FUNC_ << g_msg;
- BOOST_ASSERT( test_str_contains( g_out.str(), "test_tags.cpp"));
- BOOST_ASSERT( test_str_contains( g_out.str(), "test_fileline_function"));
+ BOOST_CHECK( test_str_contains( g_out.str(), "test_tags.cpp"));
+ BOOST_CHECK( test_str_contains( g_out.str(), "test_fileline_function"));
     g_out.str("");
 
     LOG_FILE_FUNC_ << g_msg;
- BOOST_ASSERT( test_str_contains( g_out.str(), "test_tags.cpp"));
- BOOST_ASSERT( test_str_contains( g_out.str(), "test_fileline_function"));
+ BOOST_CHECK( test_str_contains( g_out.str(), "test_tags.cpp"));
+ BOOST_CHECK( test_str_contains( g_out.str(), "test_fileline_function"));
     g_out.str("");
 }
 
@@ -75,8 +75,8 @@
 
     // after deleting the file/line and function formatters, they shouldn't be called
     LOG_FILE_FUNC_ << g_msg;
- BOOST_ASSERT( !test_str_contains( g_out.str(), "test_tags.cpp"));
- BOOST_ASSERT( !test_str_contains( g_out.str(), "test_fileline_function"));
+ BOOST_CHECK( !test_str_contains( g_out.str(), "test_tags.cpp"));
+ BOOST_CHECK( !test_str_contains( g_out.str(), "test_fileline_function"));
     g_out.str("");
 
     g_l()->writer().add_formatter( formatter::tag::module(), "[%] " );
@@ -91,12 +91,13 @@
     std::string thread_id = out.str();
 
     LOG_MODULE_("module_a") << g_msg;
- BOOST_ASSERT( test_str_contains( g_out.str(), "[module_a]"));
- BOOST_ASSERT( test_str_contains( g_out.str(), "[" + thread_id + "]"));
+ BOOST_CHECK( test_str_contains( g_out.str(), "[module_a]"));
+ BOOST_CHECK( test_str_contains( g_out.str(), "[" + thread_id + "]"));
 }
 
-int main() {
+int test_main(int, char *[]) {
     test_fileline_function();
     test_module_and_thread_id();
+ return 0;
 }
 

Modified: sandbox/logging/lib/logging/tests/test_ts_resouce_with_cache/test_ts_resource.cpp
==============================================================================
--- sandbox/logging/lib/logging/tests/test_ts_resouce_with_cache/test_ts_resource.cpp (original)
+++ sandbox/logging/lib/logging/tests/test_ts_resouce_with_cache/test_ts_resource.cpp 2008-01-30 22:24:48 EST (Wed, 30 Jan 2008)
@@ -20,6 +20,7 @@
 */
 
 #define BOOST_LOG_TEST_TSS
+#include <boost/test/minimal.hpp>
 
 #define BOOST_LOG_TSS_USE_INTERNAL
 // this includes tss_value class
@@ -34,6 +35,8 @@
 #include <vector>
 #include <sstream>
 #include <iostream>
+#include <fstream>
+#include <stdexcept>
 
 #ifdef BOOST_WINDOWS
 #include <windows.h>
@@ -52,8 +55,9 @@
         std::string msg = out.str();
         if ( msg.empty() )
             return;
- std::cout << msg;
- std::cout.flush();
+
+ std::ofstream file_out("ts_resource.txt", std::ios_base::out | std::ios_base::app);
+ file_out << msg;
 #ifdef BOOST_WINDOWS
         ::OutputDebugStringA( msg.c_str() );
 #endif
@@ -161,7 +165,10 @@
         dump_array(cur_val, "resource");
         dump_array(snap, "snapshot");
         dump_array(prev_snap, "prev snapshot");
- BOOST_ASSERT( false);
+ // we throw, so that the program ends (otherwise we could
+ // get a lot of failed assertions,all dumped at console from different threads)
+ throw std::runtime_error("assertion failed");
+// BOOST_CHECK( false);
     }
 }
 
@@ -260,8 +267,8 @@
 
 int g_run_period_secs = 200;
 
-int main()
-{
+int test_main(int, char *[]) {
+ std::cout << "running test for " << g_run_period_secs << " secs" << std::endl;
     xtime_get( &g_start, TIME_UTC);
 
     for ( int i = 0; i < g_update_thread_count; ++i)

Modified: sandbox/logging/lib/logging/tests/test_tss/test_tss.cpp
==============================================================================
--- sandbox/logging/lib/logging/tests/test_tss/test_tss.cpp (original)
+++ sandbox/logging/lib/logging/tests/test_tss/test_tss.cpp 2008-01-30 22:24:48 EST (Wed, 30 Jan 2008)
@@ -64,8 +64,7 @@
 void do_sleep(int ms) ;
 void process_file() ;
 
-int main(int argc, char* argv[])
-{
+int test_main(int argc, char *argv[]) {
     if ( argc > 1) {
         std::istringstream in(argv[1]);
         in >> g_thread_count;

Modified: sandbox/logging/lib/logging/tests/test_tss/test_tss.vcproj
==============================================================================
--- sandbox/logging/lib/logging/tests/test_tss/test_tss.vcproj (original)
+++ sandbox/logging/lib/logging/tests/test_tss/test_tss.vcproj 2008-01-30 22:24:48 EST (Wed, 30 Jan 2008)
@@ -62,7 +62,7 @@
                         <Tool
                                 Name="VCLinkerTool"
                                 LinkIncremental="2"
- AdditionalLibraryDirectories="D:\boosts\boost_1_33_1\bin\boost\libs\thread\build\libboost_thread.lib\vc-8_0\debug\threading-multi"
+ AdditionalLibraryDirectories="D:\boosts\boost_1_34_1\bin.v2\libs\filesystem\build\msvc-8.0\debug\link-static\threading-multi;D:\boosts\boost_1_34_1\bin.v2\libs\thread\build\msvc-8.0\debug\link-static\threading-multi\"
                                 GenerateDebugInformation="true"
                                 SubSystem="1"
                                 TargetMachine="1"

Modified: sandbox/logging/lib/logging/tests/test_tss/test_tss_objects.cpp
==============================================================================
--- sandbox/logging/lib/logging/tests/test_tss/test_tss_objects.cpp (original)
+++ sandbox/logging/lib/logging/tests/test_tss/test_tss_objects.cpp 2008-01-30 22:24:48 EST (Wed, 30 Jan 2008)
@@ -13,6 +13,7 @@
 
 // so that we can catch the end of deleting all objects
 #define BOOST_LOG_TEST_TSS
+#include <boost/test/minimal.hpp>
 
 #define BOOST_LOG_TSS_USE_INTERNAL
 // this includes tss_value class
@@ -125,7 +126,7 @@
         std::string local_word = local_file.read_word();
         // it should behave just like a "local" variable
         if ( word != local_word)
- BOOST_ASSERT( false);
+ BOOST_CHECK( false);
         str->add_word(word);
         if ( word.empty() )
             break;

Modified: sandbox/logging/lib/logging/tests/test_tss/test_tss_on_end_delete.cpp
==============================================================================
--- sandbox/logging/lib/logging/tests/test_tss/test_tss_on_end_delete.cpp (original)
+++ sandbox/logging/lib/logging/tests/test_tss/test_tss_on_end_delete.cpp 2008-01-30 22:24:48 EST (Wed, 30 Jan 2008)
@@ -40,8 +40,7 @@
 namespace boost { namespace logging { namespace detail {
 void on_end_delete_objects() {
     if( g_object_count->count() != 0) {
- std::cout << "end delete objects, remaining = " << g_object_count->count() << std::endl;
- BOOST_ASSERT(false);
+ std::cout << "TEST FAILED : end delete objects, remaining = " << g_object_count->count() << std::endl;
     }
 }
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk