int linux_hotplug_cleanup (struct lmodule *tm) { exec_cleanup (tm); event_ignore (einit_event_subsystem_hotplug, linux_hotplug_hotplug_event_handler); return 1; }
int linux_static_dev_cleanup (struct lmodule *pa) { exec_cleanup(pa); event_ignore (einit_event_subsystem_power, linux_static_dev_power_event_handler); event_ignore (einit_event_subsystem_boot, linux_static_dev_boot_event_handler); return 0; }
/// Forks and executes the cleanup of a test case in a controlled manner. /// /// \param test_program Path to the test program to execute. /// \param test_case Name of the test case to run. /// \param result_file Path to the ATF result file created by the body of the /// test case. The cleanup may update such file if it fails. /// \param user_variables Set of configuration variables to pass to the test. /// \param run_params Settings to control the subprocess. /// \param body_success The success value returned by run_body(). /// \param [out] success Set to true if the test case runs properly and returns /// a result that is to be considered as successful. /// /// \return OK if all goes well, an error otherwise. Note that a failed test /// case cleanup is denoted by setting success to false on exit, not by /// returning an error. static kyua_error_t run_cleanup(const char* test_program, const char* test_case, const char* result_file, const char* const user_variables[], const kyua_run_params_t* run_params, const bool body_success, bool* success) { kyua_error_t error; pid_t pid; error = kyua_run_fork(run_params, &pid); if (!kyua_error_is_set(error) && pid == 0) { exec_cleanup(test_program, test_case, user_variables); } assert(pid != -1 && pid != 0); if (kyua_error_is_set(error)) goto out; int status; bool timed_out; error = kyua_run_wait(pid, &status, &timed_out); if (kyua_error_is_set(error)) goto out; if (WIFSIGNALED(status) && WCOREDUMP(status)) { kyua_stacktrace_dump(test_program, pid, run_params, stderr); } if (body_success) { // If the body has reported a successful result, we inspect the status // of the cleanup routine. If the cleanup has failed, then we need to // mark the test as broken. However, if the body itself had failed, we // don't do this to give preference to the original result, which is // probably more informative. error = kyua_atf_result_cleanup_rewrite(result_file, status, timed_out, success); } out: return error; }