forked from enlightenment/efl
ecore_con: Split ecore_con test suite from ecore.
Summary: Have created ecore_con test suite. Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com> Reviewers: cedric, Sergeant_Whitespace, stefan_schmidt Subscribers: stefan_schmidt, Sergeant_Whitespace, cedric Maniphest Tasks: T2235 Differential Revision: https://phab.enlightenment.org/D2269
This commit is contained in:
parent
39432aa0f2
commit
4b0e879591
|
@ -187,8 +187,6 @@ TESTS += tests/ecore/ecore_suite
|
|||
tests_ecore_ecore_suite_SOURCES = \
|
||||
tests/ecore/ecore_suite.c \
|
||||
tests/ecore/ecore_test_ecore.c \
|
||||
tests/ecore/ecore_test_ecore_con.c \
|
||||
tests/ecore/ecore_test_ecore_con_url.c \
|
||||
tests/ecore/ecore_test_ecore_imf.c \
|
||||
tests/ecore/ecore_test_timer.c \
|
||||
tests/ecore/ecore_test_ecore_evas.c \
|
||||
|
@ -204,7 +202,6 @@ tests_ecore_ecore_suite_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
|
|||
@CHECK_CFLAGS@ \
|
||||
@ECORE_CFLAGS@ \
|
||||
@ECORE_AUDIO_CFLAGS@ \
|
||||
@ECORE_CON_CFLAGS@ \
|
||||
@ECORE_FILE_CFLAGS@ \
|
||||
@ECORE_X_CFLAGS@ \
|
||||
@ECORE_IMF_CFLAGS@ \
|
||||
|
@ -219,7 +216,6 @@ tests_ecore_ecore_suite_LDADD = \
|
|||
@CHECK_LIBS@ \
|
||||
@USE_ECORE_LIBS@ \
|
||||
@USE_ECORE_AUDIO_LIBS@ \
|
||||
@USE_ECORE_CON_LIBS@ \
|
||||
@USE_ECORE_FILE_LIBS@ \
|
||||
@USE_ECORE_X_LIBS@ \
|
||||
@USE_ECORE_IMF_LIBS@ \
|
||||
|
@ -232,7 +228,6 @@ tests_ecore_ecore_suite_LDADD = \
|
|||
tests_ecore_ecore_suite_DEPENDENCIES = \
|
||||
@USE_ECORE_INTERNAL_LIBS@ \
|
||||
@USE_ECORE_AUDIO_INTERNAL_LIBS@ \
|
||||
@USE_ECORE_CON_INTERNAL_LIBS@ \
|
||||
@USE_ECORE_FILE_INTERNAL_LIBS@ \
|
||||
@USE_ECORE_X_INTERNAL_LIBS@ \
|
||||
@USE_ECORE_IMF_INTERNAL_LIBS@ \
|
||||
|
@ -266,9 +261,7 @@ endif
|
|||
|
||||
EXTRA_DIST += \
|
||||
tests/ecore/modem.wav \
|
||||
tests/ecore/sms.ogg \
|
||||
tests/ecore/server.key \
|
||||
tests/ecore/server.pem
|
||||
tests/ecore/sms.ogg
|
||||
|
||||
if HAVE_ELUA
|
||||
|
||||
|
|
|
@ -69,6 +69,41 @@ lib_ecore_con_libecore_con_la_LIBADD = @ECORE_CON_LIBS@ @EVIL_LIBS@
|
|||
lib_ecore_con_libecore_con_la_DEPENDENCIES = @ECORE_CON_INTERNAL_LIBS@
|
||||
lib_ecore_con_libecore_con_la_LDFLAGS = @EFL_LTLIBRARY_FLAGS@
|
||||
|
||||
### Unit tests
|
||||
|
||||
if EFL_ENABLE_TESTS
|
||||
|
||||
check_PROGRAMS += tests/ecore_con/ecore_con_suite
|
||||
TESTS += tests/ecore_con/ecore_con_suite
|
||||
|
||||
tests_ecore_con_ecore_con_suite_SOURCES = \
|
||||
tests/ecore_con/ecore_con_suite.c \
|
||||
tests/ecore_con/ecore_con_test_ecore_con.c \
|
||||
tests/ecore_con/ecore_con_test_ecore_con_url.c \
|
||||
tests/ecore_con/ecore_con_suite.h
|
||||
|
||||
tests_ecore_con_ecore_con_suite_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
|
||||
-DTESTS_SRC_DIR=\"$(top_srcdir)/src/tests/ecore_con\" \
|
||||
-DTESTS_BUILD_DIR=\"$(top_builddir)/src/tests/ecore_con\" \
|
||||
@CHECK_CFLAGS@ \
|
||||
@ECORE_CFLAGS@ \
|
||||
@ECORE_CON_CFLAGS@
|
||||
|
||||
tests_ecore_con_ecore_con_suite_LDADD = \
|
||||
@CHECK_LIBS@ \
|
||||
@USE_ECORE_LIBS@ \
|
||||
@USE_ECORE_CON_LIBS@
|
||||
|
||||
tests_ecore_con_ecore_con_suite_DEPENDENCIES = \
|
||||
@USE_ECORE_INTERNAL_LIBS@ \
|
||||
@USE_ECORE_CON_INTERNAL_LIBS@
|
||||
|
||||
EXTRA_DIST += \
|
||||
tests/ecore_con/server.key \
|
||||
tests/ecore_con/server.pem
|
||||
|
||||
endif
|
||||
|
||||
if HAVE_ELUA
|
||||
|
||||
ecore_con_eolian_lua = $(ecore_con_eolian_files:%.eo=%.eo.lua)
|
||||
|
|
|
@ -19,8 +19,6 @@ struct _Ecore_Test_Case
|
|||
|
||||
static const Ecore_Test_Case etc[] = {
|
||||
{ "Ecore", ecore_test_ecore },
|
||||
{ "Ecore_Con", ecore_test_ecore_con },
|
||||
{ "Ecore_Con_Url", ecore_test_ecore_con_url },
|
||||
#if HAVE_ECORE_X
|
||||
{ "Ecore_X", ecore_test_ecore_x },
|
||||
#endif
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
#include <check.h>
|
||||
|
||||
void ecore_test_ecore(TCase *tc);
|
||||
void ecore_test_ecore_con(TCase *tc);
|
||||
void ecore_test_ecore_con_url(TCase *tc);
|
||||
void ecore_test_ecore_x(TCase *tc);
|
||||
void ecore_test_ecore_imf(TCase *tc);
|
||||
void ecore_test_ecore_audio(TCase *tc);
|
||||
|
|
|
@ -0,0 +1,106 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "Ecore.h"
|
||||
|
||||
#include "ecore_con_suite.h"
|
||||
|
||||
typedef struct _Ecore_Con_Test_Case Ecore_Con_Test_Case;
|
||||
|
||||
struct _Ecore_Con_Test_Case
|
||||
{
|
||||
const char *test_case;
|
||||
void (*build)(TCase *tc);
|
||||
};
|
||||
|
||||
static const Ecore_Con_Test_Case etc[] = {
|
||||
{ "Ecore_Con", ecore_con_test_ecore_con },
|
||||
{ "Ecore_Con_Url", ecore_con_test_ecore_con_url },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
static void
|
||||
_list_tests(void)
|
||||
{
|
||||
const Ecore_Con_Test_Case *itr;
|
||||
|
||||
itr = etc;
|
||||
fputs("Available Test Cases:\n", stderr);
|
||||
for (; itr->test_case; itr++)
|
||||
fprintf(stderr, "\t%s\n", itr->test_case);
|
||||
}
|
||||
static Eina_Bool
|
||||
_use_test(int argc, const char **argv, const char *test_case)
|
||||
{
|
||||
if (argc < 1)
|
||||
return 1;
|
||||
|
||||
for (; argc > 0; argc--, argv++)
|
||||
if (strcmp(test_case, *argv) == 0)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Suite *
|
||||
ecore_con_suite_build(int argc, const char **argv)
|
||||
{
|
||||
TCase *tc;
|
||||
Suite *s;
|
||||
int i;
|
||||
|
||||
s = suite_create("Ecore_Con");
|
||||
|
||||
for (i = 0; etc[i].test_case; ++i)
|
||||
{
|
||||
if (!_use_test(argc, argv, etc[i].test_case)) continue;
|
||||
tc = tcase_create(etc[i].test_case);
|
||||
|
||||
etc[i].build(tc);
|
||||
|
||||
suite_add_tcase(s, tc);
|
||||
tcase_set_timeout(tc, 0);
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
Suite *s;
|
||||
SRunner *sr;
|
||||
int i, failed_count;
|
||||
|
||||
for (i = 1; i < argc; i++)
|
||||
if ((strcmp(argv[i], "-h") == 0) ||
|
||||
(strcmp(argv[i], "--help") == 0))
|
||||
{
|
||||
fprintf(stderr, "Usage:\n\t%s [test_case1 .. [test_caseN]]\n",
|
||||
argv[0]);
|
||||
_list_tests();
|
||||
return 0;
|
||||
}
|
||||
else if ((strcmp(argv[i], "-l") == 0) ||
|
||||
(strcmp(argv[i], "--list") == 0))
|
||||
{
|
||||
_list_tests();
|
||||
return 0;
|
||||
}
|
||||
|
||||
putenv("EFL_RUN_IN_TREE=1");
|
||||
|
||||
s = ecore_con_suite_build(argc - 1, (const char **)argv + 1);
|
||||
sr = srunner_create(s);
|
||||
|
||||
srunner_set_xml(sr, TESTS_BUILD_DIR "/check-results.xml");
|
||||
|
||||
srunner_run_all(sr, CK_ENV);
|
||||
failed_count = srunner_ntests_failed(sr);
|
||||
srunner_free(sr);
|
||||
|
||||
return (failed_count == 0) ? 0 : 255;
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
#ifndef _ECORE_CON_SUITE_H
|
||||
#define _ECORE_CON_SUITE_H
|
||||
|
||||
#include <check.h>
|
||||
|
||||
void ecore_con_test_ecore_con(TCase *tc);
|
||||
void ecore_con_test_ecore_con_url(TCase *tc);
|
||||
|
||||
#endif /* _ECORE_CON_SUITE_H */
|
|
@ -2,7 +2,7 @@
|
|||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "ecore_suite.h"
|
||||
#include "ecore_con_suite.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <Ecore.h>
|
||||
|
@ -77,7 +77,8 @@ _del(void *data , int type EINA_UNUSED, void *ev)
|
|||
fail_if (data != (void *) 1);
|
||||
fail_if (!event->client);
|
||||
|
||||
printf("Lost client with ip %s!\n", ecore_con_client_ip_get(event->client));
|
||||
printf("Lost client with ip %s!\n",
|
||||
ecore_con_client_ip_get(event->client));
|
||||
printf("Client was connected for %0.3f seconds.\n",
|
||||
ecore_con_client_uptime_get(event->client));
|
||||
|
||||
|
@ -331,13 +332,13 @@ START_TEST(ecore_test_ecore_con_local_user_none)
|
|||
{
|
||||
const char *xdg_runtime_dir = getenv("XDG_RUNTIME_DIR");
|
||||
const char *homedir = getenv("HOME");
|
||||
const char *tmp = getenv("TMP");
|
||||
const char *tmp = getenv("TMPDIR");
|
||||
|
||||
unsetenv("XDG_RUNTIME_DIR");
|
||||
unsetenv("HOME");
|
||||
unsetenv("TMP");
|
||||
unsetenv("TMPDIR");
|
||||
_ecore_con_server_client_tests(ECORE_CON_LOCAL_USER, "test_sock", EINA_FALSE, 12345);
|
||||
setenv("TMP", tmp, 1);
|
||||
setenv("TMPDIR", tmp, 1);
|
||||
setenv("HOME", homedir, 1);
|
||||
setenv("XDG_RUNTIME_DIR", xdg_runtime_dir, 1);
|
||||
}
|
||||
|
@ -531,7 +532,7 @@ START_TEST(ecore_test_ecore_con_shutdown_bef_init)
|
|||
}
|
||||
END_TEST
|
||||
|
||||
void ecore_test_ecore_con(TCase *tc)
|
||||
void ecore_con_test_ecore_con(TCase *tc)
|
||||
{
|
||||
tcase_add_test(tc, ecore_test_ecore_con_init);
|
||||
tcase_add_test(tc, ecore_test_ecore_con_local_user);
|
|
@ -2,7 +2,7 @@
|
|||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "ecore_suite.h"
|
||||
#include "ecore_con_suite.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <Ecore.h>
|
||||
|
@ -318,7 +318,7 @@ START_TEST(ecore_test_ecore_con_url_init)
|
|||
}
|
||||
END_TEST
|
||||
|
||||
void ecore_test_ecore_con_url(TCase *tc)
|
||||
void ecore_con_test_ecore_con_url(TCase *tc)
|
||||
{
|
||||
tcase_add_test(tc, ecore_test_ecore_con_url_init);
|
||||
tcase_add_test(tc, ecore_test_ecore_con_url_create);
|
Loading…
Reference in New Issue