ExampleReg::~ExampleReg() { if (copied) { std::string chmod_cmd = (boost::format("chmod -R +w %1%") % copy_dir).str(); checked_system(chmod_cmd); std::string rm_cmd = (boost::format("rm -rf %1%") % copy_dir).str(); checked_system(rm_cmd); } }
static int run_test(const char *testfile) { if (!fu_file_exists(testfile)) { fprintf(stderr, "Test executable '%s' not found\n", testfile); return -1; } return checked_system(testfile); }
static int build_test(struct TestFile *tf, struct Config *conf) { struct StringBuffer sb; sb_init(&sb, 128); make_build_command(&sb, tf, conf); int ret = checked_system(sb.s); sb_free(&sb); return ret; }
bool ExampleReg::copy(void) { gchar *target_dir = rra_mkdtemp("test-reg"); copy_dir = target_dir; g_free(target_dir); char *cwd = getcwd(0, 0); std::string cp_cmd = (boost::format("cd %1% ; tar chf - ." "| ( cd %2%/%3% ; tar xf - )") % source_dir % cwd % copy_dir).str(); checked_system(cp_cmd); std::string chmod_cmd = (boost::format("chmod -R +w %1%") % copy_dir).str(); checked_system(chmod_cmd); copied = true; return true; }