ATF-devel archive

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

Re: set variables at runtime with atf-run

2010/5/1 Julio Merino <>:
> On Fri, Apr 30, 2010 at 10:05 PM, Stathis Kamperis 
> <> wrote:
>> Hi all,
>> is it possible to declare a variable inside an atf test program,
>> assign it a default value and be able to change it during runtime ?
> Yes, it is.  You can use the atf_tc_{has,get}_config_var functions for
> this purpose.  See the atf-c/tc.h header file.

Excellent; I also saw atf_tc_get_config_var_wd() for falling back to a
default value if non is given. Works great.

As I understand ATF treats all config variables as strings. This makes
it cumbersome when you need an integer value and you have to call
strtol() and do all the error handling. Do you think that it would
make sense to have some ATF function  to take care of that ? Say for
example: atf_tc_get_config_var_as_int(). If not, I can always write
one of my own, put it in subr_atf.c and link against it from my test

>> If what I'm describing isn't feasible, what else would you recommend?
>> Just use some #define and settle with compile-time ?
> Please avoid defines/ifdefs if at all possible!  Keep in mind that the
> test programs get installed under /usr/tests, so their execution
> should be flexible for those without the source code.

You are right.


Home | Main Index | Thread Index | Old Index