Commit b844692f authored by Sebastian Ramacher's avatar Sebastian Ramacher

Split tests

… and only run tests requiring a display server with is_parallel: false.
parent d68835f6
......@@ -7,23 +7,61 @@ if check.found()
include_directories += [ include_directories('../girara') ]
test_sources = [
'tests.c',
'test_config.c',
'test_datastructures.c',
'test_session.c',
'test_setting.c',
'test_template.c',
'test_utils.c'
]
xdg_test_helper = executable('xdg_test_helper', 'xdg_test_helper.c',
dependencies: [ glib, declare_dependency(link_with: girara) ],
include_directories: include_directories,
c_args: defines + flags
)
tests = executable('tests', test_sources,
config = executable('test_config', ['test_config.c', 'tests.c'],
dependencies: build_dependencies + test_dependencies,
include_directories: include_directories,
c_args: defines + flags
)
test('config', config,
timeout: 60*60,
is_parallel: false
)
datastructures = executable('test_datastructures', ['test_datastructures.c'],
dependencies: build_dependencies + test_dependencies,
include_directories: include_directories,
c_args: defines + flags
)
test('datastructures', datastructures,
timeout: 60*60
)
session = executable('test_session', ['test_session.c', 'tests.c'],
dependencies: build_dependencies + test_dependencies,
include_directories: include_directories,
c_args: defines + flags
)
test('session', session,
timeout: 60*60,
is_parallel: false
)
setting = executable('test_setting', ['test_setting.c', 'tests.c'],
dependencies: build_dependencies + test_dependencies,
include_directories: include_directories,
c_args: defines + flags
)
test('setting', setting,
timeout: 60*60,
is_parallel: false
)
template = executable('test_template', ['test_template.c'],
dependencies: build_dependencies + test_dependencies,
include_directories: include_directories,
c_args: defines + flags
)
test('template', template,
timeout: 60*60
)
utils = executable('test_utils', ['test_utils.c'],
dependencies: build_dependencies + test_dependencies,
include_directories: include_directories,
c_args: defines + flags
......@@ -32,10 +70,9 @@ if check.found()
env = environment()
env.set('XDG_TEST_HELPER_PATH', meson.current_build_dir())
env.set('HOME', '/home/test')
test('tests-with-home', tests,
test('utils-with-home', utils,
env: env,
timeout: 60*60,
is_parallel: false
timeout: 60*60
)
env_bin = find_program('env', required: false)
......@@ -43,11 +80,10 @@ if check.found()
env = environment()
env.set('XDG_TEST_HELPER_PATH', meson.current_build_dir())
test('tests-without-home', env_bin,
args: ['-u', 'HOME', tests],
test('utils-without-home', env_bin,
args: ['-u', 'HOME', utils],
env: env,
timeout: 60*60,
is_parallel: false
timeout: 60*60
)
endif
endif
......@@ -62,3 +62,19 @@ Suite* suite_config(void)
return suite;
}
int main()
{
Suite* suite = NULL;
SRunner* suite_runner = NULL;
int number_failed = 0;
/* test config */
suite = suite_config();
suite_runner = srunner_create(suite);
srunner_run_all(suite_runner, CK_NORMAL);
number_failed += srunner_ntests_failed(suite_runner);
srunner_free(suite_runner);
return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
......@@ -402,7 +402,6 @@ Suite* suite_datastructures(void)
/* list iterators */
tcase = tcase_create("list_iterators");
/* tcase_add_test(tcase, test_datastructures_list_iterator_remove); */
suite_add_tcase(suite, tcase);
/* node free */
......@@ -417,3 +416,19 @@ Suite* suite_datastructures(void)
return suite;
}
int main()
{
Suite* suite = NULL;
SRunner* suite_runner = NULL;
int number_failed = 0;
/* test datastructures */
suite = suite_datastructures();
suite_runner = srunner_create(suite);
srunner_run_all(suite_runner, CK_NORMAL);
number_failed += srunner_ntests_failed(suite_runner);
srunner_free(suite_runner);
return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
......@@ -33,3 +33,19 @@ Suite* suite_session(void)
return suite;
}
int main()
{
Suite* suite = NULL;
SRunner* suite_runner = NULL;
int number_failed = 0;
/* test session */
suite = suite_session();
suite_runner = srunner_create(suite);
srunner_run_all(suite_runner, CK_NORMAL);
number_failed += srunner_ntests_failed(suite_runner);
srunner_free(suite_runner);
return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
......@@ -86,3 +86,19 @@ Suite* suite_settings(void)
return suite;
}
int main()
{
Suite* suite = NULL;
SRunner* suite_runner = NULL;
int number_failed = 0;
/* test settings */
suite = suite_settings();
suite_runner = srunner_create(suite);
srunner_run_all(suite_runner, CK_NORMAL);
number_failed += srunner_ntests_failed(suite_runner);
srunner_free(suite_runner);
return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
......@@ -129,7 +129,6 @@ Suite* suite_template(void)
/* girara_template_new */
tcase = tcase_create("object creation");
tcase_add_checked_fixture(tcase, setup, NULL);
tcase_add_test(tcase, test_new);
tcase_add_test(tcase, test_new_with_null);
tcase_add_test(tcase, test_new_with_base);
......@@ -137,7 +136,6 @@ Suite* suite_template(void)
/* base processing */
tcase = tcase_create("base processing");
tcase_add_checked_fixture(tcase, setup, NULL);
tcase_add_test(tcase, test_base_variables_none);
tcase_add_test(tcase, test_base_variables_one);
tcase_add_test(tcase, test_base_variables_one_twice);
......@@ -145,7 +143,6 @@ Suite* suite_template(void)
/* basic variable operations */
tcase = tcase_create("variables");
tcase_add_checked_fixture(tcase, setup, NULL);
tcase_add_test(tcase, test_variable_add);
tcase_add_test(tcase, test_variable_add_invalid);
tcase_add_test(tcase, test_variable_set);
......@@ -153,10 +150,25 @@ Suite* suite_template(void)
/* full processing */
tcase = tcase_create("full");
tcase_add_checked_fixture(tcase, setup, NULL);
tcase_add_test(tcase, test_full_1);
tcase_add_test(tcase, test_full_2);
suite_add_tcase(suite, tcase);
return suite;
}
int main()
{
Suite* suite = NULL;
SRunner* suite_runner = NULL;
int number_failed = 0;
/* test template */
suite = suite_template();
suite_runner = srunner_create(suite);
srunner_run_all(suite_runner, CK_NORMAL);
number_failed += srunner_ntests_failed(suite_runner);
srunner_free(suite_runner);
return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
......@@ -309,3 +309,19 @@ Suite* suite_utils(void)
return suite;
}
int main()
{
Suite* suite = NULL;
SRunner* suite_runner = NULL;
int number_failed = 0;
/* test utils */
suite = suite_utils();
suite_runner = srunner_create(suite);
srunner_run_all(suite_runner, CK_NORMAL);
number_failed += srunner_ntests_failed(suite_runner);
srunner_free(suite_runner);
return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
/* See LICENSE file for license and copyright information */
#include <check.h>
#include <gtk/gtk.h>
#include <stdlib.h>
#include "tests.h"
......@@ -10,55 +8,3 @@ void setup(void)
{
gtk_init(NULL, NULL);
}
int main()
{
Suite* suite = NULL;
SRunner* suite_runner = NULL;
int number_failed = 0;
/* test utils */
suite = suite_utils();
suite_runner = srunner_create(suite);
srunner_run_all(suite_runner, CK_NORMAL);
number_failed += srunner_ntests_failed(suite_runner);
srunner_free(suite_runner);
/* test datastructures */
suite = suite_datastructures();
suite_runner = srunner_create(suite);
srunner_run_all(suite_runner, CK_NORMAL);
number_failed += srunner_ntests_failed(suite_runner);
srunner_free(suite_runner);
/* test settings */
suite = suite_settings();
suite_runner = srunner_create(suite);
srunner_run_all(suite_runner, CK_NORMAL);
number_failed += srunner_ntests_failed(suite_runner);
srunner_free(suite_runner);
/* test config */
suite = suite_config();
suite_runner = srunner_create(suite);
srunner_run_all(suite_runner, CK_NORMAL);
number_failed += srunner_ntests_failed(suite_runner);
srunner_free(suite_runner);
/* test session */
suite = suite_session();
suite_runner = srunner_create(suite);
srunner_run_all(suite_runner, CK_NORMAL);
number_failed += srunner_ntests_failed(suite_runner);
srunner_free(suite_runner);
/* test template */
suite = suite_template();
suite_runner = srunner_create(suite);
srunner_run_all(suite_runner, CK_NORMAL);
number_failed += srunner_ntests_failed(suite_runner);
srunner_free(suite_runner);
return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment