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

LoggerTests fail #8

Open
NoRePercussions opened this issue Feb 8, 2023 · 1 comment
Open

LoggerTests fail #8

NoRePercussions opened this issue Feb 8, 2023 · 1 comment

Comments

@NoRePercussions
Copy link

NoRePercussions commented Feb 8, 2023

Describe the bug
The 5 logging type LoggerTests fail.

Expected equality of these values:
  line
    Which is: NULL
  "EMPTY_FILE"

Inspection reveals that the getline fails:

.../OkapiLib/test/loggerTests.cpp:52: Failure
Expected: (getline(&line, &len, logFile)) != ((-1)), actual: -1 vs -1

Flushing or rewinding the buffer does not help.

Additionally, LoggerTest.TestLazyLogging succeeds, but only because it does not test the output. To check if lazy logging actually works, it should probably test the output.

Steps To Reproduce
Run the LoggerTest tests:

$ ./OkapiLibV5 --gtest_filter="LoggerTest*"

Expected behavior
Tests should pass and getline should not fail to read from the file

Versions
OkapiLib 5 / PurdueSigBots maintenance fork

Additional Information
Compiled with Clang.

@NoRePercussions
Copy link
Author

These actually only fail on my machine.

The LoggerTests use open_memstream to create a buffer for testing from. By standard, these streams do not allow reading, but Linux seems to allow for exceptions. Thus, it works fine on the Workflow.

NoRePercussions added a commit to Buchholz-Robotics/OkapiLib that referenced this issue Feb 9, 2023
The previous tests used a technically write-only stream in memory, which causes the tests to fail on some systems. Instead, we can use an `fmemopen` stream to ensure it is always readable.
NoRePercussions added a commit to Buchholz-Robotics/OkapiLib that referenced this issue Feb 9, 2023
The previous tests used a technically write-only stream in memory, which causes the tests to fail on some systems. Instead, we can use an `fmemopen` stream to ensure it is always readable.
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

No branches or pull requests

1 participant