diff --git a/repos/base/include/log_session/log_session.h b/repos/base/include/log_session/log_session.h index 94cd78602..3551e45a9 100644 --- a/repos/base/include/log_session/log_session.h +++ b/repos/base/include/log_session/log_session.h @@ -44,7 +44,7 @@ struct Genode::Log_session : Session virtual ~Log_session() { } /* the lowest platform-specific maximum IPC payload size (OKL4) */ - enum { MAX_STRING_LEN = 236}; + enum { MAX_STRING_LEN = 232 }; typedef Rpc_in_buffer String; diff --git a/repos/base/run/log.run b/repos/base/run/log.run index 68e5623f8..545809a61 100644 --- a/repos/base/run/log.run +++ b/repos/base/run/log.run @@ -27,7 +27,7 @@ append xen_args { sdl="0" } run_genode_until "Test done.*\n" 20 -grep_output {\[init -\> test-log\]} +grep_output {\[init -\> test-log} compare_output_to { [init -> test-log] hex range: [0e00,1680) @@ -38,5 +38,10 @@ compare_output_to { [init -> test-log] positive hex char: 0x02 [init -> test-log] multiarg string: "parent -> child.7" [init -> test-log] String(Hex(3)): 0x3 +[init -> test-log] Very long messages: +[init -> test-log -> log] 1.....................................................................................................................................................................................................................................2 +[init -> test-log] 3.....................................................................................................................................................................................................................................4 +[init -> test-log] 5.....................................................................................................................................................................................................................................6 +[init -> test-log] [init -> test-log] Test done. } diff --git a/repos/base/src/test/log/main.cc b/repos/base/src/test/log/main.cc index 39bce1df1..034f1d09a 100644 --- a/repos/base/src/test/log/main.cc +++ b/repos/base/src/test/log/main.cc @@ -1,5 +1,5 @@ /* - * \brief Testing 'log()' with negative integer + * \brief Testing 'Genode::log()' and LOG session * \author Christian Prochaska * \date 2012-04-20 * @@ -14,6 +14,7 @@ #include #include +#include void Component::construct(Genode::Env &env) @@ -33,5 +34,26 @@ void Component::construct(Genode::Env &env) String<32> hex(Hex(3)); log("String(Hex(3)): ", hex); + log("Very long messages:"); + + static char buf[2*Log_session::MAX_STRING_LEN]; + + /* test writing of message with length = MAX_STRING_LEN with LOG connection */ + for (char &c : buf) c = '.'; + buf[0] = '1'; /* begin of line */ + buf[Log_session::MAX_STRING_LEN - 2] = '2'; /* last visible */ + buf[Log_session::MAX_STRING_LEN - 1] = '\0'; /* end of line */ + Log_connection log_connection { env, "log" }; + log_connection.write(buf); + + /* test splitting of message with length > MAX_STRING_LEN with 'Genode::log()' */ + for (char &c : buf) c = '.'; + buf[0] = '3'; /* begin of first line */ + buf[Log_session::MAX_STRING_LEN - 2] = '4'; /* last visible before flushed */ + buf[Log_session::MAX_STRING_LEN - 1] = '5'; /* first after flush */ + buf[2*Log_session::MAX_STRING_LEN - 3] = '6'; /* last visible before flushed */ + buf[2*Log_session::MAX_STRING_LEN - 2] = '\0'; /* end of second line */ + log(Cstring(buf)); + log("Test done."); }