Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unittesting: Update mutex stub #7988

Merged
merged 1 commit into from Sep 6, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion UNITTESTS/stubs/Mutex_stub.cpp
Expand Up @@ -27,7 +27,12 @@ rtos::Mutex::~Mutex()
return;
}

osStatus rtos::Mutex::lock(unsigned int)
osStatus rtos::Mutex::lock(void)
Copy link
Contributor

@0xc0170 0xc0170 Sep 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix looks good - to update to a new method but this should not cause a linker error (overloaded method). Please explain

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@0xc0170 Since unit tests use UNITTESTS/stubs/Mutex_stub.cpp to implement rtos/Mutex.h and rtos::Mutex::lock() was not implemented, a test failed with:

Undefined symbols for architecture x86_64:

  "rtos::Mutex::lock()", referenced from:

      InternetSocket::open(NetworkStack*)       in libfeatures_netsocket_UDPSocket.MbedOS.a(InternetSocket.cpp.o)

      InternetSocket::close()      in libfeatures_netsocket_UDPSocket.MbedOS.a(InternetSocket.cpp.o)

      InternetSocket::bind(SocketAddress const&)  in libfeatures_netsocket_UDPSocket.MbedOS.a(InternetSocket.cpp.o)

      InternetSocket::set_timeout(int)    in libfeatures_netsocket_UDPSocket.MbedOS.a(InternetSocket.cpp.o)

      InternetSocket::setsockopt(int, int, void const*, unsigned int) in libfeatures_netsocket_UDPSocket.MbedOS.a(InternetSocket.cpp.o)

      InternetSocket::getsockopt(int, int, void*, unsigned int*) in libfeatures_netsocket_UDPSocket.MbedOS.a(InternetSocket.cpp.o)

      InternetSocket::sigio(mbed::Callback<void ()>)    in libfeatures_netsocket_UDPSocket.MbedOS.a(InternetSocket.cpp.o)

      ...

ld: symbol(s) not found for architecture x86_64

collect2: error: ld returned 1 exit status

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stub should implement both (void and uint32 arguments) methods, this is just one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now it implements both.

{
return osOK;
}

osStatus rtos::Mutex::lock(uint32_t millisec)
{
return osOK;
}
Expand Down