ATF-devel archive

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

Re: Conditional tests based on ${MACHINE} and ${MACHINE_ARCH}



On Sat, 1 Jan 2011, Paul Goyette wrote:

For now, if you want to do this, you can do it programmatically.
Something along the lines of:

const char* machine = atf_tc_get_config_var("atf_machine");
if (strcmp(machine, "foo") == 0)
   atf_tc_skip("Can't run on foo machine");
... rest of the test case body ...

That's what I'm currently doing.

But it doesn't seem to work. atf-config seems to confirm that the variable is set:

        {494} atf-config
        atf_arch : amd64
        atf_build_cc : /usr/bin/cc
        ...

Running the tests seems to indicate that the variable doesn't exist:

        {495} atf-run t_ldexp
        ...
        tc-start: basics
        tc-se:t_ldexp: Precondition check failed at 
/build/netbsd-local/src/external/bsd/atf/dist/atf-c/tc.c:623: 
atf_tc_has_config_var(tc, name)
        tc-se:t_ldexp:
        tc-se:t_ldexp: This is probably a bug in this application or one of the 
libraries it uses.  If you believe this problem is caused by, or is related to 
Automated Testing Framework 0.12, please report it to 
atf-devel%NetBSD.org@localhost and provide as many detatils as possible 
describing how you got to this condition.
        tc-end: basics, failed, Test program received signal 6
        tc-start: denormal
        ...

Here's the code I'm using:

        static void
        run_test(const atf_tc_t *tc, struct ldexp_test *table)
        {
        ...
                const char *arch;

                arch = atf_tc_get_config_var(tc, "atf_arch");
                if (strcmp("vax", arch) == 0)
                        atf_tc_skip("Test not applicable on %s", arch);
        ...

        #define TEST(name)                                      \
        ...
                ATF_TC_BODY(name, tc)                           \
                {                                               \
                        run_test(tc, name);                     \
                }
        ...

        TEST(basics);



-------------------------------------------------------------------------
| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:       |
| Customer Service | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com    |
| Network Engineer | 0786 F758 55DE 53BA 7731 | pgoyette at juniper.net |
| Kernel Developer |                          | pgoyette at netbsd.org  |
-------------------------------------------------------------------------


Home | Main Index | Thread Index | Old Index