Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Guilhem Saurel
hpp-util
Commits
c7537f36
Commit
c7537f36
authored
Jan 17, 2019
by
Joseph Mirabel
Browse files
Fix logs with streams + fix unit-test 'debug'
parent
7337c276
Pipeline
#3180
passed with stage
in 7 minutes and 48 seconds
Changes
4
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
src/debug.cc
View file @
c7537f36
...
...
@@ -189,6 +189,7 @@ namespace hpp
{
writePrefix
(
std
::
cerr
,
channel
,
file
,
line
,
function
);
std
::
cerr
<<
incindent
<<
data
.
rdbuf
()
<<
decindent
<<
std
::
flush
;
data
.
rdbuf
()
->
pubseekpos
(
0
);
}
namespace
...
...
@@ -273,6 +274,7 @@ namespace hpp
writePrefix
(
stream
,
channel
,
file
,
line
,
function
);
stream
<<
incindent
<<
data
.
rdbuf
()
<<
decindent
<<
std
::
flush
;
data
.
rdbuf
()
->
pubseekpos
(
0
);
}
Logging
::
Logging
()
...
...
tests/CMakeLists.txt
View file @
c7537f36
...
...
@@ -29,7 +29,7 @@ MACRO(DEFINE_TEST NAME LIB)
# Link against Boost.
TARGET_LINK_LIBRARIES
(
${
NAME
}
${
Boost_LIBRARIES
}
)
ADD_TEST
(
${
NAME
}
${
RUNTIME_OUTPUT_DIRECTORY
}
/
${
NAME
}
)
ADD_TEST
(
NAME
${
NAME
}
COMMAND
${
RUNTIME_OUTPUT_DIRECTORY
}
/
${
NAME
}
)
ENDMACRO
(
DEFINE_TEST
)
...
...
@@ -39,3 +39,9 @@ DEFINE_TEST(assertion hpp-util)
DEFINE_TEST
(
exception hpp-util
)
DEFINE_TEST
(
exception-factory hpp-util
)
DEFINE_TEST
(
timer hpp-util
)
SET
(
HPP_LOGGINGDIR
"
${
CMAKE_CURRENT_BINARY_DIR
}
"
)
CONFIG_FILES
(
run_debug.sh
)
ADD_EXECUTABLE
(
debug debug.cc
)
TARGET_LINK_LIBRARIES
(
debug hpp-util
${
Boost_LIBRARIES
}
)
ADD_TEST
(
NAME debug COMMAND
${
RUNTIME_OUTPUT_DIRECTORY
}
/run_debug.sh
)
tests/debug.cc
View file @
c7537f36
...
...
@@ -26,12 +26,13 @@ using namespace hpp::debug;
int
run_test
()
{
ConsoleOutput
console
;
JournalOutput
out
(
"debug.test.log"
);
Channel
channel
(
"TEST"
,
boost
::
assign
::
list_of
<
Output
*>
(
&
out
));
for
(
int
i
=
0
;
i
<
100
000
;
++
i
)
{
Channel
channel
(
"TEST"
,
boost
::
assign
::
list_of
<
Output
*>
(
&
out
)
(
&
console
)
);
for
(
int
i
=
0
;
i
<
100
;
++
i
)
{
std
::
stringstream
ss
;
ss
<<
i
<<
hpp
::
iendl
;
out
.
write
(
channel
,
__FILE__
,
__LINE__
,
__PRETTY_FUNCTION__
,
ss
.
str
()
);
channel
.
write
(
__FILE__
,
__LINE__
,
__PRETTY_FUNCTION__
,
ss
);
}
return
0
;
}
...
...
tests/run_debug.sh.in
0 → 100755
View file @
c7537f36
#!/bin/bash
export
HPP_LOGGINGDIR
=
@HPP_LOGGINGDIR@
@CMAKE_BINARY_DIR@/tests/debug
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment