meson.build 2.45 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
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',
]

22
c_tests = [
23 24
]

25
foreach name : c_tests
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46

    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

47 48
# The layout test is in the examples directory
# due to the way Cargo builds executables
49 50 51 52 53 54
# and the need to call it manually.

# This is the list of tested builtin layouts.
# Please keep each block alphabetical!
# Please keep shapes (with _) on the same line,
# variants (with +) on separate lines.
Dorota Czaplejewicz's avatar
Dorota Czaplejewicz committed
55
foreach layout : [
56 57 58 59 60
    # This is the fallback layout,
    # so stays first to make sure it never goes missing.
    'us', 'us_wide',

    # Block: Languages
61
    'be', 'be_wide',
62
    'bg',
63
    'br',
Jiří Stránský's avatar
Jiří Stránský committed
64 65
    'cz', 'cz_wide',
    'cz+qwerty', 'cz+qwerty_wide',
Mark Müller's avatar
Mark Müller committed
66
    'de', 'de_wide',
Ole Guldberg's avatar
Ole Guldberg committed
67
    'dk',
Stefan Grotz's avatar
Stefan Grotz committed
68
    'epo',
Dorota Czaplejewicz's avatar
Dorota Czaplejewicz committed
69
    'es',
Dorota Czaplejewicz's avatar
Dorota Czaplejewicz committed
70
    'fi',
71
    'fr', 'fr_wide',
72
    'gr',
73
    'ir',
Dorota Czaplejewicz's avatar
Dorota Czaplejewicz committed
74
    'it',
75
    'it+fur',
76
    'jp+kana','jp+kana_wide',
77
    'no',
78
    'pl', 'pl_wide',
Vlad's avatar
Vlad committed
79
    'ru',
80
    'se',
81
    'th',
82 83
    'ua',
    'us+colemak',
84

85
    # Block: Not languages.
86
    'emoji',
87 88
    'number',
    'terminal', 'terminal_wide',
Dorota Czaplejewicz's avatar
Dorota Czaplejewicz committed
89
]
90 91 92 93
    extra = []
    if layout == 'emoji'
        extra += ['allow_missing_return']
    endif
94 95 96 97 98 99 100 101 102 103
    
    # Older Cargo seens to be sensitive to something
    # about the RUST_FLAGS env var, and rebuilds all tests when it's set,
    # increasing test time by 2 orders of magnitude.
    # Let it have its way.
    if get_option('legacy') == true
        timeout = 300
    else
        timeout = 30
    endif
104 105 106
    test(
        'test_layout_' + layout,
        cargo_script,
107
        args: ['run'] + cargo_build_flags
108 109
            + ['--example', 'test_layout', '--', layout]
            + extra,
110
        timeout: timeout,
111
        workdir: meson.build_root(),
112 113 114
    )
endforeach

115
endif