ATF-devel archive

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

set variables at runtime with atf-run



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 ?
Something like that (schematic):

ATF_DECLARE_CONFIG_VARIABLE(iterations, int, 100);        /* name,
type, default value */
ATF_DECLARE_CONFIG_VARIABLE(fuzzing, int, 0);


ATF_TC(test_mytest);
ATF_TC_HEAD(test_mytest, tc)
{
}
ATF_TC_BODY(test_mytest, tc)
{
    for (i = 0; i < iterations; i++) {
          /* Do some checks */
    }
}

ATF_TP_ADD_TCS(tp)
{
    if (fuzzing)
        ATF_TP_ADD_TC(tp, test_mytest);
}

And then invoke it like this:
atf-run -v iterations=2000, fuzzing=1

I'm writing some test cases that besides the hard-coded checks, do a
lot of random calculations. Although 10M iterations are fine in my
fast machine, I guess they wouldn't in some old VAX and whatnot :)

If what I'm describing isn't feasible, what else would you recommend?
Just use some #define and settle with compile-time ?

Best regards,
Stathis


Home | Main Index | Thread Index | Old Index