[OISF/outreachy] Guidance to get started

Juliana Fajardini Reichow jufajardini at gmail.com
Sun Oct 18 18:03:09 UTC 2020


Le dim. 18 oct. 2020 à 18:55, Agha Saad via Outreachy <
outreachy at lists.openinfosecfoundation.org> a écrit :

> Hi all,
> After setting up the project, I am interested in contributing to the
> project, for that I am thinking to get started with an issue. I have
> checked different issues, I need guidance to  *Convert unittests to new
> FAIL/PASS API: detect-sid.c (*
> https://redmine.openinfosecfoundation.org/issues/4058*). *Kindly share
> some more details about the issue, what is FAIL/PASS API, what should be
> the expected result and all. Thanks :)
>
>
Hi Agha,

Some days ago Shivani posted a really good explanation for those types of
issues. It helped me a lot in understanding what I had to do, so I saved it.
Here it is:

"We do not have any elaborate documentation about this since it is not a
> user feature and we recently introduced devguides. But, to give you an
> idea, A lot of tests were written initially just like any other methods,
> there were multiple conditionals for failure (return 0) and one pass
> condition (return 1) e.g.
> https://github.com/OISF/suricata/blob/master/src/detect-mark.c#L259.
>
> While there was nothing wrong with this approach, we found it would be
> much cleaner if we used conditional macros that clearly say whether the
> test "fails" or "passes" on a certain condition. So, we introduced a lot of
> well defined macros (see
> https://github.com/OISF/suricata/blob/master/src/util-unittest.h) to make
> the tests more legible and clear.
>
> As you can see, there are macros for almost all failing conditionals e.g.,
> fail if something is null, fail if something exists (>0), etc. There are
> also macros PASS and PASS_IF which mean all the conditionals were met
> properly and the test has passed.
>
> Your job as a part of this task is to remove the old style of tests i.e.
> returning values on failure/passing conditionals and use this FAIL/PASS API
> instead. One good example could be OISF/suricata: 3cf8b46
> <https://github.com/OISF/suricata/commit/3cf8b4629f2cf523c3f82604d93b8fd4a0888109>
> .
>
> If you look closely, all the conditionals are converted to the FAIL/PASS
> API in a manner that there is NO memory leak on the success path (PASS). It
> is OK to have memleaks on failure paths. There is some relevant information
> about these FAIL/PASS conversion issues on their parent issue as well.
> Please check that out too."
>
I hope it can help you, as it did to me!

And like she said, if you have more questions, please share, and I'm sure
someone will come to the rescue :)


> Regards,
> Agha Saad
> _______________________________________________
> Outreachy mailing list
> Outreachy at lists.openinfosecfoundation.org
> https://lists.openinfosecfoundation.org/listinfo/outreachy
>


-- 
Juliana Fajardini Reichow
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openinfosecfoundation.org/pipermail/outreachy/attachments/20201018/3a56e14c/attachment.html>


More information about the Outreachy mailing list