Ejemplo n.º 1
0
/* reads in all status data */
int read_status_data(const char *cfgfile, int options) {
	int result = OK;

	/**** IMPLEMENTATION-SPECIFIC CALLS ****/
#ifdef USE_XSDDEFAULT
	result = xsddefault_read_status_data(cfgfile, options);
#endif

	return result;
	}
Ejemplo n.º 2
0
int main(int argc, char **argv) {
	int result;
	int c;
	int last_id;
	time_t last_time;
	comment *temp_comment;
	scheduled_downtime *temp_downtime;

	plan_tests(7);

	chdir("../t");

	ok(system("cat var/status.dat > var/status-generated.dat") == 0, "New status.dat file");
	ok(system("bin/generate_downtimes 10 >> var/status-generated.dat") == 0, "Generated 10 downtimes");

	result = xsddefault_read_status_data("etc/cgi-with-generated-status.cfg", 0);
	ok(result == OK, "Read cgi status data okay");

	temp_comment = comment_list;
	last_id = 0;
	c = 0;
	result = OK;
	while (temp_comment != NULL) {
		c++;
		if (temp_comment->comment_id <= last_id) {
			result = ERROR;
			break;
		}
		last_id = temp_comment->comment_id;
		temp_comment = temp_comment->next;
	}
	ok(c == 12, "Got %d comments - expected 12", c);
	ok(result == OK, "All comments in order");

	temp_downtime = scheduled_downtime_list;
	last_time = 0;
	c = 0;
	result = OK;
	while (temp_downtime != NULL) {
		c++;
		if (temp_downtime->start_time < last_time) {
			result = ERROR;
			break;
		}
		last_time = temp_downtime->start_time;
		temp_downtime = temp_downtime->next;
	}
	ok(c == 20, "Got %d downtimes - expected 20", c);
	ok(result == OK, "All downtimes in order");

	return exit_status();
}
Ejemplo n.º 3
0
/* reads in all status data */
int read_status_data(const char *status_file_name, int options) {
	return xsddefault_read_status_data(status_file_name, options);
	}