forked from enlightenment/efl
Test rework #12: Eio
This commit is contained in:
parent
dce4a966ad
commit
e15c61beb3
|
@ -4,14 +4,15 @@
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <Eo.h>
|
|
||||||
#include <Eio.h>
|
|
||||||
#include <Ecore.h>
|
|
||||||
#include <Efl.h>
|
|
||||||
#include <eio_model.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <check.h>
|
#include <Eo.h>
|
||||||
|
#include <Ecore.h>
|
||||||
|
#include <Efl.h>
|
||||||
|
#include <Eio.h>
|
||||||
|
#include <eio_model.h>
|
||||||
|
|
||||||
|
#include "eio_suite.h"
|
||||||
|
|
||||||
#define EFL_MODEL_TEST_FILENAME_PATH "/tmp"
|
#define EFL_MODEL_TEST_FILENAME_PATH "/tmp"
|
||||||
#define EFL_MODEL_MAX_TEST_CHILDS 16
|
#define EFL_MODEL_MAX_TEST_CHILDS 16
|
||||||
|
@ -176,7 +177,7 @@ START_TEST(eio_model_test_test_file)
|
||||||
handler = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, exit_func, NULL);
|
handler = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, exit_func, NULL);
|
||||||
|
|
||||||
ecore_main_loop_begin();
|
ecore_main_loop_begin();
|
||||||
|
|
||||||
eo_do(filemodel, status = efl_model_property_get("filename", &value_prop));
|
eo_do(filemodel, status = efl_model_property_get("filename", &value_prop));
|
||||||
str = eina_value_to_string(value_prop);
|
str = eina_value_to_string(value_prop);
|
||||||
printf("efl_model_test filename %s, load status %d\n", str, status);
|
printf("efl_model_test filename %s, load status %d\n", str, status);
|
||||||
|
@ -216,4 +217,3 @@ eio_model_test_file(TCase *tc)
|
||||||
{
|
{
|
||||||
tcase_add_test(tc, eio_model_test_test_file);
|
tcase_add_test(tc, eio_model_test_test_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,14 +4,15 @@
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <Eo.h>
|
|
||||||
#include <Eio.h>
|
|
||||||
#include <Ecore.h>
|
|
||||||
#include <Efl.h>
|
|
||||||
#include <eio_model.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <check.h>
|
#include <Eo.h>
|
||||||
|
#include <Ecore.h>
|
||||||
|
#include <Efl.h>
|
||||||
|
#include <Eio.h>
|
||||||
|
#include <eio_model.h>
|
||||||
|
|
||||||
|
#include "eio_suite.h"
|
||||||
|
|
||||||
Eina_Bool children_added = EINA_FALSE;
|
Eina_Bool children_added = EINA_FALSE;
|
||||||
Eina_Tmpstr* temp_filename = NULL;
|
Eina_Tmpstr* temp_filename = NULL;
|
||||||
|
@ -123,7 +124,7 @@ START_TEST(eio_model_test_test_monitor_add)
|
||||||
fail_if(!eio_init(), "ERROR: Cannot init EIO!\n");
|
fail_if(!eio_init(), "ERROR: Cannot init EIO!\n");
|
||||||
|
|
||||||
tmpdir = eina_environment_tmp_get();
|
tmpdir = eina_environment_tmp_get();
|
||||||
|
|
||||||
filemodel = eo_add(EIO_MODEL_CLASS, NULL, eio_model_path_set(tmpdir));
|
filemodel = eo_add(EIO_MODEL_CLASS, NULL, eio_model_path_set(tmpdir));
|
||||||
fail_if(!filemodel, "ERROR: Cannot init model!\n");
|
fail_if(!filemodel, "ERROR: Cannot init model!\n");
|
||||||
|
|
||||||
|
@ -150,4 +151,3 @@ eio_model_test_monitor_add(TCase *tc)
|
||||||
{
|
{
|
||||||
tcase_add_test(tc, eio_model_test_test_monitor_add);
|
tcase_add_test(tc, eio_model_test_test_monitor_add);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,22 +2,10 @@
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include <Eio.h>
|
|
||||||
|
|
||||||
#include "eio_suite.h"
|
#include "eio_suite.h"
|
||||||
|
#include "../efl_check.h"
|
||||||
|
|
||||||
typedef struct _Eio_Test_Case Eio_Test_Case;
|
static const Efl_Test_Case etc[] = {
|
||||||
|
|
||||||
struct _Eio_Test_Case
|
|
||||||
{
|
|
||||||
const char *test_case;
|
|
||||||
void (*build)(TCase *tc);
|
|
||||||
};
|
|
||||||
|
|
||||||
static const Eio_Test_Case etc[] = {
|
|
||||||
{"Eio_Monitor", eio_test_monitor},
|
{"Eio_Monitor", eio_test_monitor},
|
||||||
{"Eio Model", eio_model_test_file},
|
{"Eio Model", eio_model_test_file},
|
||||||
{"Eio Model Monitor", eio_model_test_monitor_add},
|
{"Eio Model Monitor", eio_model_test_monitor_add},
|
||||||
|
@ -28,86 +16,18 @@ static const Eio_Test_Case etc[] = {
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
|
||||||
_list_tests(void)
|
|
||||||
{
|
|
||||||
const Eio_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 *
|
|
||||||
eio_suite_build(int argc, const char **argv)
|
|
||||||
{
|
|
||||||
TCase *tc;
|
|
||||||
Suite *s;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
s = suite_create("Eio");
|
|
||||||
|
|
||||||
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
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
Suite *s;
|
int failed_count;
|
||||||
SRunner *sr;
|
|
||||||
int i, failed_count;
|
|
||||||
|
|
||||||
for (i = 1; i < argc; i++)
|
if (!_efl_test_option_disp(argc, argv, etc))
|
||||||
if ((strcmp(argv[i], "-h") == 0) ||
|
return 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");
|
putenv("EFL_RUN_IN_TREE=1");
|
||||||
|
|
||||||
s = eio_suite_build(argc - 1, (const char **)argv + 1);
|
failed_count = _efl_suite_build_and_run(argc - 1, (const char **)argv + 1,
|
||||||
sr = srunner_create(s);
|
"Eio", etc);
|
||||||
|
|
||||||
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;
|
return (failed_count == 0) ? 0 : 255;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,9 @@
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#include <Eio.h>
|
|
||||||
#include <Ecore.h>
|
#include <Ecore.h>
|
||||||
#include <Ecore_File.h>
|
#include <Ecore_File.h>
|
||||||
|
#include <Eio.h>
|
||||||
|
|
||||||
#include "eio_suite.h"
|
#include "eio_suite.h"
|
||||||
|
|
||||||
|
@ -374,4 +374,3 @@ eio_test_file(TCase *tc)
|
||||||
tcase_add_test(tc, eio_file_test_ls);
|
tcase_add_test(tc, eio_file_test_ls);
|
||||||
tcase_add_test(tc, eio_file_test_file);
|
tcase_add_test(tc, eio_file_test_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <Eio.h>
|
|
||||||
#include <Ecore.h>
|
#include <Ecore.h>
|
||||||
#include <Ecore_File.h>
|
#include <Ecore_File.h>
|
||||||
|
#include <Eio.h>
|
||||||
|
|
||||||
#include "eio_suite.h"
|
#include "eio_suite.h"
|
||||||
|
|
||||||
|
@ -147,9 +147,9 @@ START_TEST(eio_test_monitor_add_and_remove)
|
||||||
|
|
||||||
//monitor directory
|
//monitor directory
|
||||||
monitor = eio_monitor_add(filename);
|
monitor = eio_monitor_add(filename);
|
||||||
|
|
||||||
usleep(500000);
|
usleep(500000);
|
||||||
|
|
||||||
eio_monitor_del(monitor);
|
eio_monitor_del(monitor);
|
||||||
|
|
||||||
_common_shutdown(dirname);
|
_common_shutdown(dirname);
|
||||||
|
@ -172,9 +172,9 @@ START_TEST(eio_test_monitor_add_remove_add)
|
||||||
//monitor directory
|
//monitor directory
|
||||||
monitor1 = eio_monitor_add(filename);
|
monitor1 = eio_monitor_add(filename);
|
||||||
eio_monitor_del(monitor1);
|
eio_monitor_del(monitor1);
|
||||||
|
|
||||||
usleep(500000);
|
usleep(500000);
|
||||||
|
|
||||||
monitor2 = eio_monitor_add(filename);
|
monitor2 = eio_monitor_add(filename);
|
||||||
eio_monitor_del(monitor2);
|
eio_monitor_del(monitor2);
|
||||||
|
|
||||||
|
@ -199,7 +199,7 @@ START_TEST(eio_test_monitor_add_add_remove_remove)
|
||||||
usleep(500000);
|
usleep(500000);
|
||||||
|
|
||||||
//monitor directory
|
//monitor directory
|
||||||
monitor1 = eio_monitor_add(filename1);
|
monitor1 = eio_monitor_add(filename1);
|
||||||
monitor2 = eio_monitor_add(filename2);
|
monitor2 = eio_monitor_add(filename2);
|
||||||
usleep(500000);
|
usleep(500000);
|
||||||
eio_monitor_del(monitor2);
|
eio_monitor_del(monitor2);
|
||||||
|
@ -727,7 +727,7 @@ void eio_test_monitor(TCase *tc)
|
||||||
tcase_add_test(tc, eio_test_monitor_add_and_remove);
|
tcase_add_test(tc, eio_test_monitor_add_and_remove);
|
||||||
tcase_add_test(tc, eio_test_monitor_add_remove_add);
|
tcase_add_test(tc, eio_test_monitor_add_remove_add);
|
||||||
tcase_add_test(tc, eio_test_monitor_add_add_remove_remove);
|
tcase_add_test(tc, eio_test_monitor_add_add_remove_remove);
|
||||||
|
|
||||||
tcase_add_test(tc, eio_test_monitor_directory_file_created_notify);
|
tcase_add_test(tc, eio_test_monitor_directory_file_created_notify);
|
||||||
tcase_add_test(tc, eio_test_monitor_directory_file_deleted_notify);
|
tcase_add_test(tc, eio_test_monitor_directory_file_deleted_notify);
|
||||||
tcase_add_test(tc, eio_test_monitor_directory_file_modified_notify);
|
tcase_add_test(tc, eio_test_monitor_directory_file_modified_notify);
|
||||||
|
|
|
@ -7,9 +7,9 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#include <Eio.h>
|
|
||||||
#include <Ecore.h>
|
#include <Ecore.h>
|
||||||
#include <Ecore_File.h>
|
#include <Ecore_File.h>
|
||||||
|
#include <Eio.h>
|
||||||
|
|
||||||
#include "eio_suite.h"
|
#include "eio_suite.h"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue