Comments (10)
Can you provide a bit more detail. I'm not sure what circumstances you're looking at here.
from ceedling.
What kind of detail? This is the output I see:
...
TEST OUTPUT
[test_TBuffer.c]
- "0/F/TBuffer.c:24/Failed to malloc TBuf: No Memory"
- "0/F/TBuffer.c:24/Failed to malloc TBuf: No Memory"
- ""
FAILED TEST SUMMARY
[test_TBuffer.c]
Test: test_TBuf_Create_OK
At line (83): "Expected 0x00000004 Was 0x00000040. Function tmalloc Argument size. Function called with unexpected argument value."
OVERALL TEST SUMMARY
TESTED: 3
PASSED: 2
FAILED: 1
IGNORED: 0
BUILD FAILURE SUMMARY
Unit test failures.
Note that the filename test_TBuffer.c is given under TEST OUTPUT, but not the test function names.
Meanwhile, for the FAILED TEST SUMMARY, both test file and test function names are given, which would be the correct behavior I guess.
On 29 Apr 2016, at 15:19, Mark VanderVoord [email protected] wrote:
Can you provide a bit more detail. I'm not sure what circumstances you're looking at here.
—
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
from ceedling.
Sorry, looks like the answer I sent through mail got broken? I'll repeat here.
What kind of detail? This is the output I see:
...
-----------
TEST OUTPUT
-----------
[test_TBuffer.c]
- "0/F/TBuffer.c:24/Failed to malloc TBuf: No Memory"
- "0/F/TBuffer.c:24/Failed to malloc TBuf: No Memory"
- ""
-------------------
FAILED TEST SUMMARY
-------------------
[test_TBuffer.c]
Test: test_TBuf_Create_OK
At line (83): "Expected 0x00000004 Was 0x00000040. Function tmalloc Argument size. Function called with unexpected argument value."
--------------------
OVERALL TEST SUMMARY
--------------------
TESTED: 3
PASSED: 2
FAILED: 1
IGNORED: 0
---------------------
BUILD FAILURE SUMMARY
---------------------
Unit test failures.
Note that the filename test_TBuffer.c is given under TEST OUTPUT, but not the test function names.
Meanwhile, for the FAILED TEST SUMMARY, both test file and test function names are given, which would be the correct behavior I guess.
from ceedling.
Ah. Ceedling doesn't make any attempt to correlate data that you are manually dumping to stdout with the data that it is looking for. It simply captures it and displays it so that you can use it for whatever you like. This is intentional. In order to correlate it to a test, Ceedling would have to keep that data around, then apply it to the test when it is completed. In addition to this being a lot of overhead for a feature that is seldom used, it could easily be wrong if the output was dumped from setUp, tearDown, the RUN_TEST macro, etc. In any of those cases, you would see the extra output incorrectly assigned to the next completed test.
The output summary is really just there for the convenience of the test writers. The majority of the time, it is completely empty.
from ceedling.
OK, I think I understand.
My assumption was that, just as each stderr output is connected to a test function, the stdout would also be connected, and that the problem of not seeing which test function printed something was just a problem in the test result printer.
From what you say, I understand now that in fact the stdout is NOT captured specifically for each test function, and that doing so would be too much overhead. Right? That's a pity, I assumed it would be the same procedure already being done for stderr.
Just to be clear, I can kinda work-around this myself in my tests by adding the printf("%s",__func__);
thing as the first line of each test, just to know that the coming text was output by such-and-such test. It's just strange boilerplate. Though I understand that usually (ideally) unit tests don't even use stdout.
So, as a way to reduce the boilerplate in a generic way: would it be possible to have the name of the test be passed to the setUp() function? So I could do something like
void setUp(char * test_func){
printf("%s",test_func);
}
from ceedling.
(... or maybe this isn't even about stderr and stdout and then I'm totally off??)
from ceedling.
Actually all the output from stdout is being captured. The part that makes it more challenging is that the name of the test is announced with the results, so it happens at the END of the test. (This is necessary for quite a few reasons, all of which are odd little details. Long ago, we used to print the test name at the beginning and then the pass/fail result at the end of the test... everything else would get inserted in between. this didn't really work very well because people's results parsers would get all messed up by anything they output in the middle).
ANYWAY, it happens at the end now... which means that anything you output would have to get stored away separately, then associated with that test once it was announced. This would be correct most of the time... but if the user chose to write something from setup or teardown or anything like that, it would still get associated with the nearest test, which may not be what they were looking for.
Maybe we add a TEST_INFO_MESSAGE macro to output an info line with whatever you want?
from ceedling.
How would that TEST_INFO_MESSAGE macro be used?
from ceedling.
It would output the text you pass it, but prefix it with the usual info... maybe something like filename:line:function:INFO:message? I'm just thinking aloud here.
(The advantage being that you could force this sort of output to appear in the appropriate place in Ceedling's Pretty Print)
from ceedling.
If it is something that could be used in setUp(), then OK. But things like filename, line, function, can already be done with standard compiler-provided macros, so... I don't know.
In general, IMO anything that maximizes info in case of debugging and minimizes boilerplate is good :).
from ceedling.
Related Issues (20)
- Ceedling Unity Defines Not Being Used HOT 1
- GCOV at test/ceedling_0_32_rc HOT 6
- Flags per-file-matchers at Release HOT 3
- gcovr` does not exist in system search path HOT 4
- Why doesn't Ceedling compile the files included in the production code? HOT 6
- How can I add the math library in the project.yml for a build with the coverage plugin? HOT 7
- ceedling exited with status: [1] HOT 2
- Ceedling misses licensing information in installation and in vendored mode HOT 3
- wildcard include paths order is inconsistent between environments HOT 1
- ReportGenerator with GCC v6.3.0 HOT 1
- Can ceedling mock support subfolder ? myfolder/mock_myheader.h for example? HOT 1
- undefined method `exists?' for class File (NoMethodError) when run ceedling new project on UBuntu on wsl2 HOT 1
- git , jenkins and unit test using ceedling HOT 3
- Issue with mocking header inline functions and defines HOT 10
- Executing Ceedling in a previously initialized project directory fails after switching the user account HOT 2
- How to add list of source files to every test HOT 3
- unit test an output message written in the console with printf HOT 3
- Can not set environment variables from imported files. HOT 5
- How to read/catch stdout (shell) HOT 1
- Environment variables at flags and define fields HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ceedling.