Compare commits
	
		
			6 Commits
		
	
	
		
			1.17
			...
			enable-tes
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| a175226ce3 | |||
| 7c53d75718 | |||
| fa32a03fbf | |||
| 53a6876830 | |||
| 629b15840a | |||
| ff3a7b02b6 | 
@ -2,16 +2,32 @@ image: debian:buster
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
stages:
 | 
					stages:
 | 
				
			||||||
  - build
 | 
					  - build
 | 
				
			||||||
 | 
					  - test
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.tags: &tags
 | 
				
			||||||
 | 
					  tags:
 | 
				
			||||||
 | 
					    - librem5
 | 
				
			||||||
 | 
					
 | 
				
			||||||
before_script:
 | 
					before_script:
 | 
				
			||||||
  - apt-get -y update
 | 
					  - apt-get -y update
 | 
				
			||||||
  - apt-get -y build-dep .
 | 
					  - apt-get -y build-dep .
 | 
				
			||||||
 | 
					
 | 
				
			||||||
build_meson:
 | 
					build_meson:
 | 
				
			||||||
 | 
					  <<: *tags
 | 
				
			||||||
  stage: build
 | 
					  stage: build
 | 
				
			||||||
  tags:
 | 
					  artifacts:
 | 
				
			||||||
    - librem5
 | 
					    paths:
 | 
				
			||||||
 | 
					      - _build
 | 
				
			||||||
  script:
 | 
					  script:
 | 
				
			||||||
    - meson . _build/ -Ddepdatadir=/usr/share
 | 
					    - meson . _build/ -Ddepdatadir=/usr/share
 | 
				
			||||||
    - ninja -C _build install
 | 
					    - ninja -C _build install
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					test:
 | 
				
			||||||
 | 
					  <<: *tags
 | 
				
			||||||
 | 
					  stage: test
 | 
				
			||||||
 | 
					  dependencies:
 | 
				
			||||||
 | 
					    - build_meson
 | 
				
			||||||
 | 
					  script:
 | 
				
			||||||
 | 
					    - export LC_ALL=C.UTF-8
 | 
				
			||||||
 | 
					    - ninja -C _build test
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -4,7 +4,11 @@ project(
 | 
				
			|||||||
    version: '1.0.10',
 | 
					    version: '1.0.10',
 | 
				
			||||||
    license: 'GPLv3',
 | 
					    license: 'GPLv3',
 | 
				
			||||||
    meson_version: '>=0.49.0',
 | 
					    meson_version: '>=0.49.0',
 | 
				
			||||||
    default_options: [ 'warning_level=1', 'buildtype=debugoptimized', 'c_std=gnu11' ],
 | 
					    default_options: [
 | 
				
			||||||
 | 
					        'warning_level=1',
 | 
				
			||||||
 | 
					        'buildtype=debugoptimized',
 | 
				
			||||||
 | 
					        'c_std=gnu11'
 | 
				
			||||||
 | 
					    ]
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
i18n = import('i18n')
 | 
					i18n = import('i18n')
 | 
				
			||||||
@ -43,3 +47,4 @@ subdir('protocols')
 | 
				
			|||||||
subdir('eek')
 | 
					subdir('eek')
 | 
				
			||||||
subdir('src')
 | 
					subdir('src')
 | 
				
			||||||
subdir('po')
 | 
					subdir('po')
 | 
				
			||||||
 | 
					subdir('tests')
 | 
				
			||||||
 | 
				
			|||||||
@ -1 +1,8 @@
 | 
				
			|||||||
option('depdatadir', type : 'string', value : '', description : 'System data path. Will be searched for definitions instead of datadir when provided')
 | 
					option('depdatadir',
 | 
				
			||||||
 | 
					       type : 'string',
 | 
				
			||||||
 | 
					       value : '',
 | 
				
			||||||
 | 
					       description : 'System data path. Will be searched for definitions instead of datadir when provided')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					option('tests',
 | 
				
			||||||
 | 
					       type: 'boolean', value: true,
 | 
				
			||||||
 | 
					       description: 'Whether to compile unit tests')
 | 
				
			||||||
 | 
				
			|||||||
@ -4,13 +4,16 @@ dbus_src = gnome.gdbus_codegen(
 | 
				
			|||||||
    join_paths(meson.source_root() / 'data' / 'dbus', 'sm.puri.OSK0.xml')
 | 
					    join_paths(meson.source_root() / 'data' / 'dbus', 'sm.puri.OSK0.xml')
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
config_h = configure_file(input: 'config.h.in', output: 'config.h',configuration: conf_data)
 | 
					config_h = configure_file(
 | 
				
			||||||
 | 
					    input: 'config.h.in',
 | 
				
			||||||
 | 
					    output: 'config.h',
 | 
				
			||||||
 | 
					    configuration: conf_data
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
sources = [
 | 
					sources = [
 | 
				
			||||||
  config_h,
 | 
					  config_h,
 | 
				
			||||||
  'imservice.c',
 | 
					  'imservice.c',
 | 
				
			||||||
  'server-context-service.c',
 | 
					  'server-context-service.c',
 | 
				
			||||||
  'server-main.c',
 | 
					 | 
				
			||||||
  'wayland.c',
 | 
					  'wayland.c',
 | 
				
			||||||
  '../eek/eek.c',
 | 
					  '../eek/eek.c',
 | 
				
			||||||
  '../eek/eek-container.c',
 | 
					  '../eek/eek-container.c',
 | 
				
			||||||
@ -71,11 +74,24 @@ rslib = static_library(
 | 
				
			|||||||
  rust_crate_type: 'staticlib'
 | 
					  rust_crate_type: 'staticlib'
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
squeekboard = executable('squeekboard',
 | 
					libsqueekboard = static_library('libsqueekboard',
 | 
				
			||||||
  sources,
 | 
					  sources,
 | 
				
			||||||
  link_with: rslib,
 | 
					  link_with: rslib,
 | 
				
			||||||
  include_directories: [include_directories('..'), include_directories('../eek')],
 | 
					  include_directories: [include_directories('..'), include_directories('../eek')],
 | 
				
			||||||
  dependencies: deps,
 | 
					  dependencies: deps,
 | 
				
			||||||
 | 
					  c_args: [
 | 
				
			||||||
 | 
					    '-DTHEMESDIR="' + pkgdatadir + '/themes"',
 | 
				
			||||||
 | 
					    '-DKEYBOARDSDIR="' + pkgdatadir + '/keyboards"',
 | 
				
			||||||
 | 
					    '-DEEKBOARD_COMPILATION=1',
 | 
				
			||||||
 | 
					    '-DEEK_COMPILATION=1'],
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					squeekboard = executable('squeekboard',
 | 
				
			||||||
 | 
					  'server-main.c',
 | 
				
			||||||
 | 
					  wl_proto_sources,
 | 
				
			||||||
 | 
					  link_with: libsqueekboard,
 | 
				
			||||||
 | 
					  include_directories: [include_directories('..'), include_directories('../eek')],
 | 
				
			||||||
 | 
					  dependencies: deps,
 | 
				
			||||||
  install: true,
 | 
					  install: true,
 | 
				
			||||||
  c_args: [
 | 
					  c_args: [
 | 
				
			||||||
    '-DTHEMESDIR="' + pkgdatadir + '/themes"',
 | 
					    '-DTHEMESDIR="' + pkgdatadir + '/themes"',
 | 
				
			||||||
@ -83,4 +99,3 @@ squeekboard = executable('squeekboard',
 | 
				
			|||||||
    '-DEEKBOARD_COMPILATION=1',
 | 
					    '-DEEKBOARD_COMPILATION=1',
 | 
				
			||||||
    '-DEEK_COMPILATION=1'],
 | 
					    '-DEEK_COMPILATION=1'],
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
				
			|||||||
@ -30,16 +30,15 @@ test_create (void)
 | 
				
			|||||||
    section = eek_keyboard_create_section (keyboard);
 | 
					    section = eek_keyboard_create_section (keyboard);
 | 
				
			||||||
    g_assert (EEK_IS_SECTION(section));
 | 
					    g_assert (EEK_IS_SECTION(section));
 | 
				
			||||||
    eek_section_add_row (section, 2, EEK_ORIENTATION_HORIZONTAL);
 | 
					    eek_section_add_row (section, 2, EEK_ORIENTATION_HORIZONTAL);
 | 
				
			||||||
    key0 = eek_section_create_key (section, 1, 0, 0);
 | 
					    key0 = eek_section_create_key (section, "key0", 1, 0, 0);
 | 
				
			||||||
    g_assert (EEK_IS_KEY(key0));
 | 
					    g_assert (EEK_IS_KEY(key0));
 | 
				
			||||||
    key1 = eek_section_create_key (section, 2, 1, 0);
 | 
					    key1 = eek_section_create_key (section, "key1", 2, 1, 0);
 | 
				
			||||||
    g_assert (EEK_IS_KEY(key1));
 | 
					    g_assert (EEK_IS_KEY(key1));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int
 | 
					int
 | 
				
			||||||
main (int argc, char **argv)
 | 
					main (int argc, char **argv)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    g_type_init ();
 | 
					 | 
				
			||||||
    g_test_init (&argc, &argv, NULL);
 | 
					    g_test_init (&argc, &argv, NULL);
 | 
				
			||||||
    g_test_add_func ("/eek-simple-test/create", test_create);
 | 
					    g_test_add_func ("/eek-simple-test/create", test_create);
 | 
				
			||||||
    return g_test_run ();
 | 
					    return g_test_run ();
 | 
				
			||||||
 | 
				
			|||||||
@ -36,7 +36,9 @@ test_output_parse (void)
 | 
				
			|||||||
    layout = eek_xml_layout_new ("us", &error);
 | 
					    layout = eek_xml_layout_new ("us", &error);
 | 
				
			||||||
    g_assert_no_error (error);
 | 
					    g_assert_no_error (error);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    keyboard = eek_keyboard_new (layout, 640, 480);
 | 
					    /* We don't need the context service to parse an XML file, so we can pass
 | 
				
			||||||
 | 
					       NULL when creating a keyboard. */
 | 
				
			||||||
 | 
					    keyboard = eek_keyboard_new (NULL, layout, 640, 480);
 | 
				
			||||||
    g_object_unref (layout);
 | 
					    g_object_unref (layout);
 | 
				
			||||||
    g_object_unref (keyboard);
 | 
					    g_object_unref (keyboard);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -44,7 +46,6 @@ test_output_parse (void)
 | 
				
			|||||||
int
 | 
					int
 | 
				
			||||||
main (int argc, char **argv)
 | 
					main (int argc, char **argv)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    g_type_init ();
 | 
					 | 
				
			||||||
    g_test_init (&argc, &argv, NULL);
 | 
					    g_test_init (&argc, &argv, NULL);
 | 
				
			||||||
    gtk_init (&argc, &argv);  /* for gdk_x11_display_get_xdisplay() */
 | 
					    gtk_init (&argc, &argv);  /* for gdk_x11_display_get_xdisplay() */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										49
									
								
								tests/meson.build
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								tests/meson.build
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,49 @@
 | 
				
			|||||||
 | 
					if get_option('tests')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					test_env = [
 | 
				
			||||||
 | 
					  'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
 | 
				
			||||||
 | 
					  'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
 | 
				
			||||||
 | 
					  'G_DEBUG=gc-friendly,fatal-warnings',
 | 
				
			||||||
 | 
					  'GSETTINGS_BACKEND=memory',
 | 
				
			||||||
 | 
					  'MALLOC_CHECK_=2'
 | 
				
			||||||
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					test_cflags = [
 | 
				
			||||||
 | 
					  '-I@0@/../src'.format(meson.current_source_dir()),
 | 
				
			||||||
 | 
					  '-I@0@/../src'.format(meson.current_build_dir()),
 | 
				
			||||||
 | 
					  '-DEEK_COMPILATION',
 | 
				
			||||||
 | 
					  '-DEEKBOARD_COMPILATION'
 | 
				
			||||||
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					test_link_args = [
 | 
				
			||||||
 | 
					  '-fPIC',
 | 
				
			||||||
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					tests = [
 | 
				
			||||||
 | 
					  'eek-simple-test',
 | 
				
			||||||
 | 
					  'eek-xml-test'
 | 
				
			||||||
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					foreach name : tests
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    test_sources = [name + '.c']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    t = executable(
 | 
				
			||||||
 | 
					        name,
 | 
				
			||||||
 | 
					        test_sources,
 | 
				
			||||||
 | 
					        squeekboard_resources,
 | 
				
			||||||
 | 
					        link_with: libsqueekboard,
 | 
				
			||||||
 | 
					        c_args : test_cflags,
 | 
				
			||||||
 | 
					        link_args: test_link_args,
 | 
				
			||||||
 | 
					        dependencies: deps,       # from src/meson.build
 | 
				
			||||||
 | 
					        include_directories: [
 | 
				
			||||||
 | 
					            include_directories('..'),
 | 
				
			||||||
 | 
					            include_directories('../eek')
 | 
				
			||||||
 | 
					        ]
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    test(name, t, env: test_env)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					endforeach
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					endif
 | 
				
			||||||
		Reference in New Issue
	
	Block a user