int main(void)
  {
  int number_failed = 0;
  SRunner *sr = NULL;
  rundebug();
  sr = srunner_create(req_deletearray_suite());
  srunner_set_log(sr, "req_deletearray_suite.log");
  srunner_run_all(sr, CK_NORMAL);
  number_failed = srunner_ntests_failed(sr);
  srunner_free(sr);
  return number_failed;
  }
Beispiel #2
0
int main(void)
  {
  int number_failed = 0;
  SRunner *sr = NULL;
  rundebug();
  sr = srunner_create(user_info_suite());
  srunner_set_log(sr, "user_info_suite.log");
  srunner_run_all(sr, CK_NORMAL);
  number_failed = srunner_ntests_failed(sr);
  srunner_free(sr);
  return(number_failed);
  }
Beispiel #3
0
int main(void)
  {
  int number_failed = 0;
  SRunner *sr = NULL;
  rundebug();
  sr = srunner_create(mom_process_request_suite());
  srunner_set_log(sr, "mom_process_request_suite.log");
  srunner_run_all(sr, CK_NORMAL);
  number_failed = srunner_ntests_failed(sr);
  srunner_free(sr);
  return number_failed;
  }
Beispiel #4
0
int main(void)
  {
  int number_failed = 0;
  SRunner *sr = NULL;
  rundebug();
  sr = srunner_create(PBSD_gpuctrl2_suite());
  srunner_set_log(sr, "PBSD_gpuctrl2_suite.log");
  srunner_run_all(sr, CK_NORMAL);
  number_failed = srunner_ntests_failed(sr);
  srunner_free(sr);
  return number_failed;
  }
Beispiel #5
0
int main(void)
  {
  int number_failed = 0;
  SRunner *sr = NULL;
  server.sv_attr_mutex = (pthread_mutex_t *)calloc(1, sizeof(pthread_mutex_t));
  rundebug();
  sr = srunner_create(req_quejob_suite());
  srunner_set_log(sr, "req_quejob_suite.log");
  srunner_run_all(sr, CK_NORMAL);
  number_failed = srunner_ntests_failed(sr);
  srunner_free(sr);
  return number_failed;
  }
Beispiel #6
0
int main(void)
  {
  int number_failed = 0;
  SRunner *sr = NULL;
  init_server();
  rundebug();
  sr = srunner_create(svr_mail_suite());
  srunner_set_log(sr, "svr_mail_suite.log");
  srunner_run_all(sr, CK_NORMAL);
  number_failed = srunner_ntests_failed(sr);
  srunner_free(sr);
  return number_failed;
  }
Beispiel #7
0
int main(void)
  {
  int number_failed = 0;
  SRunner *sr = NULL;
  exiting_jobs_info = (hash_map *)calloc(1, sizeof(hash_map));
  exiting_jobs_info->hm_mutex = (pthread_mutex_t *)calloc(1, sizeof(pthread_mutex_t));
  rundebug();
  sr = srunner_create(exiting_jobs_suite());
  srunner_set_log(sr, "exiting_jobs_suite.log");
  srunner_run_all(sr, CK_NORMAL);
  number_failed = srunner_ntests_failed(sr);
  srunner_free(sr);
  return(number_failed);
  }
Beispiel #8
0
int main(void)
  {
  int number_failed = 0;
  svr_do_schedule_mutex = (pthread_mutex_t *)calloc(1, sizeof(pthread_mutex_t));
  listener_command_mutex = (pthread_mutex_t *)calloc(1, sizeof(pthread_mutex_t));
  pthread_mutex_init(svr_do_schedule_mutex, NULL);
  pthread_mutex_init(listener_command_mutex, NULL);
  SRunner *sr = NULL;
  init_server();
  rundebug();
  sr = srunner_create(req_jobobit_suite());
  srunner_set_log(sr, "req_jobobit_suite.log");
  srunner_run_all(sr, CK_NORMAL);
  number_failed = srunner_ntests_failed(sr);
  srunner_free(sr);
  return number_failed;
  }
Beispiel #9
0
int main(void)
  {
  int number_failed = 0;
  SRunner *sr = NULL;

#ifdef NUMA_SUPPORT
  node_boards[0].mic_start_index = 0;
  node_boards[1].mic_start_index = 2;
  node_boards[2].mic_start_index = 4;
#endif

  rundebug();
  sr = srunner_create(start_exec_suite());
  srunner_set_log(sr, "start_exec_suite.log");
  srunner_run_all(sr, CK_NORMAL);
  number_failed = srunner_ntests_failed(sr);
  srunner_free(sr);
  return number_failed;
  }
Beispiel #10
0
void run_file(int name_len, char const *name, int probe_name_len, char const *probename, bool start, double sina, double cosa, int audio) {
	rundebug("run file %d %f %f", start, sina, cosa);
	abort_run_file();
	if (name_len == 0)
		return;
	strncpy(run_file_name, name, name_len);
	run_file_name[name_len] = '\0';
	strncpy(probe_file_name, probename, probe_name_len);
	probe_file_name[probe_name_len] = '\0';
	settings.run_time = 0;
	settings.run_dist = 0;
	settings.run_file_current = 0;
	int probe_fd;
	if (probe_name_len > 0) {
		probe_fd = open(probe_file_name, O_RDONLY);
		if (probe_fd < 0) {
			debug("Failed to open probe file '%s': %s", probe_file_name, strerror(errno));
			return;
		}
		struct stat stat;
		if (fstat(probe_fd, &stat) < 0) {
			debug("Failed to stat probe file '%s': %s", probe_file_name, strerror(errno));
			close(probe_fd);
			return;
		}
		probe_file_size = stat.st_size;
		if (probe_file_size < sizeof(ProbeFile)) {
			debug("Probe file too short");
			close(probe_fd);
			return;
		}
	}
	int fd = open(run_file_name, O_RDONLY);
	if (fd < 0) {
		debug("Failed to open run file '%s': %s", run_file_name, strerror(errno));
		if (probe_name_len > 0)
			close(probe_fd);
		return;
	}
	struct stat stat;
	if (fstat(fd, &stat) < 0) {
		debug("Failed to stat run file '%s': %s", run_file_name, strerror(errno));
		close(fd);
		if (probe_name_len > 0)
			close(probe_fd);
		return;
	}
	run_file_size = stat.st_size;
	run_file_map = reinterpret_cast<Run_Record *>(mmap(NULL, run_file_size, PROT_READ, MAP_SHARED, fd, 0));
	close(fd);
	if (probe_name_len > 0) {
		probe_file_map = reinterpret_cast<ProbeFile *>(mmap(NULL, probe_file_size, PROT_READ, MAP_SHARED, probe_fd, 0));
		close(probe_fd);
		if (((probe_file_map->nx + 1) * (probe_file_map->ny + 1)) * sizeof(double) + sizeof(ProbeFile) != probe_file_size) {
			debug("Invalid probe file size %ld != %ld", probe_file_size, ((probe_file_map->nx + 1) * (probe_file_map->ny + 1)) * sizeof(double) + sizeof(ProbeFile));
			munmap(probe_file_map, probe_file_size);
			munmap(run_file_map, run_file_size);
			probe_file_map = NULL;
			run_file_map = NULL;
			return;
		}
	}
	else
		probe_file_map = NULL;
	if (audio < 0) {
		// File format:
		// records
		// strings
		// int32_t stringlengths[]
		// int32_t numstrings
		// double bbox[8]
		run_file_num_strings = read_num(run_file_size - sizeof(double) * 8 - sizeof(int32_t));
		strings = reinterpret_cast<String *>(malloc(run_file_num_strings * sizeof(String)));
		off_t pos = run_file_size - sizeof(double) * 8 - sizeof(int32_t) - sizeof(int32_t) * run_file_num_strings;
		off_t current = 0;
		for (int i = 0; i < run_file_num_strings; ++i) {
			strings[i].start = current;
			strings[i].len = read_num(pos + sizeof(int32_t) * i);
			current += strings[i].len;
		}
		run_file_first_string = pos - current;
		run_file_num_records = run_file_first_string / sizeof(Run_Record);
	}
	else {
		audio_hwtime_step = 1000000. / *reinterpret_cast <double *>(run_file_map);
		run_file_num_records = run_file_size - sizeof(double);
	}
	run_file_wait_temp = 0;
	run_file_wait = start ? 0 : 1;
	run_file_timer.it_interval.tv_sec = 0;
	run_file_timer.it_interval.tv_nsec = 0;
	run_file_refx = targetx;
	run_file_refy = targety;
	probe_adjust = 0;
	//debug("run target %f %f", targetx, targety);
	run_file_sina = sina;
	run_file_cosa = cosa;
	run_file_audio = audio;
	run_preline.X = NAN;
	run_preline.Y = NAN;
	run_preline.Z = NAN;
	run_preline.E = NAN;
	run_file_fill_queue();
}
Beispiel #11
0
void run_file_fill_queue() {
	static bool lock = false;
	if (lock)
		return;
	lock = true;
	rundebug("run queue, wait = %d tempwait = %d q = %d %d %d finish = %d", run_file_wait, run_file_wait_temp, settings.queue_end, settings.queue_start, settings.queue_full, run_file_finishing);
	if (run_file_audio >= 0) {
		while (true) {
			if (!run_file_map || run_file_wait || run_file_finishing)
				break;
			if (settings.run_file_current >= run_file_num_records) {
				run_file_finishing = true;
				//debug("done running audio");
				break;
			}
			int16_t next = (current_fragment + 1) % FRAGMENTS_PER_BUFFER;
			if (next == running_fragment)
				break;
			settings.run_file_current = arch_send_audio(&reinterpret_cast <uint8_t *>(run_file_map)[sizeof(double)], settings.run_file_current, run_file_num_records, run_file_audio);
			current_fragment = next;
			store_settings();
			if ((current_fragment - running_fragment + FRAGMENTS_PER_BUFFER) % FRAGMENTS_PER_BUFFER >= MIN_BUFFER_FILL && !stopping)
				arch_start_move(0);
		}
		lock = false;
		return;
	}
	while (run_file_map	// There is a file to run.
			&& (settings.queue_end - settings.queue_start + QUEUE_LENGTH) % QUEUE_LENGTH < 4	// There is space in the queue.
			&& !settings.queue_full	// Really, there is space in the queue.
			&& settings.run_file_current < run_file_num_records	// There are records to send.
			&& !run_file_wait_temp	// We are not waiting for a temp alarm.
			&& !run_file_wait	// We are not waiting for something else (pause or confirm).
			&& !run_file_finishing) {	// We are not waiting for underflow (should be impossible anyway, if there are commands in the queue).
		int t = run_file_map[settings.run_file_current].type;
		if (t != RUN_LINE && t != RUN_PRE_LINE && t != RUN_PRE_ARC && t != RUN_ARC && (arch_running() || settings.queue_end != settings.queue_start || computing_move))
			break;
		Run_Record &r = run_file_map[settings.run_file_current];
		rundebug("running %d: %d %d", settings.run_file_current, r.type, r.tool);
		switch (r.type) {
			case RUN_SYSTEM:
			{
				char const *cmd = strndupa(&reinterpret_cast<char const *>(run_file_map)[run_file_first_string + strings[r.tool].start], strings[r.tool].len);
				debug("Running system command: %ld %d %s", strings[r.tool].start, strings[r.tool].len, cmd);
				int ret = system(cmd);
				debug("Done running system command, return = %d", ret);
				break;
			}
			case RUN_PRE_ARC:
			{
				double x = r.X * run_file_cosa - r.Y * run_file_sina + run_file_refx;
				double y = r.Y * run_file_cosa + r.X * run_file_sina + run_file_refy;
				double z = r.Z;
				//debug("line %f %f %f", x, y, z);
				queue[settings.queue_end].center[0] = x;
				queue[settings.queue_end].center[1] = y;
				queue[settings.queue_end].center[2] = handle_probe(x, y, z);
				queue[settings.queue_end].normal[0] = r.E;
				queue[settings.queue_end].normal[1] = r.f;
				queue[settings.queue_end].normal[2] = r.F;
				break;
			}
			case RUN_PRE_LINE:
			{
				run_preline.X = r.X;
				run_preline.Y = r.Y;
				run_preline.Z = r.Z;
				run_preline.E = r.E;
				run_preline.tool = r.tool;
				break;
			}
			case RUN_LINE:
			case RUN_ARC:
			{
				queue[settings.queue_end].single = false;
				queue[settings.queue_end].probe = false;
				queue[settings.queue_end].arc = r.type == RUN_ARC;
				queue[settings.queue_end].f[0] = r.f;
				queue[settings.queue_end].f[1] = r.F;
				double x = r.X * run_file_cosa - r.Y * run_file_sina + run_file_refx;
				double y = r.Y * run_file_cosa + r.X * run_file_sina + run_file_refy;
				double z = r.Z;
				//debug("line/arc %f %f %f", x, y, z);
				int num0 = spaces[0].num_axes;
				if (num0 > 0) {
					queue[settings.queue_end].data[0] = x;
					if (num0 > 1) {
						queue[settings.queue_end].data[1] = y;
						if (num0 > 2) {
							queue[settings.queue_end].data[2] = handle_probe(x, y, z);
							if (num0 > 3) {
								queue[settings.queue_end].data[3] = run_preline.X;
								if (num0 > 4) {
									queue[settings.queue_end].data[4] = run_preline.Y;
									if (num0 > 5) {
										queue[settings.queue_end].data[5] = run_preline.Z;
									}
								}
								run_preline.X = NAN;
								run_preline.Y = NAN;
								run_preline.Z = NAN;
							}
						}
					}
				}
				for (int i = 6; i < num0; ++i)
					queue[settings.queue_end].data[i] = NAN;
				for (int i = 0; i < spaces[1].num_axes; ++i) {
					queue[settings.queue_end].data[num0 + i] = (i == r.tool ? r.E : i == run_preline.tool ? run_preline.E : NAN);
					//debug("queue %d + %d = %f", num0, i, queue[settings.queue_end].data[num0 + i]);
				}
				run_preline.E = NAN;
				num0 += spaces[1].num_axes;
				for (int s = 2; s < NUM_SPACES; ++s) {
					for (int i = 0; i < spaces[s].num_axes; ++i)
						queue[settings.queue_end].data[num0 + i] = NAN;
					num0 += spaces[s].num_axes;
				}
				queue[settings.queue_end].time = r.time;
				queue[settings.queue_end].dist = r.dist;
				queue[settings.queue_end].cb = false;
				settings.queue_end = (settings.queue_end + 1) % QUEUE_LENGTH;
				if (!computing_move)
					next_move();
				else
					rundebug("no");
				buffer_refill();
				break;
			}
			case RUN_GPIO:
			{
				int tool = r.tool;
				if (tool == -2)
					tool = fan_id;
				else if (tool == -3)
					tool = spindle_id;
				if (tool < 0 || tool >= num_gpios) {
					if (tool != -1)
						debug("cannot set invalid gpio %d", tool);
					break;
				}
				if (r.X) {
					gpios[tool].state = 1;
					SET(gpios[tool].pin);
				}
				else {
					gpios[tool].state = 0;
					RESET(gpios[tool].pin);
				}
				send_host(CMD_UPDATE_PIN, tool, gpios[tool].state);
				break;
			}
			case RUN_SETTEMP:
			{
				int tool = r.tool;
				if (tool == -1)
					tool = bed_id;
				rundebug("settemp %d %f", tool, r.X);
				settemp(tool, r.X);
				send_host(CMD_UPDATE_TEMP, tool, 0, r.X);
				break;
			}
			case RUN_WAITTEMP:
			{
				int tool = r.tool;
				if (tool == -2)
					tool = bed_id;
				if (tool == -3) {
					for (int i = 0; i < num_temps; ++i) {
						if (temps[i].min_alarm >= 0 || temps[i].max_alarm < MAXINT) {
							run_file_wait_temp += 1;
							waittemp(i, temps[i].min_alarm, temps[i].max_alarm);
						}
					}
					break;
				}
				if (tool < 0 || tool >= num_temps) {
					if (tool != -1)
						debug("cannot wait for invalid temp %d", tool);
					break;
				}
				else
					rundebug("waittemp %d", tool);
				if (temps[tool].adctarget[0] >= 0 && temps[tool].adctarget[0] < MAXINT) {
					rundebug("waiting");
					run_file_wait_temp += 1;
					waittemp(tool, temps[tool].target[0], temps[tool].max_alarm);
				}
				else
					rundebug("not waiting");
				break;
			}
			case RUN_SETPOS:
				if (r.tool >= spaces[1].num_axes) {
					debug("Not setting position of invalid extruder %d", r.tool);
					break;
				}
				setpos(1, r.tool, r.X);
				break;
			case RUN_WAIT:
				if (r.X > 0) {
					run_file_timer.it_value.tv_sec = r.X;
					run_file_timer.it_value.tv_nsec = (r.X - run_file_timer.it_value.tv_sec) * 1e9;
					run_file_wait += 1;
					timerfd_settime(pollfds[0].fd, 0, &run_file_timer, NULL);
				}
				break;
			case RUN_CONFIRM:
			{
				int len = min(strings[r.tool].len, 250);
				memcpy(datastore, &reinterpret_cast<char const *>(run_file_map)[run_file_first_string + strings[r.tool].start], len);
				run_file_wait += 1;
				send_host(CMD_CONFIRM, r.X ? 1 : 0, 0, 0, 0, len);
				break;
			}
			case RUN_PARK:
				run_file_wait += 1;
				send_host(CMD_PARKWAIT);
				break;
			default:
				debug("Invalid record type %d in %s", r.type, run_file_name);
				break;
		}
		settings.run_file_current += 1;
	}
	rundebug("run queue done");
	if (run_file_map && settings.run_file_current >= run_file_num_records && !run_file_wait_temp && !run_file_wait && !run_file_finishing) {
		// Done.
		//debug("done running file");
		if (!computing_move && !sending_fragment && !arch_running()) {
			send_host(CMD_FILE_DONE);
			abort_run_file();
		}
		else
			run_file_finishing = true;
	}
	lock = false;
	return;
}