Prior to this "test" is being used interchangeably with "simulate".
Changing "test" to "simulate" makes the program more consistent with itself.
In the help, use the word "parameter" instead of "operation".
fll_program_print_help_option(output, context, controller_short_interruptable, controller_long_interruptable, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "Designate that this program can be interrupted.");
fll_program_print_help_option(output, context, controller_short_pid, controller_long_pid, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Specify a custom pid file path, such as '" controller_path_pid controller_string_default controller_path_suffix "'.");
fll_program_print_help_option(output, context, controller_short_settings, controller_long_settings, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Specify a custom settings path, such as '" controller_path_settings "'.");
- fll_program_print_help_option(output, context, controller_short_test, controller_long_test, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Run in test mode, where nothing is actually run but is instead simulated.");
+ fll_program_print_help_option(output, context, controller_short_simulate, controller_long_simulate, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Run as a simulation.");
fll_program_print_help_option(output, context, controller_short_validate, controller_long_validate, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Validate the settings (entry and rules) without running (does not simulate).");
fll_program_print_help_usage(output, context, controller_name, "entry");
fprintf(output.stream, " When both the ");
- f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, controller_long_test);
- fprintf(output.stream, " operation and the ");
+ f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, controller_long_simulate);
+ fprintf(output.stream, " parameter and the ");
f_color_print(output.stream, context.set.notable, "%s%s", f_console_symbol_long_enable_s, controller_long_validate);
- fprintf(output.stream, " operation are specified, then additional information on each would be executed rule is printed.");
+ fprintf(output.stream, " parameter are specified, then additional information on each would be executed rule is printed but no simulation is performed.");
fprintf(output.stream, "%c", f_string_eol_s[0]);
return F_none;
#define controller_short_interruptable "i"
#define controller_short_pid "p"
#define controller_short_settings "s"
- #define controller_short_test "t"
+ #define controller_short_simulate "S"
#define controller_short_validate "v"
#define controller_long_control "control"
#define controller_long_interruptable "interruptable"
#define controller_long_pid "pid"
#define controller_long_settings "settings"
- #define controller_long_test "test"
+ #define controller_long_simulate "simulate"
#define controller_long_validate "validate"
enum {
controller_parameter_interruptable,
controller_parameter_pid,
controller_parameter_settings,
- controller_parameter_test,
+ controller_parameter_simulate,
controller_parameter_validate,
};
f_console_parameter_t_initialize(controller_short_interruptable, controller_long_interruptable, 0, 0, f_console_type_normal), \
f_console_parameter_t_initialize(controller_short_pid, controller_long_pid, 0, 1, f_console_type_normal), \
f_console_parameter_t_initialize(controller_short_settings, controller_long_settings, 0, 1, f_console_type_normal), \
- f_console_parameter_t_initialize(controller_short_test, controller_long_test, 0, 0, f_console_type_normal), \
+ f_console_parameter_t_initialize(controller_short_simulate, controller_long_simulate, 0, 0, f_console_type_normal), \
f_console_parameter_t_initialize(controller_short_validate, controller_long_validate, 0, 0, f_console_type_normal), \
}
return status;
}
- if (main->data->parameters[controller_parameter_test].result == f_console_result_found || main->data->error.verbosity == f_console_verbosity_verbose) {
+ if (main->data->parameters[controller_parameter_simulate].result == f_console_result_found || main->data->error.verbosity == f_console_verbosity_verbose) {
if (main->data->error.verbosity != f_console_verbosity_quiet) {
f_thread_mutex_lock(&main->thread->lock.print);
if (F_status_is_error(entry_action->status)) {
if (controller_entry_action_type_is_rule(entry_action->type)) {
- if (main->data->parameters[controller_parameter_test].result == f_console_result_found) {
+ if (main->data->parameters[controller_parameter_simulate].result == f_console_result_found) {
if (main->data->error.verbosity != f_console_verbosity_quiet) {
f_thread_mutex_lock(&main->thread->lock.print);
}
}
else {
- if (main->data->parameters[controller_parameter_test].result == f_console_result_found) {
+ if (main->data->parameters[controller_parameter_simulate].result == f_console_result_found) {
if (main->data->error.verbosity != f_console_verbosity_quiet) {
f_thread_mutex_lock(&main->thread->lock.print);
if (entry_action->type == controller_entry_action_type_ready) {
if (entry_action->code & controller_entry_rule_code_wait) {
- if (main->data->parameters[controller_parameter_test].result == f_console_result_found || main->data->error.verbosity == f_console_verbosity_verbose) {
+ if (main->data->parameters[controller_parameter_simulate].result == f_console_result_found || main->data->error.verbosity == f_console_verbosity_verbose) {
if (main->data->error.verbosity != f_console_verbosity_quiet) {
f_thread_mutex_lock(&main->thread->lock.print);
}
if (main->setting->ready == controller_setting_ready_wait) {
- if (main->data->parameters[controller_parameter_test].result == f_console_result_found || main->data->error.verbosity == f_console_verbosity_verbose) {
+ if (main->data->parameters[controller_parameter_simulate].result == f_console_result_found || main->data->error.verbosity == f_console_verbosity_verbose) {
if (main->data->error.verbosity != f_console_verbosity_quiet) {
f_thread_mutex_lock(&main->thread->lock.print);
}
}
- if (main->data->parameters[controller_parameter_test].result == f_console_result_none) {
+ if (main->data->parameters[controller_parameter_simulate].result == f_console_result_none) {
status = controller_perform_ready(is_entry, *main, cache);
if (F_status_is_error(status)) return status;
main->setting->ready = controller_setting_ready_yes;
}
- else if (main->data->parameters[controller_parameter_test].result == f_console_result_found || main->data->error.verbosity == f_console_verbosity_verbose) {
+ else if (main->data->parameters[controller_parameter_simulate].result == f_console_result_found || main->data->error.verbosity == f_console_verbosity_verbose) {
if (main->data->error.verbosity != f_console_verbosity_quiet) {
f_thread_mutex_lock(&main->thread->lock.print);
return status;
}
- if (main->data->parameters[controller_parameter_test].result == f_console_result_found || main->data->error.verbosity == f_console_verbosity_verbose) {
+ if (main->data->parameters[controller_parameter_simulate].result == f_console_result_found || main->data->error.verbosity == f_console_verbosity_verbose) {
if (main->data->error.verbosity != f_console_verbosity_quiet) {
f_thread_mutex_lock(&main->thread->lock.print);
f_thread_unlock(&main->thread->lock.rule);
- if (main->data->parameters[controller_parameter_test].result == f_console_result_found || main->data->error.verbosity == f_console_verbosity_verbose) {
+ if (main->data->parameters[controller_parameter_simulate].result == f_console_result_found || main->data->error.verbosity == f_console_verbosity_verbose) {
if (main->data->error.verbosity != f_console_verbosity_quiet) {
f_thread_mutex_lock(&main->thread->lock.print);
controller_print_unlock_flush(main->data->output.stream, &main->thread->lock.print);
}
- if (main->data->parameters[controller_parameter_test].result == f_console_result_none) {
+ if (main->data->parameters[controller_parameter_simulate].result == f_console_result_none) {
f_thread_unlock(&main->thread->lock.rule);
break;
options_force = 0;
options_process = 0;
- if (main->data->parameters[controller_parameter_test].result == f_console_result_found) {
+ if (main->data->parameters[controller_parameter_simulate].result == f_console_result_found) {
options_process |= controller_process_option_simulate;
}
break;
}
- if (F_status_is_error(status) && main->data->parameters[controller_parameter_test].result == f_console_result_none && (entry_action->code & controller_entry_rule_code_require)) {
+ if (F_status_is_error(status) && main->data->parameters[controller_parameter_simulate].result == f_console_result_none && (entry_action->code & controller_entry_rule_code_require)) {
return F_status_set_error(F_require);
}
}
}
else if (entry_action->type == controller_entry_action_type_execute) {
- if (main->data->parameters[controller_parameter_test].result == f_console_result_found || main->data->error.verbosity == f_console_verbosity_verbose) {
+ if (main->data->parameters[controller_parameter_simulate].result == f_console_result_found || main->data->error.verbosity == f_console_verbosity_verbose) {
if (main->data->error.verbosity != f_console_verbosity_quiet) {
f_thread_mutex_lock(&main->thread->lock.print);
}
}
- if (main->data->parameters[controller_parameter_test].result == f_console_result_found) {
+ if (main->data->parameters[controller_parameter_simulate].result == f_console_result_found) {
return F_execute;
}
}
else if (entry_action->type == controller_entry_action_type_timeout) {
- if (main->data->parameters[controller_parameter_test].result == f_console_result_found || main->data->error.verbosity == f_console_verbosity_verbose) {
+ if (main->data->parameters[controller_parameter_simulate].result == f_console_result_found || main->data->error.verbosity == f_console_verbosity_verbose) {
f_string_t code = "";
if (entry_action->code == controller_entry_timeout_code_kill) {
main->setting->failsafe_enabled = F_true;
main->setting->failsafe_item_id = entry_action->number;
- if (main->data->parameters[controller_parameter_test].result == f_console_result_found || main->data->error.verbosity == f_console_verbosity_verbose) {
+ if (main->data->parameters[controller_parameter_simulate].result == f_console_result_found || main->data->error.verbosity == f_console_verbosity_verbose) {
if (main->data->error.verbosity != f_console_verbosity_quiet) {
f_thread_mutex_lock(&main->thread->lock.print);
}
}
- if ((main->data->parameters[controller_parameter_test].result == f_console_result_found && main->data->error.verbosity != f_console_verbosity_quiet) || main->data->error.verbosity == f_console_verbosity_verbose) {
+ if ((main->data->parameters[controller_parameter_simulate].result == f_console_result_found && main->data->error.verbosity != f_console_verbosity_quiet) || main->data->error.verbosity == f_console_verbosity_verbose) {
f_thread_mutex_lock(&main->thread->lock.print);
fprintf(main->data->output.stream, "%c", f_string_eol_s[0]);
options_process = 0;
- if (main.data->parameters[controller_parameter_test].result == f_console_result_found) {
+ if (main.data->parameters[controller_parameter_simulate].result == f_console_result_found) {
options_process |= controller_process_option_simulate;
}
if (main->thread->enabled != controller_thread_enabled) return 0;
- const unsigned int interval = main->data->parameters[controller_parameter_test].result == f_console_result_found ? controller_thread_cleanup_interval_short : controller_thread_cleanup_interval_long;
+ const unsigned int interval = main->data->parameters[controller_parameter_simulate].result == f_console_result_found ? controller_thread_cleanup_interval_short : controller_thread_cleanup_interval_long;
f_status_t status = F_none;
}
if (F_status_is_error_not(*status) && *status != F_signal && *status != F_child) {
- if (data->parameters[controller_parameter_validate].result == f_console_result_none || data->parameters[controller_parameter_test].result == f_console_result_found) {
+ if (data->parameters[controller_parameter_validate].result == f_console_result_none || data->parameters[controller_parameter_simulate].result == f_console_result_found) {
if (f_file_exists(entry->setting->path_pid.string) == F_true) {
if (data->error.verbosity != f_console_verbosity_quiet) {
}
if (F_status_is_error_not(*status) && *status != F_signal && *status != F_child && *status != F_file_found_not) {
- if (data->parameters[controller_parameter_validate].result == f_console_result_none || data->parameters[controller_parameter_test].result == f_console_result_found) {
+ if (data->parameters[controller_parameter_validate].result == f_console_result_none || data->parameters[controller_parameter_simulate].result == f_console_result_found) {
*status = controller_process_entry(F_false, F_false, entry->main, cache);
# fss-0002
Simulate Documentation:
- This describes the intent and purpose of the simulation (and testing) parameters.
+ This describes the intent and purpose of the simulation and validation parameters.
The "controller" program is design to support being run as an alternative to an init program (such as Sysvinit or SystemD).
- To help prevent problems, testing and simulation functionality is provided.
+ To help prevent problems, simulation and validation functionality is provided.
- The "validate" functionality, by itself will simply check the syntax of the Entry and Rule files (for Rule files specified in the Entry file).
+ The "validate" functionality, by itself will simply check the syntax of the Entry and Rule files (for Rule files specified in the Entry or Exit file).
Errors are reported and nothing is executed.
The "controller" program will return 0 on validation success and 1 on validation failure.
- The "test" functionality, by itself will perform a simulated execution of all Rules designated by an Entry file.
+ The "simulate" functionality, by itself will perform a simulated execution of all Rules designated by an Entry or Exit file.
The simulation is not a true simulation in that no program is ever called to perform any operations.
Furthermore, any "script" specified inside a Rule is only simulated as a whole and not its individual parts.
- Once the Entry file is finished executing, the "test" will continue to run waiting on "control" commands.
+ Once the Entry file is finished executing, the "simulate" will continue to run waiting on "control" commands.
- The "test" functionality, when specified along with the "validate" functionality, will perform similar to "validate" functionality except that additional information of the Rules to be executed will be printed.
- There will be neither execution nor simulated execution of any Rule when both "test" and "validate" are used togethor.
+ The "simulate" functionality, when specified along with the "validate" functionality, will perform similar to "validate" functionality except that additional information of the Rules to be executed will be printed.
+ There will be neither execution nor simulated execution of any Rule when both "simulate" and "validate" are used together.
When a Rule is simulated, an empty script command (generally defaulting to "bash") is executed in place of the actual program being executed for each program or script in the Rule file that is to be executed.
This allows for testing the designated permissions and other settings that would be applied when calling some program.