Menu
Logged-In As
ACCOUNTNot Logged In
Create a utility library (LIBBU) API unit test ... for backtrace.cBRL-CAD
Status: ClosedTime to complete:
48 hrs
Mentors: Sean
There are more than 300 library functions in our core LIBBU library. As a core library used by nearly every one of BRL-CAD's tools, testing those functions for correct behavior is important.
This task involves implementing a new unit test for any of LIBBU's source files that do not already have a unit test defined. The test should run all of the public functions and be hooked into our build system (if written in C). We have lots of existing unit tests to follow as an example.
You can implement this task in any language you like, but you'll have to bind all of the functions you test.
References:
- include/bu.h
- src/libbu/backtrace.c
- src/libbu/tests/*.c
Code:
- src/libbu/tests/bu_backtrace.c
- src/libbu/tests/CMakeLists.txt
Hi,
What need I do to test this function (bu_backtrace)? Is the output of this function always standard (it says something about gdb), or does it vary from platform to platform?
Thanks,
Lachlan
I would like to work on this task.
I could test it to ensure when the FILE * parameter is null, it prints to stdout, and when it is not null, it actually writes some data.
This task has been assigned to Lachlan P. You have 48 hours to complete this task, good luck!
So this is a tricky one to test. The output will vary because it is calling on gdb to help get the trace.
Your idea about testing the FILE pointer is a reasonable test. Note the TEST_BACKTRACE section at the bottom of the file -- that may be a good starting point as well to pull into your test file. Since you're creating a separate unit test file, your patch should incorporate that test and remove that section from backtrace.c; just include both in your patchfile.
The work on this task is ready to be reviewed.
So this looks almost perfect. :)
The fixed buffer size is a bug report waiting to happen, especially since debug/crash output can vary. Since you have a file handle, you can call fstat() to get the file size and allocate a buffer of the appropriate size.
One of the mentors has sent this task back for more work. Talk to the mentor(s) assigned to this task to satisfy the requirements needed to complete this task, submit your work again and mark the task as complete once you re-submit your work.
The deadline of the task has been extended with 1 days and 0 hours.
Thanks,
I had assumed that fstat was 'unportable', and I couldn't find anything about it in the code.
Will rewrite it :-)
Lachlan
fstat is VERY portable. It's part of c89 and 1988 POSIX.1 so it's pretty much supported everywhere. When in doubt, look around the code for other instances and you'll see we use it in several other places: grep fstat src/libbu/*
The work on this task is ready to be reviewed.
Thanks!
Next time I will try that!
Lachlan
Congratulations, this task has been completed successfully.
Lachlan, I thought you might like to know that there's about 4 days remaining and you're currently about 4 tasks close to making our top five.
As GCI comes to a close, we wanted to take the time to say THANK YOU for all your efforts. This comment interface closes after GCI is over, so you're encouraged to join our mailing list where we'll be announcing contributions from GCI participants like yourelf over the upcoming months:
https://lists.sourceforge.net/lists/listinfo/brlcad-news
If you've provided your full name, we'll be sure to credit you in our authorship documentation and you'll see your name in a future announcement. If you contact us at devs@brlcad.org or via IRC, we'll even let you know when your work is integrated and follow up with updates. You're welcome and encouraged to contact us any time, especially if you have a question about how to continue participating in Open Source after GCI is over, but even if just to keep in touch. Note that ongoing participation in Open Source is one of the most impressive skills to have on your resumé. Take care, be well, and thank you again!