예제 #1
0
ATF_TC_BODY(h_build_cpp_fail, tc)
{
    FILE *sfile;
    bool success;

    ATF_REQUIRE((sfile = fopen("test.c", "w")) != NULL);
    fprintf(sfile, "#include \"./non-existent.h\"\n");
    fclose(sfile);

    RE(atf_check_build_cpp("test.c", "test.p", NULL, &success));
    ATF_REQUIRE(!success);
}
예제 #2
0
bool
impl::build_cpp(const std::string& sfile, const std::string& ofile,
                const atf::process::argv_array& optargs)
{
    bool success;

    atf_error_t err = atf_check_build_cpp(sfile.c_str(), ofile.c_str(),
                                          optargs.exec_argv(), &success);
    if (atf_is_error(err))
        throw_atf_error(err);

    return success;
}
예제 #3
0
ATF_TC_BODY(h_build_cpp_ok, tc)
{
    FILE *sfile;
    bool success;
    atf_fs_path_t test_p;

    RE(atf_fs_path_init_fmt(&test_p, "test.p"));

    ATF_REQUIRE((sfile = fopen("test.c", "w")) != NULL);
    fprintf(sfile, "#define A foo\n");
    fprintf(sfile, "#define B bar\n");
    fprintf(sfile, "A B\n");
    fclose(sfile);

    RE(atf_check_build_cpp("test.c", atf_fs_path_cstring(&test_p), NULL,
                           &success));
    ATF_REQUIRE(success);

    atf_fs_path_fini(&test_p);
}