[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Enabling/disabling tests by command line parameters


> Jakub and I already wanted to do that but time didn't permit it
> yet. FOSDEM is ahead and we worked on getting pam_wrapper out before
> FOSDEM so we can do a presentation.

Good luck with meeting your deadline and preparing presentation! This
task doesn't seem to be time-critical. I'll try to help you with
implementing this feature when you're done with FOSDEM.

> We discussed it the way that we create a function named e.g.
> 
> cmocka_set_test_filter()
> 
> In the internal test structure we add a new struct member called enabled. 
> Based an what is set in the filter we enable or disable the tests to run.

In fact, I'd prefer a solution without global state. But if it's the
way you see your library design, I'm not going to argue a lot. Maybe
it's worth to rise this question again when it comes to releasing new
major version? A bit of re-designing and removing deprecated items may
be a good idea to me.

> We will not do command line argument parsing as this is different on each 
> platform (Linux, BSD, Windows, embedded platforms) (popt, argp, ...).

I think option parsing can be done in a crossplatform manner by manual
parsing argv. If the platform is so embedded that it has no argv,
unused parsing function will be just stripped out by linker anyway.

> You, the author of the test implements that parsind and just pass the right 
> argument to the cmocka filter function.

As far as I can judge, many users would want to use such a feature. So
it's the right thing to provide the solution out of box. Moreover, if
we have standardized command line syntax, it would be easy for new
users to start using it, so less time is spent on explaining how to
use that filtering feature.

> Writing a simple pattern matching function which supports * and ? is not hard 
> to do (~50 loc).

As well as writing simple command line parser :). The problem
with * and ? is that they're special to Bash. But, unfortunately,
I don't know better alternatives yet.

――― Pavel Kretov.


References:
Enabling/disabling tests by command line parametersPavel Kretov <firegurafiku@xxxxxxxxx>
Re: Enabling/disabling tests by command line parametersAndreas Schneider <asn@xxxxxxxxxxxxxx>