ATF_TC_BODY(h_build_cxx_o_fail, tc) { FILE *sfile; bool success; ATF_REQUIRE((sfile = fopen("test.cpp", "w")) != NULL); fprintf(sfile, "void foo(void) { int a = UNDEFINED_SYMBOL; }\n"); fclose(sfile); RE(atf_check_build_cxx_o("test.cpp", "test.o", NULL, &success)); ATF_REQUIRE(!success); }
ATF_TC_BODY(h_build_cxx_o_ok, tc) { FILE *sfile; bool success; ATF_REQUIRE((sfile = fopen("test.cpp", "w")) != NULL); fprintf(sfile, "#include <iostream>\n"); fclose(sfile); RE(atf_check_build_cxx_o("test.cpp", "test.o", NULL, &success)); ATF_REQUIRE(success); }
bool impl::build_cxx_o(const std::string& sfile, const std::string& ofile, const atf::process::argv_array& optargs) { bool success; atf_error_t err = atf_check_build_cxx_o(sfile.c_str(), ofile.c_str(), optargs.exec_argv(), &success); if (atf_is_error(err)) throw_atf_error(err); return success; }