diff --git a/src/bin/main.c b/src/bin/main.c index 6aa59180..8c3d5fb2 100644 --- a/src/bin/main.c +++ b/src/bin/main.c @@ -545,7 +545,7 @@ _translate_options(void) } #endif -#if defined(ENABLE_FUZZING) || defined(ENABLE_TESTS) +#if defined(BINARY_TYFUZZ) || defined(BINARY_TYTEST) static void _log_void(const Eina_Log_Domain *_d EINA_UNUSED, Eina_Log_Level level EINA_UNUSED, @@ -846,7 +846,7 @@ elm_main(int argc, char **argv) terminology_starting_up = EINA_TRUE; -#if defined(ENABLE_FUZZING) || defined(ENABLE_TESTS) +#if defined(BINARY_TYFUZZ) || defined(BINARY_TYTEST) eina_log_print_cb_set(_log_void, NULL); #endif diff --git a/src/bin/meson.build b/src/bin/meson.build index af4db58c..50a537fe 100644 --- a/src/bin/meson.build +++ b/src/bin/meson.build @@ -129,7 +129,7 @@ if fuzzing tyfuzz_sources, install: true, include_directories: config_dir, - c_args: '-DENABLE_FUZZING=1', + c_args: '-DBINARY_TYFUZZ=1', dependencies: terminology_dependencies) endif if tests @@ -137,6 +137,6 @@ if tests tytest_sources, install: true, include_directories: config_dir, - c_args: '-DENABLE_TESTS=1', + c_args: '-DBINARY_TYTEST=1', dependencies: terminology_dependencies) endif diff --git a/src/bin/private.h b/src/bin/private.h index 6ea706d6..2f4d5178 100644 --- a/src/bin/private.h +++ b/src/bin/private.h @@ -20,11 +20,11 @@ extern int terminology_starting_up; * the normal 'terminology' binary. * This is only useful to write tests */ -#if !defined(ENABLE_FUZZING) && !defined(ENABLE_TESTS) +#if !defined(BINARY_TYFUZZ) && !defined(BINARY_TYTEST) //#define ENABLE_TEST_UI #endif -#if defined(ENABLE_FUZZING) || defined(ENABLE_TESTS) +#if defined(BINARY_TYFUZZ) || defined(BINARY_TYTEST) #define EINA_LOG_LEVEL_MAXIMUM (-1) #endif extern int _log_domain; diff --git a/src/bin/sb.c b/src/bin/sb.c index eacd8427..9b55ef40 100644 --- a/src/bin/sb.c +++ b/src/bin/sb.c @@ -7,7 +7,7 @@ #include "sb.h" -#if defined(ENABLE_TESTS) +#if defined(BINARY_TYTEST) #include "unit_tests.h" #endif @@ -173,7 +173,7 @@ ty_sb_free(struct ty_sb *sb) sb->buf = NULL; } -#if defined(ENABLE_TESTS) +#if defined(BINARY_TYTEST) static int tytest_sb_skip(void) { diff --git a/src/bin/termio.h b/src/bin/termio.h index 39252014..9b7315db 100644 --- a/src/bin/termio.h +++ b/src/bin/termio.h @@ -5,7 +5,7 @@ #include "main.h" #include "col.h" #include "termpty.h" -#if !defined(ENABLE_FUZZING) && !defined(ENABLE_TESTS) +#if !defined(BINARY_TYFUZZ) && !defined(BINARY_TYTEST) #include "win.h" #endif #include "termiointernals.h" diff --git a/src/bin/termiointernals.c b/src/bin/termiointernals.c index f4a6e2e1..11e96870 100644 --- a/src/bin/termiointernals.c +++ b/src/bin/termiointernals.c @@ -10,7 +10,7 @@ #include "termptyops.h" #include "termiointernals.h" #include "utf8.h" -#if defined(ENABLE_TESTS) || defined(ENABLE_TEST_UI) +#if defined(BINARY_TYTEST) || defined(ENABLE_TEST_UI) #include "tytest.h" #endif @@ -2007,7 +2007,7 @@ _mouse_selection_scroll(void *data) if (!sd->pty->selection.makesel) return EINA_FALSE; -#if defined(ENABLE_TESTS) || defined(ENABLE_TEST_UI) +#if defined(BINARY_TYTEST) || defined(ENABLE_TEST_UI) test_pointer_canvas_xy_get(NULL, &my); #else evas_pointer_canvas_xy_get(evas_object_evas_get(sd->self), NULL, &my); @@ -2089,7 +2089,7 @@ termio_internal_mouse_move(Termio *sd, } if (scroll == EINA_TRUE) { -#if defined(ENABLE_TESTS) || defined(ENABLE_TEST_UI) +#if defined(BINARY_TYTEST) || defined(ENABLE_TEST_UI) _mouse_selection_scroll(sd); #else if (!sd->mouse_selection_scroll_timer) @@ -2168,7 +2168,7 @@ termio_internal_mouse_move(Termio *sd, /* TODO: make the following useless */ if (sd->mouse_move_job) ecore_job_del(sd->mouse_move_job); -#if !defined(ENABLE_TESTS) +#if !defined(BINARY_TYTEST) sd->mouse_move_job = ecore_job_add(termio_smart_cb_mouse_move_job, sd); #endif } diff --git a/src/bin/termiointernals.h b/src/bin/termiointernals.h index ecba0b6a..59e4adc6 100644 --- a/src/bin/termiointernals.h +++ b/src/bin/termiointernals.h @@ -1,7 +1,7 @@ #ifndef _TERMIOINTERNALS_H__ #define _TERMIOINTERNALS_H__ 1 -#if defined(ENABLE_FUZZING) || defined(ENABLE_TESTS) +#if defined(BINARY_TYFUZZ) || defined(BINARY_TYTEST) typedef void Term; #endif diff --git a/src/bin/termpty.c b/src/bin/termpty.c index 604def5e..32405e1f 100644 --- a/src/bin/termpty.c +++ b/src/bin/termpty.c @@ -8,7 +8,7 @@ #include "termptyops.h" #include "backlog.h" #include "keyin.h" -#if !defined(ENABLE_FUZZING) && !defined(ENABLE_TESTS) +#if !defined(BINARY_TYFUZZ) && !defined(BINARY_TYTEST) # include "win.h" #endif #include "termio.h" @@ -320,7 +320,7 @@ _handle_read(Termpty *ty, Eina_Bool false_on_empty) } if (ty->cb.change.func) ty->cb.change.func(ty->cb.change.data); -#if defined(ENABLE_FUZZING) || defined(ENABLE_TESTS) +#if defined(BINARY_TYFUZZ) || defined(BINARY_TYTEST) if (len <= 0) { ty->exit_code = 0; @@ -583,7 +583,7 @@ termpty_new(const char *cmd, Eina_Bool login_shell, const char *cd, ty->circular_offset = 0; -#if defined(ENABLE_FUZZING) || defined(ENABLE_TESTS) +#if defined(BINARY_TYFUZZ) || defined(BINARY_TYTEST) ty->fd = STDIN_FILENO; ty->hand_fd = ecore_main_fd_handler_add(ty->fd, ECORE_FD_READ | ECORE_FD_ERROR, @@ -1183,7 +1183,7 @@ termpty_cell_get(Termpty *ty, int y_requested, int x_requested) void termpty_write(Termpty *ty, const char *input, int len) { -#if defined(ENABLE_FUZZING) +#if defined(BINARY_TYFUZZ) return; #endif int res = ty_sb_add(&ty->write_buffer, input, len); @@ -1778,7 +1778,7 @@ term_link_free(Termpty *ty, Term_Link *link) /* Remove from bitmap */ hl_bitmap_clear_bit(ty, id); } -#if !defined(ENABLE_FUZZING) && !defined(ENABLE_TESTS) +#if !defined(BINARY_TYFUZZ) && !defined(BINARY_TYTEST) int termpty_color_class_get(Termpty *ty, const char *key, int *r, int *g, int *b, int *a) diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c index 51a14a5e..1fd99e7e 100644 --- a/src/bin/termptyesc.c +++ b/src/bin/termptyesc.c @@ -10,7 +10,7 @@ #include "termptyops.h" #include "termptyext.h" #include "utils.h" -#if defined(ENABLE_TESTS) +#if defined(BINARY_TYTEST) #include "tytest.h" #endif @@ -654,7 +654,7 @@ _csi_truecolor_arg_get(Termpty *ty, Eina_Unicode **ptr) return sum; } -#if !defined(ENABLE_FUZZING) +#if !defined(BINARY_TYFUZZ) /********************************* * cache true color approximations ********************************* @@ -726,7 +726,7 @@ static uint8_t _approximate_truecolor_rgb(Termpty *ty, uint8_t r0, uint8_t g0, uint8_t b0) { uint8_t chosen_color = COL_DEF; -#if defined(ENABLE_FUZZING) +#if defined(BINARY_TYFUZZ) (void) ty; (void) r0; (void) g0; @@ -3162,7 +3162,7 @@ _handle_resize_by_chars(Termpty *ty, Eina_Unicode **ptr) DBG("Window manipulation: resize to %dx%d", w, h); /* ONLY FOR TESTING PURPOSE FTM */ -#if defined(ENABLE_TESTS) || defined(ENABLE_TEST_UI) +#if defined(BINARY_TYTEST) || defined(ENABLE_TEST_UI) { #if defined(ENABLE_TEST_UI) Evas_Object *wn; @@ -3575,7 +3575,7 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce) cc++; return cc - c; unhandled: -#if !defined(ENABLE_FUZZING) && !defined(ENABLE_TESTS) +#if !defined(BINARY_TYFUZZ) && !defined(BINARY_TYTEST) if (eina_log_domain_level_check(_termpty_log_dom, EINA_LOG_LEVEL_WARN)) { int i; @@ -4044,7 +4044,7 @@ _handle_esc_osc(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce) len = cc - c - (p - buf); if (_xterm_parse_color(ty, &p, &r, &g, &b, len) < 0) goto err; -#if !defined(ENABLE_FUZZING) && !defined(ENABLE_TESTS) +#if !defined(BINARY_TYFUZZ) && !defined(BINARY_TYTEST) evas_object_textgrid_palette_set( termio_textgrid_get(ty->obj), EVAS_TEXTGRID_PALETTE_STANDARD, 0, @@ -4669,7 +4669,7 @@ termpty_handle_seq(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce) last_char = c[len-1]; end: -#if !defined(ENABLE_FUZZING) && !defined(ENABLE_TESTS) +#if !defined(BINARY_TYFUZZ) && !defined(BINARY_TYTEST) if (ty->decoding_error) { int j; diff --git a/src/bin/termptyext.c b/src/bin/termptyext.c index bea10f97..a1677e36 100644 --- a/src/bin/termptyext.c +++ b/src/bin/termptyext.c @@ -5,7 +5,7 @@ #include "termpty.h" #include "termptyops.h" #include "termiointernals.h" -#if defined(ENABLE_TESTS) || defined(ENABLE_TEST_UI) +#if defined(BINARY_TYTEST) || defined(ENABLE_TEST_UI) #include "tytest.h" #endif #include @@ -32,7 +32,7 @@ // handled here at all and just passed to termio to figure it out (return // EINA_FALSE). -#if defined(ENABLE_TESTS) || defined(ENABLE_TEST_UI) +#if defined(BINARY_TYTEST) || defined(ENABLE_TEST_UI) static int _mx; static int _my; @@ -143,7 +143,7 @@ _handle_mouse_down(Termpty *ty, _tytest_arg_get(buf, &value); ev.flags = value; -#if defined(ENABLE_TESTS) || defined(ENABLE_TEST_UI) +#if defined(BINARY_TYTEST) || defined(ENABLE_TEST_UI) test_set_mouse_pointer(ev.canvas.x, ev.canvas.y); #endif termio_internal_mouse_down(sd, &ev, modifiers); @@ -180,7 +180,7 @@ _handle_mouse_up(Termpty *ty, _tytest_arg_get(buf, &value); ev.flags = value; -#if defined(ENABLE_TESTS) || defined(ENABLE_TEST_UI) +#if defined(BINARY_TYTEST) || defined(ENABLE_TEST_UI) test_set_mouse_pointer(ev.canvas.x, ev.canvas.y); #endif termio_internal_mouse_up(sd, &ev, modifiers); @@ -209,7 +209,7 @@ _handle_mouse_move(Termpty *ty, /* MODIFIERS */ _tytest_modifiers_get(buf, &modifiers); -#if defined(ENABLE_TESTS) || defined(ENABLE_TEST_UI) +#if defined(BINARY_TYTEST) || defined(ENABLE_TEST_UI) test_set_mouse_pointer(ev.cur.canvas.x, ev.cur.canvas.y); #endif termio_internal_mouse_move(sd, &ev, modifiers); @@ -247,7 +247,7 @@ _handle_mouse_wheel(Termpty *ty, /* MODIFIERS */ _tytest_modifiers_get(buf, &modifiers); -#if defined(ENABLE_TESTS) || defined(ENABLE_TEST_UI) +#if defined(BINARY_TYTEST) || defined(ENABLE_TEST_UI) test_set_mouse_pointer(ev.canvas.x, ev.canvas.y); #endif termio_internal_mouse_wheel(sd, &ev, modifiers); @@ -466,7 +466,7 @@ tytest_handle_escape_codes(Termpty *ty, } #endif -#if defined(ENABLE_TESTS) || defined(ENABLE_TEST_UI) +#if defined(BINARY_TYTEST) || defined(ENABLE_TEST_UI) #define ARG_USED_FOR_TESTS #else #define ARG_USED_FOR_TESTS EINA_UNUSED @@ -479,7 +479,7 @@ termpty_ext_handle(Termpty *ty ARG_USED_FOR_TESTS, { switch (buf[0]) // major opcode { -#if defined(ENABLE_TESTS) || defined(ENABLE_TEST_UI) +#if defined(BINARY_TYTEST) || defined(ENABLE_TEST_UI) case 't': tytest_handle_escape_codes(ty, buf + 1); return EINA_TRUE; diff --git a/src/bin/tytest.h b/src/bin/tytest.h index f40a68e4..06c57328 100644 --- a/src/bin/tytest.h +++ b/src/bin/tytest.h @@ -1,7 +1,7 @@ #ifndef _TYTEST_H__ #define _TYTEST_H__ 1 -#if defined(ENABLE_TESTS) +#if defined(BINARY_TYTEST) #define evas_object_textgrid_palette_get test_textgrid_palette_get void test_textgrid_palette_get(const Evas_Object *obj, @@ -20,7 +20,7 @@ void tytest_termio_resize(int w, int h); #endif -#if defined(ENABLE_TESTS) || defined(ENABLE_TEST_UI) +#if defined(BINARY_TYTEST) || defined(ENABLE_TEST_UI) void test_pointer_canvas_xy_get(int *mx, int *my); diff --git a/src/bin/tytest_common.c b/src/bin/tytest_common.c index f04c61c6..e4a28cc2 100644 --- a/src/bin/tytest_common.c +++ b/src/bin/tytest_common.c @@ -12,7 +12,7 @@ #include "termptyops.h" #include "termiointernals.h" #include "tytest_common.h" -#if defined(ENABLE_TESTS) +#if defined(BINARY_TYTEST) #include "col.h" #include "tytest.h" #endif @@ -44,7 +44,7 @@ static Termio _sd = { .config = NULL, }; static const char *_cursor_shape = "undefined"; -#if defined(ENABLE_TESTS) +#if defined(BINARY_TYTEST) static Evas_Textgrid_Cell *_cells; const char * @@ -294,7 +294,7 @@ termio_textgrid_get(const Evas_Object *obj EINA_UNUSED) return NULL; } -#if defined(ENABLE_TESTS) +#if defined(BINARY_TYTEST) void test_textgrid_palette_get(const Evas_Object *obj EINA_UNUSED, Evas_Textgrid_Palette pal, @@ -424,7 +424,7 @@ tytest_common_init(void) _config = config_new(); _sd.config = _config; _termpty_init(&_ty, _config); -#if defined(ENABLE_TESTS) +#if defined(BINARY_TYTEST) _cells = calloc(TY_H * TY_W, sizeof(Evas_Textgrid_Cell)); assert(_cells != NULL); #endif @@ -434,7 +434,7 @@ void tytest_common_shutdown(void) { config_del(_config); -#if defined(ENABLE_TESTS) +#if defined(BINARY_TYTEST) free(_cells); #endif } diff --git a/src/bin/tytest_common.h b/src/bin/tytest_common.h index a19b74a1..5db98f69 100644 --- a/src/bin/tytest_common.h +++ b/src/bin/tytest_common.h @@ -13,7 +13,7 @@ void tytest_common_main_loop(void); void tytest_common_init(void); void tytest_common_shutdown(void); void tytest_common_set_fd(int fd); -#if defined(ENABLE_TESTS) +#if defined(BINARY_TYTEST) const char *tytest_cursor_shape_get(void); Termpty *tytest_termpty_get(void); #endif