Introduce a new player not using LD_PRELOAD
To make Exactness portable, LD_PRELOAD needs to be replaced by other mechanisms.
This commit is contained in:
parent
7c10de63e3
commit
7a4e7f2e55
|
@ -1,2 +1,4 @@
|
|||
/exactness
|
||||
/exactness_helper
|
||||
/exactness_play
|
||||
/exactness_canvas.eo.*
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
bin_PROGRAMS = exactness exactness_helper
|
||||
bin_PROGRAMS = exactness exactness_helper exactness_play
|
||||
|
||||
exactness_SOURCES = \
|
||||
exactness.c \
|
||||
|
@ -11,12 +11,16 @@ exactness_SOURCES = \
|
|||
|
||||
exactness_helper_SOURCES = exactness_helper.c
|
||||
|
||||
exactness_play_SOURCES = player.c ../lib/tsuite_file_data.c ../lib/tsuite_common.c
|
||||
|
||||
exactness_LDADD = \
|
||||
@EFL_LIBS@ ../lib/libexactness_player.la
|
||||
|
||||
exactness_helper_LDADD = \
|
||||
@EFL_LIBS@ ../lib/libexactness_player.la
|
||||
|
||||
exactness_play_LDADD = @EFL_LIBS@
|
||||
|
||||
exactness_CFLAGS = \
|
||||
@EFL_CFLAGS@ \
|
||||
-I$(top_srcdir)/src/lib \
|
||||
|
@ -24,3 +28,5 @@ exactness_CFLAGS = \
|
|||
-DPACKAGE_DATADIR=\"$(datadir)\"
|
||||
|
||||
exactness_helper_CFLAGS = @EFL_CFLAGS@ -I$(top_srcdir)/src/lib
|
||||
|
||||
exactness_play_CFLAGS = @EFL_CFLAGS@ -I$(top_srcdir)/src/lib
|
||||
|
|
|
@ -0,0 +1,611 @@
|
|||
#define _GNU_SOURCE 1
|
||||
#define EFL_EO_API_SUPPORT
|
||||
#define EFL_BETA_API_SUPPORT
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <getopt.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysinfo.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include <Eina.h>
|
||||
#include <Eo.h>
|
||||
#include <Evas.h>
|
||||
#include <Ecore.h>
|
||||
#include <Ecore_File.h>
|
||||
#include <Ecore_Con.h>
|
||||
#include <Elementary.h>
|
||||
//#include <Ecore_Evas.h>
|
||||
|
||||
#include "tsuite_file_data.h"
|
||||
#include "exactness_private.h"
|
||||
|
||||
#define MAX_PATH 1024
|
||||
#define IMAGE_FILENAME_EXT ".png"
|
||||
|
||||
static const char *_dest_dir = ".";
|
||||
static const char *_rec_filename = NULL;
|
||||
|
||||
static const char *_test_name = NULL;
|
||||
static int _verbose = 0;
|
||||
|
||||
static Evas *(*_evas_new)(void) = NULL;
|
||||
static int _ignore_evas_creation = 0;
|
||||
static Eina_List *_evas_list = NULL;
|
||||
|
||||
static Lists_st *_events_list = NULL;
|
||||
static Eina_List *_cur_event_list = NULL;
|
||||
static unsigned int _last_event_time = 0;
|
||||
|
||||
static int _cur_shot_id = 0;
|
||||
|
||||
static void
|
||||
_printf(int verbose, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
if (!_verbose || verbose > _verbose) return;
|
||||
|
||||
va_start(ap, fmt);
|
||||
vprintf(fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
static void
|
||||
_shot_do(Evas *e)
|
||||
{
|
||||
Ecore_Evas *ee = NULL, *ee_orig;
|
||||
Evas_Object *o;
|
||||
unsigned int *pixels;
|
||||
int w, h, dir_name_len = 0;
|
||||
char *filename;
|
||||
|
||||
if (!e) return;
|
||||
dir_name_len = strlen(_dest_dir) + 1; /* includes space of a '/' */
|
||||
|
||||
filename = malloc(strlen(_test_name) + strlen(IMAGE_FILENAME_EXT) +
|
||||
dir_name_len + 8); /* also space for serial */
|
||||
|
||||
sprintf(filename, "%s/%s%c%03d%s", _dest_dir, _test_name,
|
||||
SHOT_DELIMITER, _cur_shot_id, IMAGE_FILENAME_EXT);
|
||||
_printf(1, "Shot taken (%s).\n", filename);
|
||||
|
||||
ee_orig = ecore_evas_ecore_evas_get(e);
|
||||
|
||||
ecore_evas_manual_render(ee_orig);
|
||||
pixels = (void *)ecore_evas_buffer_pixels_get(ee_orig);
|
||||
if (!pixels) goto end;
|
||||
ecore_evas_geometry_get(ee_orig, NULL, NULL, &w, &h);
|
||||
if ((w < 1) || (h < 1)) goto end;
|
||||
|
||||
_ignore_evas_creation++;
|
||||
ee = ecore_evas_buffer_new(1, 1);
|
||||
_ignore_evas_creation--;
|
||||
|
||||
o = evas_object_image_add(ecore_evas_get(ee));
|
||||
evas_object_image_alpha_set(o, ecore_evas_alpha_get(ee_orig));
|
||||
evas_object_image_size_set(o, w, h);
|
||||
evas_object_image_data_set(o, pixels);
|
||||
|
||||
if (!evas_object_image_save(o, filename, NULL, NULL))
|
||||
{
|
||||
printf("Cannot save widget to <%s>\n", filename);
|
||||
}
|
||||
|
||||
end:
|
||||
if (ee)
|
||||
{
|
||||
ecore_evas_free(ee);
|
||||
}
|
||||
free(filename);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_feed_event(void *data EINA_UNUSED)
|
||||
{
|
||||
time_t evt_time;
|
||||
static Evas_Object *rect = NULL;
|
||||
if (_verbose && !rect)
|
||||
{
|
||||
rect = evas_object_rectangle_add(eina_list_data_get(_evas_list));
|
||||
evas_object_repeat_events_set(rect, EINA_TRUE);
|
||||
evas_object_color_set(rect, 255, 0, 0, 255);
|
||||
evas_object_resize(rect, 15, 15);
|
||||
evas_object_layer_set(rect, 100);
|
||||
evas_object_show(rect);
|
||||
}
|
||||
|
||||
Variant_st *v = eina_list_data_get(_cur_event_list);
|
||||
switch(tsuite_event_mapping_type_get(v->t.type))
|
||||
{
|
||||
case TSUITE_EVENT_MOUSE_IN:
|
||||
{
|
||||
mouse_in_mouse_out *t = v->data;
|
||||
Eo *e = eina_list_nth(_evas_list, t->n_evas);
|
||||
evt_time = t->timestamp;
|
||||
_printf(1, "Mouse in\n");
|
||||
_printf(2, "%s evas_event_feed_mouse_in timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp, t->n_evas);
|
||||
if (e) evas_event_feed_mouse_in(e, time(NULL), NULL);
|
||||
break;
|
||||
}
|
||||
case TSUITE_EVENT_MOUSE_OUT:
|
||||
{
|
||||
mouse_in_mouse_out *t = v->data;
|
||||
Eo *e = eina_list_nth(_evas_list, t->n_evas);
|
||||
evt_time = t->timestamp;
|
||||
_printf(1, "Mouse out\n");
|
||||
_printf(2, "%s evas_event_feed_mouse_out timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp,t->n_evas);
|
||||
if (e) evas_event_feed_mouse_out(e, time(NULL), NULL);
|
||||
break;
|
||||
}
|
||||
case TSUITE_EVENT_MOUSE_DOWN:
|
||||
{
|
||||
mouse_down_mouse_up *t = v->data;
|
||||
Eo *e = eina_list_nth(_evas_list, t->n_evas);
|
||||
evt_time = t->timestamp;
|
||||
_printf(1, "Mouse down\n");
|
||||
_printf(2, "%s evas_event_feed_mouse_down timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp, t->n_evas);
|
||||
if (rect) evas_object_color_set(rect, 255, 255, 0, 255);
|
||||
if (e) evas_event_feed_mouse_down(e, t->b, t->flags, time(NULL), NULL);
|
||||
|
||||
break;
|
||||
}
|
||||
case TSUITE_EVENT_MOUSE_UP:
|
||||
{
|
||||
mouse_down_mouse_up *t = v->data;
|
||||
Eo *e = eina_list_nth(_evas_list, t->n_evas);
|
||||
evt_time = t->timestamp;
|
||||
_printf(1, "Mouse up\n");
|
||||
_printf(2, "%s evas_event_feed_mouse_up timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp,t->n_evas);
|
||||
if (e) evas_event_feed_mouse_up(e, t->b, t->flags, time(NULL), NULL);
|
||||
if (rect) evas_object_color_set(rect, 255, 0, 0, 255);
|
||||
|
||||
break;
|
||||
}
|
||||
case TSUITE_EVENT_MOUSE_MOVE:
|
||||
{
|
||||
mouse_move *t = v->data;
|
||||
Eo *e = eina_list_nth(_evas_list, t->n_evas);
|
||||
evt_time = t->timestamp;
|
||||
_printf(2, "%s evas_event_feed_mouse_move (x,y)=(%d,%d) timestamp=<%u> t->n_evas=<%d>\n", __func__, t->x, t->y, t->timestamp,t->n_evas);
|
||||
if (e) evas_event_feed_mouse_move(e, t->x, t->y, time(NULL), NULL);
|
||||
|
||||
if (rect)
|
||||
{
|
||||
evas_object_move(rect, t->x, t->y);
|
||||
evas_object_color_set(rect, 255, 0, 0, 255);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TSUITE_EVENT_MOUSE_WHEEL:
|
||||
{
|
||||
mouse_wheel *t = v->data;
|
||||
Eo *e = eina_list_nth(_evas_list, t->n_evas);
|
||||
evt_time = t->timestamp;
|
||||
_printf(1, "Mouse wheel\n");
|
||||
_printf(2, "%s evas_event_feed_mouse_wheel timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp, t->n_evas);
|
||||
if (e) evas_event_feed_mouse_wheel(e, t->direction, t->z, time(NULL), NULL);
|
||||
|
||||
break;
|
||||
}
|
||||
case TSUITE_EVENT_MULTI_DOWN:
|
||||
{
|
||||
multi_event *t = v->data;
|
||||
Eo *e = eina_list_nth(_evas_list, t->n_evas);
|
||||
evt_time = t->timestamp;
|
||||
_printf(2, "%s evas_event_feed_multi_down timestamp=<%u>, t->n_evas=<%d>\n", __func__, t->timestamp,t->n_evas);
|
||||
if (!t->d)
|
||||
{
|
||||
if (e) evas_event_feed_mouse_down(e, t->b, t->flags, time(NULL), NULL);
|
||||
if (rect) evas_object_color_set(rect, 255, 255, 0, 255);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (e) evas_event_feed_multi_down(e,
|
||||
t->d, t->x, t->y, t->rad,
|
||||
t->radx, t->rady, t->pres, t->ang, t->fx, t->fy,
|
||||
t->flags, time(NULL), NULL);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case TSUITE_EVENT_MULTI_UP:
|
||||
{
|
||||
multi_event *t = v->data;
|
||||
Eo *e = eina_list_nth(_evas_list, t->n_evas);
|
||||
evt_time = t->timestamp;
|
||||
_printf(2, "%s evas_event_feed_multi_up timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp,t->n_evas);
|
||||
if (!t->d)
|
||||
{
|
||||
if (e) evas_event_feed_mouse_up(e, t->b, t->flags, time(NULL), NULL);
|
||||
if (rect) evas_object_color_set(rect, 255, 0, 0, 255);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (e) evas_event_feed_multi_up(e,
|
||||
t->d, t->x, t->y, t->rad,
|
||||
t->radx, t->rady, t->pres, t->ang, t->fx, t->fy,
|
||||
t->flags, time(NULL), NULL);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case TSUITE_EVENT_MULTI_MOVE:
|
||||
{
|
||||
multi_move *t = v->data;
|
||||
Eo *e = eina_list_nth(_evas_list, t->n_evas);
|
||||
evt_time = t->timestamp;
|
||||
_printf(2, "%s evas_event_feed_multi_move timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp, t->n_evas);
|
||||
if (!t->d)
|
||||
{
|
||||
if (e) evas_event_feed_mouse_move(e, t->x, t->y, time(NULL), NULL);
|
||||
if (rect)
|
||||
{
|
||||
evas_object_move(rect, t->x, t->y);
|
||||
evas_object_color_set(rect, 255, 0, 0, 255);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (e) evas_event_feed_multi_move(e,
|
||||
t->d, t->x, t->y, t->rad,
|
||||
t->radx, t->rady, t->pres, t->ang, t->fx, t->fy,
|
||||
time(NULL), NULL);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case TSUITE_EVENT_KEY_DOWN:
|
||||
{
|
||||
key_down_key_up *t = v->data;
|
||||
Eo *e = eina_list_nth(_evas_list, t->n_evas);
|
||||
evt_time = t->timestamp;
|
||||
_printf(2, "%s evas_event_feed_key_down timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp, t->n_evas);
|
||||
if (e) evas_event_feed_key_down(e,
|
||||
t->keyname, t->key, t->string,
|
||||
t->compose, time(NULL), NULL);
|
||||
|
||||
break;
|
||||
}
|
||||
case TSUITE_EVENT_KEY_UP:
|
||||
{
|
||||
key_down_key_up *t = v->data;
|
||||
Eo *e = eina_list_nth(_evas_list, t->n_evas);
|
||||
evt_time = t->timestamp;
|
||||
_printf(2, "%s evas_event_feed_key_up timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp, t->n_evas);
|
||||
if (e) evas_event_feed_key_up(e,
|
||||
t->keyname, t->key, t->string,
|
||||
t->compose, time(NULL), NULL);
|
||||
|
||||
break;
|
||||
}
|
||||
case TSUITE_EVENT_KEY_DOWN_WITH_KEYCODE:
|
||||
{
|
||||
key_down_key_up_with_keycode *t = v->data;
|
||||
Eo *e = eina_list_nth(_evas_list, t->n_evas);
|
||||
evt_time = t->timestamp;
|
||||
_printf(2, "%s evas_event_feed_key_down_with_keycode timestamp=<%u> t->n_evas=<%d> t->keycode=<%u>\n", __func__, t->timestamp, t->n_evas, t->keycode);
|
||||
if (e) evas_event_feed_key_down_with_keycode(e,
|
||||
t->keyname, t->key, t->string,
|
||||
t->compose, time(NULL), NULL, t->keycode);
|
||||
|
||||
break;
|
||||
}
|
||||
case TSUITE_EVENT_KEY_UP_WITH_KEYCODE:
|
||||
{
|
||||
key_down_key_up_with_keycode *t = v->data;
|
||||
Eo *e = eina_list_nth(_evas_list, t->n_evas);
|
||||
evt_time = t->timestamp;
|
||||
_printf(2, "%s evas_event_feed_key_up_with_keycode timestamp=<%u> t->n_evas=<%d> t->keycode=<%u>\n", __func__, t->timestamp, t->n_evas, t->keycode);
|
||||
if (e) evas_event_feed_key_up(e,
|
||||
t->keyname, t->key, t->string,
|
||||
t->compose, time(NULL), NULL);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case TSUITE_EVENT_TAKE_SHOT:
|
||||
{
|
||||
take_screenshot *t = v->data;
|
||||
Eo *e = eina_list_nth(_evas_list, t->n_evas);
|
||||
evt_time = t->timestamp;
|
||||
_printf(2, "%s take shot timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp, t->n_evas);
|
||||
if (rect) evas_object_color_set(rect, 0, 0, 255, 255);
|
||||
_cur_shot_id++;
|
||||
if (_dest_dir)
|
||||
{
|
||||
if (e) _shot_do(e);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: /* All non-input events are not handeled */
|
||||
evt_time = _last_event_time;
|
||||
break;
|
||||
}
|
||||
|
||||
double timer_time;
|
||||
_cur_event_list = eina_list_next(_cur_event_list);
|
||||
|
||||
if (!_cur_event_list)
|
||||
{ /* Finished reading all events */
|
||||
ecore_main_loop_quit();
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
|
||||
_last_event_time = evt_time;
|
||||
|
||||
unsigned int current_event_time = evt_time_get(evt_time, eina_list_data_get(_cur_event_list));
|
||||
|
||||
if (current_event_time < _last_event_time) /* Could happen with refeed event */
|
||||
current_event_time = _last_event_time;
|
||||
|
||||
_printf(2, " %s _last_event_time=<%u> current_event_time=<%u>\n", __func__, _last_event_time, current_event_time);
|
||||
timer_time = (current_event_time - _last_event_time) / 1000.0;
|
||||
|
||||
if (!_last_event_time) timer_time = 0.0;
|
||||
|
||||
_printf(2, " %s timer_time=<%f>\n", __func__, timer_time);
|
||||
ecore_timer_add(timer_time, _feed_event, NULL);
|
||||
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_rec_open()
|
||||
{
|
||||
double diff_time = 0; /* Time to wait before feeding the first event */
|
||||
_printf(2, "<%s> rec file is <%s>\n", __func__, _rec_filename);
|
||||
_events_list = read_events(_rec_filename, NULL);
|
||||
if (_events_list)
|
||||
{
|
||||
_cur_event_list = _events_list->variant_list;
|
||||
Variant_st *v = eina_list_data_get(_cur_event_list);
|
||||
|
||||
/* Calculate the time to wait before feeding the first event */
|
||||
unsigned int current_event_time = evt_time_get(0, v);
|
||||
if (current_event_time > _events_list->first_timestamp)
|
||||
diff_time = (current_event_time - _events_list->first_timestamp) / 1000.0;
|
||||
|
||||
_printf(2, "%s first_time_stamp=<%u> current_event_time=<%u>\n", __func__, _events_list->first_timestamp, current_event_time);
|
||||
|
||||
if (diff_time)
|
||||
{
|
||||
_printf(2, " Waiting <%f>\n", diff_time);
|
||||
ecore_timer_add(diff_time, _feed_event, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
_feed_event(NULL);
|
||||
}
|
||||
}
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_prg_invoke(const char *full_path, int argc, char **argv)
|
||||
{
|
||||
Eina_Value *ret__;
|
||||
int real__;
|
||||
|
||||
void (*efl_main)(void *data, const Efl_Event *ev);
|
||||
int (*elm_main)(int argc, char **argv);
|
||||
int (*c_main)(int argc, char **argv);
|
||||
Eina_Module *h = eina_module_new(full_path);
|
||||
if (!h || !eina_module_load(h))
|
||||
{
|
||||
fprintf(stderr, "Failed loading %s.\n", full_path);
|
||||
if (h) eina_module_free(h);
|
||||
return EINA_FALSE;
|
||||
}
|
||||
efl_main = eina_module_symbol_get(h, "efl_main");
|
||||
elm_main = eina_module_symbol_get(h, "elm_main");
|
||||
c_main = eina_module_symbol_get(h, "main");
|
||||
_evas_new = eina_module_symbol_get(h, "evas_new");
|
||||
if (!_evas_new)
|
||||
{
|
||||
fprintf(stderr, "Failed loading symbol 'evas_new' from %s.\n", full_path);
|
||||
eina_module_free(h);
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
_rec_open();
|
||||
if (efl_main)
|
||||
{
|
||||
elm_init(argc, argv);
|
||||
efl_event_callback_add(efl_main_loop_get(), EFL_LOOP_EVENT_ARGUMENTS, efl_main, NULL);
|
||||
ret__ = efl_loop_begin(efl_main_loop_get());
|
||||
real__ = efl_loop_exit_code_process(ret__);
|
||||
elm_shutdown();
|
||||
}
|
||||
else if (elm_main)
|
||||
{
|
||||
elm_init(argc, argv);
|
||||
real__ = elm_main(argc, argv);
|
||||
elm_shutdown();
|
||||
}
|
||||
else if (c_main)
|
||||
{
|
||||
real__ = c_main(argc, argv);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "Failed loading symbol 'efl_main', 'elm_main' or 'main' from %s.\n", full_path);
|
||||
eina_module_free(h);
|
||||
real__ = 1;
|
||||
}
|
||||
return real__;
|
||||
}
|
||||
|
||||
static Eina_Stringshare *
|
||||
_prg_full_path_guess(const char *prg)
|
||||
{
|
||||
char full_path[MAX_PATH];
|
||||
if (strchr(prg, '/')) return eina_stringshare_add(prg);
|
||||
char *paths = strdup(getenv("PATH"));
|
||||
Eina_Stringshare *ret = NULL;
|
||||
while (paths && *paths && !ret)
|
||||
{
|
||||
char *real_path;
|
||||
char *colon = strchr(paths, ':');
|
||||
if (colon) *colon = '\0';
|
||||
|
||||
sprintf(full_path, "%s/%s", paths, prg);
|
||||
real_path = ecore_file_realpath(full_path);
|
||||
if (*real_path)
|
||||
{
|
||||
ret = eina_stringshare_add(real_path);
|
||||
// check if executable
|
||||
}
|
||||
free(real_path);
|
||||
|
||||
paths += strlen(paths);
|
||||
if (colon) paths++;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
_print_usage(const char *progn, FILE *outf)
|
||||
{
|
||||
fprintf(outf, "Usage: %s [options] [program]\n", progn);
|
||||
fprintf(outf, "Options:\n"
|
||||
" -s Show the application on the screen\n"
|
||||
" -o shots_dest Set the destination folder for the shots.\n"
|
||||
" If omitted, the shots are created in the current directory\n"
|
||||
" -t file.rec Test to run on the given application\n"
|
||||
" -v Verbose mode\n"
|
||||
" -h Print this message and exit\n"
|
||||
"\n");
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_mkdir(const char *dir)
|
||||
{
|
||||
if (!ecore_file_exists(dir))
|
||||
{
|
||||
const char *cur = dir + 1;
|
||||
do
|
||||
{
|
||||
char *slash = strchr(cur, '/');
|
||||
if (slash) *slash = '\0';
|
||||
if (!ecore_file_exists(dir) && !ecore_file_mkdir(dir)) return EINA_FALSE;
|
||||
if (slash) *slash = '/';
|
||||
if (slash) cur = slash + 1;
|
||||
else cur = NULL;
|
||||
}
|
||||
while (cur);
|
||||
}
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static Evas *
|
||||
_my_evas_new(int w EINA_UNUSED, int h EINA_UNUSED)
|
||||
{
|
||||
Evas *e;
|
||||
if (!_evas_new) return NULL;
|
||||
e = _evas_new();
|
||||
if (e && !_ignore_evas_creation)
|
||||
{
|
||||
_printf(1, "New Evas\n");
|
||||
_evas_list = eina_list_append(_evas_list, e);
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int pret = 1;
|
||||
const char *engine = "buffer";
|
||||
|
||||
eina_init();
|
||||
|
||||
opterr = 0;
|
||||
for (int opt; (opt = getopt(argc, argv, "+so:vt:h")) != -1;)
|
||||
switch (opt)
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
case 's':
|
||||
{
|
||||
engine = NULL;
|
||||
break;
|
||||
}
|
||||
case 'o':
|
||||
{
|
||||
_dest_dir = eina_stringshare_add(optarg);
|
||||
if (!_mkdir(_dest_dir))
|
||||
{
|
||||
fprintf(stderr, "Directory %s cannot be created\n", _dest_dir);
|
||||
goto end;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 't':
|
||||
{
|
||||
_rec_filename = eina_stringshare_add(optarg);
|
||||
break;
|
||||
}
|
||||
case 'v':
|
||||
{
|
||||
_verbose++;
|
||||
break;
|
||||
}
|
||||
case 'h':
|
||||
{
|
||||
_print_usage(argv[0], stdout);
|
||||
pret = 0;
|
||||
goto end;
|
||||
}
|
||||
default:
|
||||
{
|
||||
_print_usage(argv[0], stderr);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
if (engine) setenv("ELM_ENGINE", engine, 1);
|
||||
if (!argv[optind])
|
||||
{
|
||||
fprintf(stderr, "no program specified\nUse -h for more information\n");
|
||||
goto end;
|
||||
}
|
||||
if (!_rec_filename)
|
||||
{
|
||||
fprintf(stderr, "no test file specified\n");
|
||||
goto end;
|
||||
}
|
||||
else
|
||||
{
|
||||
char *slash = strrchr(_rec_filename, '/');
|
||||
if (slash) _test_name = strdup(slash + 1);
|
||||
else _test_name = strdup(_rec_filename);
|
||||
char *dot = strrchr(_test_name, '.');
|
||||
if (dot) *dot = '\0';
|
||||
}
|
||||
|
||||
efl_object_init();
|
||||
evas_init();
|
||||
|
||||
/* Replace the current command line to hide the Exactness part */
|
||||
int len = argv[argc - 1] + strlen(argv[argc - 1]) - argv[optind];
|
||||
memcpy(argv[0], argv[optind], len);
|
||||
memset(argv[0] + len, 0, _POSIX_PATH_MAX - len);
|
||||
|
||||
for (int i = optind; i < argc; i++)
|
||||
{
|
||||
if (i != optind)
|
||||
{
|
||||
argv[i - optind] = argv[0] + (argv[i] - argv[optind]);
|
||||
}
|
||||
_printf(1, "%s ", argv[i - optind]);
|
||||
}
|
||||
_printf(1, "\n");
|
||||
|
||||
ecore_evas_callback_new_set(_my_evas_new);
|
||||
pret = _prg_invoke(_prg_full_path_guess(argv[0]), argc - opt_args, argv);
|
||||
|
||||
end:
|
||||
eina_shutdown();
|
||||
return pret;
|
||||
}
|
|
@ -234,7 +234,7 @@ read_events(const char *filename, Timer_Data *td)
|
|||
#ifdef DEBUG_TSUITE
|
||||
print_events(vr_list);
|
||||
#endif
|
||||
td->current_event = eina_list_nth_list(vr_list->variant_list, 0);
|
||||
if (td) td->current_event = eina_list_nth_list(vr_list->variant_list, 0);
|
||||
#ifdef DEBUG_TSUITE
|
||||
printf("%s list size is <%d>\n", __func__, eina_list_count(vr_list->variant_list));
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue