Skip to content

Add support for Cygwin #166

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add support for Cygwin #166

wants to merge 1 commit into from

Conversation

ptheta
Copy link

@ptheta ptheta commented Dec 27, 2017

Add UNITTEST_CYGWIN directive and use it to:
include Posix/TimeHelpers.h for Cygwin,
exclude the signal handling in SignalTranslator.h/.cpp as Cygwin does not have
the necessary Posix signal handling support, i.e. sigjmp_buf or siglongjmp.

Reimplement SleepMs in TimeHelpers.cpp using C++11 rather than usleep as that
is not present on Cygwin.

Update CMakeLists.txt to exclude SignalTranslator.h/.cpp from the build.

Add UNITTEST_CYGWIN directive and use it to:
include Posix/TimeHelpers.h for Cygwin,
exclude the signal handling in SignalTranslator.h/.cpp as Cygwin does not have
the necessary Posix signal handling support, i.e. sigjmp_buf or siglongjmp.

Reimplement SleepMs in TimeHelpers.cpp using C++11 rather than usleep as that
is not present on Cygwin.

Update CMakeLists.txt to exclude SignalTranslator.h/.cpp from the build.
@ptheta
Copy link
Author

ptheta commented Dec 28, 2017

I don't think the Travis failure is related to my changes. I checked out the current master branch ( bc5d87f) and I see a failure there like so:
[100%] Linking CXX executable TestUnitTest++
Running unit tests
*** Error in `./TestUnitTest++': free(): invalid pointer: 0x00007ffc7bfe7f98 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x7908b)[0x7f4927b2708b]
/lib/x86_64-linux-gnu/libc.so.6(+0x82c3a)[0x7f4927b30c3a]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7f4927b34d2c]
./TestUnitTest++(_ZN8UnitTest11ExecuteTestINS_4TestEEEvRT_RKNS_11TestDetailsEb+0x4b)[0x4b8d4b]
./TestUnitTest++[0x489497]
./TestUnitTest++(_ZN8UnitTest11ExecuteTestINS_4TestEEEvRT_RKNS_11TestDetailsEb+0x4b)[0x4b8d4b]
./TestUnitTest++(_ZNK8UnitTest10TestRunner7RunTestEPNS_11TestResultsEPNS_4TestEi+0x55)[0x4b9475]
./TestUnitTest++(_ZN8UnitTest11RunAllTestsEv+0x4d)[0x4b91ed]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf1)[0x7f4927ace3f1]
./TestUnitTest++(_start+0x2a)[0x40cfda]

Copy link
Member

@pjohnmeyer pjohnmeyer left a comment

Choose a reason for hiding this comment

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

@ptheta I'm not sure these changes are necessary. On Cygwin, just use the Win32 platform.

Happy to discuss? Also would need to make the changes C++98 compatible (for now).

@@ -27,7 +29,7 @@ namespace UnitTest {

void TimeHelpers::SleepMs(int ms)
{
usleep(static_cast<useconds_t>(ms * 1000));
std::this_thread::sleep_for(std::chrono::microseconds(ms * 1000));
Copy link
Member

Choose a reason for hiding this comment

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

We can't use <chrono> in UnitTest++ at this time. UnitTest++ does not require a modern compiler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants