Compare the shots directly after the test to speed up
The problem that we try to solve is the time taken to compare the shots after all the scenarios have been run. Now, comparing the shots sequentially is done right after the test finished to run. With -j 1, it won't change anything. With more CPUs, it will compare while other tests are running, i.e when the CPU is not too much busy.
This commit is contained in:
parent
a1341ac74c
commit
7337672562
|
@ -57,169 +57,6 @@ _printf(int verbose, const char *fmt, ...)
|
|||
va_end(ap);
|
||||
}
|
||||
|
||||
#define CONFIG "ELM_SCALE=1 ELM_FINGER_SIZE=10"
|
||||
static Eina_Bool
|
||||
_run_command_prepare(const List_Entry *ent, char *buf)
|
||||
{
|
||||
char scn_path[EXACTNESS_PATH_MAX];
|
||||
Eina_Strbuf *sbuf;
|
||||
const char *base_dir;
|
||||
Eina_List *itr;
|
||||
Eina_Bool is_exu;
|
||||
EINA_LIST_FOREACH(_base_dirs, itr, base_dir)
|
||||
{
|
||||
is_exu = EINA_TRUE;
|
||||
sprintf(scn_path, "%s/%s.exu", base_dir, ent->name);
|
||||
if (ecore_file_exists(scn_path)) goto ok;
|
||||
else
|
||||
{
|
||||
is_exu = EINA_FALSE;
|
||||
sprintf(scn_path, "%s/%s.rec", base_dir, ent->name);
|
||||
if (ecore_file_exists(scn_path)) goto ok;
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "Test %s not found in the provided base directories\n", ent->name);
|
||||
return EINA_FALSE;
|
||||
ok:
|
||||
sbuf = eina_strbuf_new();
|
||||
eina_strbuf_append_printf(sbuf,
|
||||
"%s %s exactness_play %s %s%.*s %s-t '%s' ",
|
||||
CONFIG, _wrap_command ? _wrap_command : "",
|
||||
_mode == RUN_SIMULATION ? "-s" : "",
|
||||
_verbose ? "-" : "", _verbose, "vvvvvvvvvv",
|
||||
_scan_objs ? "--scan-objects " : "",
|
||||
scn_path
|
||||
);
|
||||
if (is_exu)
|
||||
{
|
||||
if (_mode == RUN_PLAY)
|
||||
eina_strbuf_append_printf(sbuf, "-o '%s/%s/%s.exu' -- ", _dest_dir, CURRENT_SUBDIR, ent->name);
|
||||
if (_mode == RUN_INIT)
|
||||
eina_strbuf_append_printf(sbuf, "-o '%s/%s.exu' -- ", _dest_dir, ent->name);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_mode == RUN_PLAY)
|
||||
eina_strbuf_append_printf(sbuf, "-o '%s/%s' -- ", _dest_dir, CURRENT_SUBDIR);
|
||||
if (_mode == RUN_INIT)
|
||||
eina_strbuf_append_printf(sbuf, "-o '%s/%s' -- ", _dest_dir, ORIG_SUBDIR);
|
||||
}
|
||||
eina_strbuf_append(sbuf, ent->command);
|
||||
strncpy(buf, eina_strbuf_string_get(sbuf), SCHEDULER_CMD_SIZE-1);
|
||||
eina_strbuf_free(sbuf);
|
||||
_printf(1, "Command: %s\n", buf);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_check_prefix(const char *prefix, const char *name)
|
||||
{
|
||||
unsigned int len = strlen(prefix);
|
||||
return (!strncmp(name, prefix, len) && (strlen(name) > len) && (name[len] == SHOT_DELIMITER));
|
||||
}
|
||||
|
||||
static void
|
||||
_prefix_rm_cb(const char *name, const char *path, void *data)
|
||||
{
|
||||
const char *prefix = data;
|
||||
if (_check_prefix(prefix, name))
|
||||
{
|
||||
char buf[EXACTNESS_PATH_MAX];
|
||||
snprintf(buf, EXACTNESS_PATH_MAX, "%s/%s", path, name);
|
||||
if (unlink(buf))
|
||||
{
|
||||
printf("Failed deleting '%s/%s': ", path, name);
|
||||
perror("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_run_test_prefix_rm(const char *dir, const char *prefix)
|
||||
{
|
||||
eina_file_dir_list(dir, 0, _prefix_rm_cb, (void *) prefix);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_job_deleted_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
|
||||
{
|
||||
Ecore_Exe_Event_Del *msg = (Ecore_Exe_Event_Del *) event;
|
||||
|
||||
if ((msg->exit_code != 0) || (msg->exit_signal != 0))
|
||||
{
|
||||
List_Entry *ent = ecore_exe_data_get(msg->exe);
|
||||
_errors = eina_list_append(_errors, ent);
|
||||
}
|
||||
|
||||
_running_jobs--;
|
||||
|
||||
_job_consume();
|
||||
|
||||
/* If all jobs are done. */
|
||||
if (!_running_jobs)
|
||||
{
|
||||
ecore_main_loop_quit();
|
||||
return ECORE_CALLBACK_DONE;
|
||||
}
|
||||
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_job_consume()
|
||||
{
|
||||
static Ecore_Event_Handler *job_del_callback_handler = NULL;
|
||||
char buf[SCHEDULER_CMD_SIZE];
|
||||
List_Entry *ent = _next_test_to_run;
|
||||
|
||||
if (_running_jobs == _max_jobs) return EINA_FALSE;
|
||||
if (!ent) return EINA_FALSE;
|
||||
|
||||
if (_run_command_prepare(ent, buf))
|
||||
{
|
||||
_running_jobs++;
|
||||
_tests_executed++;
|
||||
|
||||
switch (_mode)
|
||||
{
|
||||
case RUN_PLAY:
|
||||
{
|
||||
_run_test_prefix_rm(CURRENT_SUBDIR, ent->name);
|
||||
_printf(1, "Running %s\n", ent->name);
|
||||
break;
|
||||
}
|
||||
case RUN_INIT:
|
||||
{
|
||||
_run_test_prefix_rm(ORIG_SUBDIR, ent->name);
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
|
||||
if (!job_del_callback_handler)
|
||||
{
|
||||
job_del_callback_handler = ecore_event_handler_add(ECORE_EXE_EVENT_DEL,
|
||||
_job_deleted_cb, NULL);
|
||||
}
|
||||
|
||||
if (!ecore_exe_pipe_run(buf, ECORE_EXE_TERM_WITH_PARENT, ent))
|
||||
{
|
||||
fprintf(stderr, "Failed executing test '%s'\n", ent->name);
|
||||
}
|
||||
}
|
||||
_next_test_to_run = EINA_INLIST_CONTAINER_GET(
|
||||
EINA_INLIST_GET(ent)->next, List_Entry);
|
||||
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
_scheduler_run()
|
||||
{
|
||||
while (_job_consume());
|
||||
}
|
||||
|
||||
static Exactness_Image *
|
||||
_image_load(const char *filename)
|
||||
{
|
||||
|
@ -359,6 +196,175 @@ found:
|
|||
} while (EINA_TRUE);
|
||||
}
|
||||
|
||||
#define CONFIG "ELM_SCALE=1 ELM_FINGER_SIZE=10"
|
||||
static Eina_Bool
|
||||
_run_command_prepare(const List_Entry *ent, char *buf)
|
||||
{
|
||||
char scn_path[EXACTNESS_PATH_MAX];
|
||||
Eina_Strbuf *sbuf;
|
||||
const char *base_dir;
|
||||
Eina_List *itr;
|
||||
Eina_Bool is_exu;
|
||||
EINA_LIST_FOREACH(_base_dirs, itr, base_dir)
|
||||
{
|
||||
is_exu = EINA_TRUE;
|
||||
sprintf(scn_path, "%s/%s.exu", base_dir, ent->name);
|
||||
if (ecore_file_exists(scn_path)) goto ok;
|
||||
else
|
||||
{
|
||||
is_exu = EINA_FALSE;
|
||||
sprintf(scn_path, "%s/%s.rec", base_dir, ent->name);
|
||||
if (ecore_file_exists(scn_path)) goto ok;
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "Test %s not found in the provided base directories\n", ent->name);
|
||||
return EINA_FALSE;
|
||||
ok:
|
||||
sbuf = eina_strbuf_new();
|
||||
eina_strbuf_append_printf(sbuf,
|
||||
"%s %s exactness_play %s %s%.*s %s-t '%s' ",
|
||||
CONFIG, _wrap_command ? _wrap_command : "",
|
||||
_mode == RUN_SIMULATION ? "-s" : "",
|
||||
_verbose ? "-" : "", _verbose, "vvvvvvvvvv",
|
||||
_scan_objs ? "--scan-objects " : "",
|
||||
scn_path
|
||||
);
|
||||
if (is_exu)
|
||||
{
|
||||
if (_mode == RUN_PLAY)
|
||||
eina_strbuf_append_printf(sbuf, "-o '%s/%s/%s.exu' -- ", _dest_dir, CURRENT_SUBDIR, ent->name);
|
||||
if (_mode == RUN_INIT)
|
||||
eina_strbuf_append_printf(sbuf, "-o '%s/%s.exu' -- ", _dest_dir, ent->name);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_mode == RUN_PLAY)
|
||||
eina_strbuf_append_printf(sbuf, "-o '%s/%s' -- ", _dest_dir, CURRENT_SUBDIR);
|
||||
if (_mode == RUN_INIT)
|
||||
eina_strbuf_append_printf(sbuf, "-o '%s/%s' -- ", _dest_dir, ORIG_SUBDIR);
|
||||
}
|
||||
eina_strbuf_append(sbuf, ent->command);
|
||||
strncpy(buf, eina_strbuf_string_get(sbuf), SCHEDULER_CMD_SIZE-1);
|
||||
eina_strbuf_free(sbuf);
|
||||
_printf(1, "Command: %s\n", buf);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_check_prefix(const char *prefix, const char *name)
|
||||
{
|
||||
unsigned int len = strlen(prefix);
|
||||
return (!strncmp(name, prefix, len) && (strlen(name) > len) && (name[len] == SHOT_DELIMITER));
|
||||
}
|
||||
|
||||
static void
|
||||
_prefix_rm_cb(const char *name, const char *path, void *data)
|
||||
{
|
||||
const char *prefix = data;
|
||||
if (_check_prefix(prefix, name))
|
||||
{
|
||||
char buf[EXACTNESS_PATH_MAX];
|
||||
snprintf(buf, EXACTNESS_PATH_MAX, "%s/%s", path, name);
|
||||
if (unlink(buf))
|
||||
{
|
||||
printf("Failed deleting '%s/%s': ", path, name);
|
||||
perror("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_run_test_prefix_rm(const char *dir, const char *prefix)
|
||||
{
|
||||
eina_file_dir_list(dir, 0, _prefix_rm_cb, (void *) prefix);
|
||||
}
|
||||
|
||||
static void
|
||||
_job_compare(void *data)
|
||||
{
|
||||
_run_test_compare(data);
|
||||
|
||||
/* If all jobs are done. */
|
||||
if (!_running_jobs) ecore_main_loop_quit();
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_job_deleted_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
|
||||
{
|
||||
Ecore_Exe_Event_Del *msg = (Ecore_Exe_Event_Del *) event;
|
||||
List_Entry *ent = ecore_exe_data_get(msg->exe);
|
||||
|
||||
if ((msg->exit_code != 0) || (msg->exit_signal != 0))
|
||||
{
|
||||
_errors = eina_list_append(_errors, ent);
|
||||
}
|
||||
|
||||
ecore_job_add(_job_compare, ent);
|
||||
_running_jobs--;
|
||||
|
||||
_job_consume();
|
||||
|
||||
/* If all jobs are done. */
|
||||
if (!_running_jobs) return ECORE_CALLBACK_DONE;
|
||||
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_job_consume()
|
||||
{
|
||||
static Ecore_Event_Handler *job_del_callback_handler = NULL;
|
||||
char buf[SCHEDULER_CMD_SIZE];
|
||||
List_Entry *ent = _next_test_to_run;
|
||||
|
||||
if (_running_jobs == _max_jobs) return EINA_FALSE;
|
||||
if (!ent) return EINA_FALSE;
|
||||
|
||||
if (_run_command_prepare(ent, buf))
|
||||
{
|
||||
_running_jobs++;
|
||||
_tests_executed++;
|
||||
|
||||
switch (_mode)
|
||||
{
|
||||
case RUN_PLAY:
|
||||
{
|
||||
_run_test_prefix_rm(CURRENT_SUBDIR, ent->name);
|
||||
_printf(1, "Running %s\n", ent->name);
|
||||
break;
|
||||
}
|
||||
case RUN_INIT:
|
||||
{
|
||||
_run_test_prefix_rm(ORIG_SUBDIR, ent->name);
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
|
||||
if (!job_del_callback_handler)
|
||||
{
|
||||
job_del_callback_handler = ecore_event_handler_add(ECORE_EXE_EVENT_DEL,
|
||||
_job_deleted_cb, NULL);
|
||||
}
|
||||
|
||||
if (!ecore_exe_pipe_run(buf, ECORE_EXE_TERM_WITH_PARENT, ent))
|
||||
{
|
||||
fprintf(stderr, "Failed executing test '%s'\n", ent->name);
|
||||
}
|
||||
}
|
||||
_next_test_to_run = EINA_INLIST_CONTAINER_GET(
|
||||
EINA_INLIST_GET(ent)->next, List_Entry);
|
||||
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
_scheduler_run()
|
||||
{
|
||||
while (_job_consume());
|
||||
}
|
||||
|
||||
static List_Entry *
|
||||
_list_file_load(const char *filename)
|
||||
{
|
||||
|
@ -582,7 +588,7 @@ main(int argc, char *argv[])
|
|||
|
||||
/* Results */
|
||||
printf("*******************************************************\n");
|
||||
if (mode_play)
|
||||
if (mode_play && EINA_FALSE)
|
||||
{
|
||||
List_Entry *list_itr;
|
||||
|
||||
|
|
Loading…
Reference in New Issue