Skip to content

Commit

Permalink
Update - test code.
Browse files Browse the repository at this point in the history
  • Loading branch information
ysan committed May 7, 2024
1 parent 5f62fad commit 8cb1083
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
2 changes: 1 addition & 1 deletion testpp/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ int main (void)
assert (s == std::string("module_b startup end."));
}
{
mod_c_extern-> req_startup ();
mod_c_extern-> req_startup_sync ();
threadmgr::CSource& r = p_mgr->get_external_if()-> receive_external();
assert (r.get_result() == threadmgr::result::success);
std::string s = reinterpret_cast<char*>(r.get_message().data());
Expand Down
20 changes: 20 additions & 0 deletions testpp/module_a/module_a.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ class module_a : public threadmgr::CThreadMgrBase
section_id = p_if->get_section_id();
THM_LOG_I ("%s section_id %d\n", __PRETTY_FUNCTION__, section_id);

assert(std::string(p_if->get_sequence_name()) == std::string("startup"));
assert(p_if->get_sequence_idx() == 0);

const char *msg = "module_a startup end.";
p_if->reply (threadmgr::result::success, reinterpret_cast<uint8_t*>(const_cast<char*>(msg)), strlen(msg)+1);

Expand All @@ -85,6 +88,9 @@ class module_a : public threadmgr::CThreadMgrBase
section_id = p_if->get_section_id();
THM_LOG_I ("%s section_id %d\n", __PRETTY_FUNCTION__, section_id);

assert(std::string(p_if->get_sequence_name()) == std::string("test_reqrep"));
assert(p_if->get_sequence_idx() == 1);

switch (section_id) {
case SECTID_ENTRY:
section_id = SECTID_REQ_TEST_REQREPNOTIFY;
Expand Down Expand Up @@ -153,6 +159,9 @@ class module_a : public threadmgr::CThreadMgrBase
section_id = p_if->get_section_id();
THM_LOG_I ("%s section_id %d\n", __PRETTY_FUNCTION__, section_id);

assert(std::string(p_if->get_sequence_name()) == std::string("test_reqrep_notify"));
assert(p_if->get_sequence_idx() == 2);

switch (section_id) {
case SECTID_ENTRY:

Expand Down Expand Up @@ -405,6 +414,9 @@ class module_a : public threadmgr::CThreadMgrBase
section_id = p_if->get_section_id();
THM_LOG_I ("%s section_id %d\n", __PRETTY_FUNCTION__, section_id);

assert(std::string(p_if->get_sequence_name()) == std::string("test_lock"));
assert(p_if->get_sequence_idx() == 3);

switch (section_id) {
case SECTID_ENTRY: {

Expand Down Expand Up @@ -471,6 +483,9 @@ class module_a : public threadmgr::CThreadMgrBase
section_id = p_if->get_section_id();
THM_LOG_I ("%s section_id %d\n", __PRETTY_FUNCTION__, section_id);

assert(std::string(p_if->get_sequence_name()) == std::string("test_lock_intr"));
assert(p_if->get_sequence_idx() == 4);

m_lock_check << "intr.";

p_if->reply (threadmgr::result::success, reinterpret_cast<uint8_t*>(const_cast<char*>(m_lock_check.str().c_str())), m_lock_check.str().length());
Expand All @@ -493,6 +508,9 @@ class module_a : public threadmgr::CThreadMgrBase
section_id = p_if->get_section_id();
THM_LOG_I ("%s section_id %d\n", __PRETTY_FUNCTION__, section_id);

assert(std::string(p_if->get_sequence_name()) == std::string("test_overwrite"));
assert(p_if->get_sequence_idx() == 5);

switch (section_id) {
case SECTID_ENTRY: {

Expand Down Expand Up @@ -567,6 +585,8 @@ class module_a : public threadmgr::CThreadMgrBase
section_id = p_if->get_section_id();
THM_LOG_I ("%s section_id %d\n", __PRETTY_FUNCTION__, section_id);

assert(std::string(p_if->get_sequence_name()) == std::string("test_destroy"));
assert(p_if->get_sequence_idx() == 6);

// dump
// kill (getpid(), SIGQUIT);
Expand Down
4 changes: 2 additions & 2 deletions testpp/module_c/module_c_extern.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ class module_c_extern : public threadmgr::CThreadMgrExternalIf
};


bool req_startup (void) {
bool req_startup_sync (void) {
int sequence = static_cast<int>(sequence::startup);
return request_async (m_module_id, sequence);
return request_sync (m_module_id, sequence);
};

bool req_test_reg_notify (void) {
Expand Down

0 comments on commit 8cb1083

Please sign in to comment.