Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
FORMUS3IC_LAS3
/
embb
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
c3872ad0
authored
Mar 10, 2016
by
Marcus Winter
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'development' into embb485_dataflow_dynamic_tokencount
parents
4dadd0cd
87cee4dd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
58 deletions
+47
-58
base_c/src/thread.c
+2
-2
base_cpp/test/log_test.cc
+45
-56
No files found.
base_c/src/thread.c
View file @
c3872ad0
...
...
@@ -241,7 +241,7 @@ int embb_thread_create(embb_thread_t* thread, const embb_core_set_t* core_set,
status
=
pthread_attr_setaffinity_np
(
&
attr
,
sizeof
(
cpuset
),
&
cpuset
);
if
(
status
!=
0
)
{
thread
->
embb_internal_arg
=
NULL
;
thread
->
embb_internal_handle
=
NULL
;
thread
->
embb_internal_handle
=
0
;
return
EMBB_ERROR
;
}
#else
...
...
@@ -254,7 +254,7 @@ int embb_thread_create(embb_thread_t* thread, const embb_core_set_t* core_set,
thread
->
embb_internal_arg
=
(
embb_internal_thread_arg_t
*
)
embb_alloc
(
sizeof
(
embb_internal_thread_arg_t
));
if
(
thread
->
embb_internal_arg
==
NULL
)
{
thread
->
embb_internal_handle
=
NULL
;
thread
->
embb_internal_handle
=
0
;
pthread_attr_destroy
(
&
attr
);
return
EMBB_NOMEM
;
}
...
...
base_cpp/test/log_test.cc
View file @
c3872ad0
...
...
@@ -28,7 +28,7 @@
#include <embb/base/c/internal/unused.h>
#include <embb/base/log.h>
#include <
c
string>
#include <string>
namespace
embb
{
namespace
base
{
...
...
@@ -38,7 +38,7 @@ LogTest::LogTest() {
CreateUnit
(
"Test all"
).
Add
(
&
LogTest
::
Test
,
this
);
}
static
char
const
*
logged_message
;
static
std
::
string
logged_message
;
static
void
test_log_function
(
void
*
context
,
char
const
*
msg
)
{
EMBB_UNUSED
(
context
);
...
...
@@ -48,101 +48,90 @@ static void test_log_function(void * context, char const * msg) {
void
LogTest
::
Test
()
{
using
embb
::
base
::
Log
;
char
const
*
test_msg
=
"hello"
;
char
const
*
null
=
0
;
Log
::
SetLogFunction
(
0
,
test_log_function
);
Log
::
SetLogLevel
(
EMBB_LOG_LEVEL_TRACE
);
logged_message
=
null
;
logged_message
=
"none"
;
Log
::
Trace
(
"chn"
,
test_msg
);
#ifdef EMBB_DEBUG
PT_ASSERT_NE
(
logged_message
,
null
);
PT_EXPECT
(
0
==
strcmp
(
logged_message
,
"[chn] - [TRACE] hello"
));
PT_EXPECT
(
logged_message
==
"[chn] - [TRACE] hello"
);
#else
PT_EXPECT
_EQ
(
null
,
logged_message
);
PT_EXPECT
(
logged_message
==
"none"
);
#endif
logged_message
=
null
;
logged_message
=
"none"
;
Log
::
Info
(
"chn"
,
test_msg
);
#ifdef EMBB_DEBUG
PT_ASSERT_NE
(
logged_message
,
null
);
PT_EXPECT
(
0
==
strcmp
(
logged_message
,
"[chn] - [INFO ] hello"
));
PT_EXPECT
(
logged_message
==
"[chn] - [INFO ] hello"
);
#else
PT_EXPECT
_EQ
(
null
,
logged_message
);
PT_EXPECT
(
logged_message
==
"none"
);
#endif
logged_message
=
null
;
logged_message
=
"none"
;
Log
::
Warning
(
"chn"
,
test_msg
);
PT_ASSERT_NE
(
logged_message
,
null
);
PT_EXPECT
(
0
==
strcmp
(
logged_message
,
"[chn] - [WARN ] hello"
));
logged_message
=
null
;
PT_EXPECT
(
logged_message
==
"[chn] - [WARN ] hello"
);
logged_message
=
"none"
;
Log
::
Error
(
"chn"
,
test_msg
);
PT_ASSERT_NE
(
logged_message
,
null
);
PT_EXPECT
(
0
==
strcmp
(
logged_message
,
"[chn] - [ERROR] hello"
));
PT_EXPECT
(
logged_message
==
"[chn] - [ERROR] hello"
);
Log
::
SetLogLevel
(
EMBB_LOG_LEVEL_INFO
);
logged_message
=
null
;
logged_message
=
"none"
;
Log
::
Trace
(
"chn"
,
test_msg
);
PT_EXPECT
_EQ
(
null
,
logged_message
);
logged_message
=
null
;
PT_EXPECT
(
logged_message
==
"none"
);
logged_message
=
"none"
;
Log
::
Info
(
"chn"
,
test_msg
);
#ifdef EMBB_DEBUG
PT_ASSERT_NE
(
logged_message
,
null
);
PT_EXPECT
(
0
==
strcmp
(
logged_message
,
"[chn] - [INFO ] hello"
));
PT_EXPECT
(
logged_message
==
"[chn] - [INFO ] hello"
);
#else
PT_EXPECT
_EQ
(
null
,
logged_message
);
PT_EXPECT
(
logged_message
==
"none"
);
#endif
logged_message
=
null
;
logged_message
=
"none"
;
Log
::
Warning
(
"chn"
,
test_msg
);
PT_ASSERT_NE
(
logged_message
,
null
);
PT_EXPECT
(
0
==
strcmp
(
logged_message
,
"[chn] - [WARN ] hello"
));
logged_message
=
null
;
PT_EXPECT
(
logged_message
==
"[chn] - [WARN ] hello"
);
logged_message
=
"none"
;
Log
::
Error
(
"chn"
,
test_msg
);
PT_ASSERT_NE
(
logged_message
,
null
);
PT_EXPECT
(
0
==
strcmp
(
logged_message
,
"[chn] - [ERROR] hello"
));
PT_EXPECT
(
logged_message
==
"[chn] - [ERROR] hello"
);
Log
::
SetLogLevel
(
EMBB_LOG_LEVEL_WARNING
);
logged_message
=
null
;
logged_message
=
"none"
;
Log
::
Trace
(
"chn"
,
test_msg
);
PT_EXPECT
_EQ
(
null
,
logged_message
);
logged_message
=
null
;
PT_EXPECT
(
logged_message
==
"none"
);
logged_message
=
"none"
;
Log
::
Info
(
"chn"
,
test_msg
);
PT_EXPECT
_EQ
(
null
,
logged_message
);
logged_message
=
null
;
PT_EXPECT
(
logged_message
==
"none"
);
logged_message
=
"none"
;
Log
::
Warning
(
"chn"
,
test_msg
);
PT_ASSERT_NE
(
logged_message
,
null
);
PT_EXPECT
(
0
==
strcmp
(
logged_message
,
"[chn] - [WARN ] hello"
));
logged_message
=
null
;
PT_EXPECT
(
logged_message
==
"[chn] - [WARN ] hello"
);
logged_message
=
"none"
;
Log
::
Error
(
"chn"
,
test_msg
);
PT_ASSERT_NE
(
logged_message
,
null
);
PT_EXPECT
(
0
==
strcmp
(
logged_message
,
"[chn] - [ERROR] hello"
));
PT_EXPECT
(
logged_message
==
"[chn] - [ERROR] hello"
);
Log
::
SetLogLevel
(
EMBB_LOG_LEVEL_ERROR
);
logged_message
=
null
;
logged_message
=
"none"
;
Log
::
Trace
(
"chn"
,
test_msg
);
PT_EXPECT
_EQ
(
null
,
logged_message
);
logged_message
=
null
;
PT_EXPECT
(
logged_message
==
"none"
);
logged_message
=
"none"
;
Log
::
Info
(
"chn"
,
test_msg
);
PT_EXPECT
_EQ
(
null
,
logged_message
);
logged_message
=
null
;
PT_EXPECT
(
logged_message
==
"none"
);
logged_message
=
"none"
;
Log
::
Warning
(
"chn"
,
test_msg
);
PT_EXPECT
_EQ
(
null
,
logged_message
);
logged_message
=
null
;
PT_EXPECT
(
logged_message
==
"none"
);
logged_message
=
"none"
;
Log
::
Error
(
"chn"
,
test_msg
);
PT_ASSERT_NE
(
logged_message
,
null
);
PT_EXPECT
(
0
==
strcmp
(
logged_message
,
"[chn] - [ERROR] hello"
));
PT_EXPECT
(
logged_message
==
"[chn] - [ERROR] hello"
);
Log
::
SetLogLevel
(
EMBB_LOG_LEVEL_NONE
);
logged_message
=
null
;
logged_message
=
"none"
;
Log
::
Trace
(
"chn"
,
test_msg
);
PT_EXPECT
_EQ
(
null
,
logged_message
);
logged_message
=
null
;
PT_EXPECT
(
logged_message
==
"none"
);
logged_message
=
"none"
;
Log
::
Info
(
"chn"
,
test_msg
);
PT_EXPECT
_EQ
(
null
,
logged_message
);
logged_message
=
null
;
PT_EXPECT
(
logged_message
==
"none"
);
logged_message
=
"none"
;
Log
::
Warning
(
"chn"
,
test_msg
);
PT_EXPECT
_EQ
(
null
,
logged_message
);
logged_message
=
null
;
PT_EXPECT
(
logged_message
==
"none"
);
logged_message
=
"none"
;
Log
::
Error
(
"chn"
,
test_msg
);
PT_EXPECT
_EQ
(
null
,
logged_message
);
PT_EXPECT
(
logged_message
==
"none"
);
}
}
// namespace test
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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