File: meson.build

package info (click to toggle)
bless 0.6.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,960 kB
  • sloc: cs: 15,261; xml: 1,954; sh: 18; makefile: 15; python: 4
file content (90 lines) | stat: -rw-r--r-- 2,308 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
nunit_console = find_program('nunit-console', required: false)
nunit_dep = dependency('nunit', required: false)

if not nunit_dep.found()
    error('nunit not found, cannot build tests. You can disable with -Dtests=false')
endif

test_env = environment()
test_env.append('MONO_PATH', src_build_dir)

tests_buffers_lib = library(
    'BlessTests.Buffers',
    files(
        'buffers/ByteBufferTests.cs',
        'buffers/FileBufferTests.cs',
        'buffers/SegmentCollectionTests.cs',
        'buffers/SegmentTests.cs',
        'buffers/SimpleBufferTests.cs',
    ),
    dependencies: nunit_dep,
    link_with: [
        buffers_lib,
        util_lib,
    ],
)

# The tests expect the test data files to be in the directory the runner runs in.
# nunit-console changes directory to the module under test before running,
# so copy the data files to that same build directory.
meson.add_postconf_script(
    'copy_test_data.py',
    join_paths(meson.current_source_dir(), 'buffers', 'test1.bin'),
    join_paths(meson.current_build_dir(), 'test1.bin'))

if get_option('run_tests')
    if not nunit_console.found()
        warning('nunit-console not found, cannot run tests. You can disable with -Drun_tests=false')
        subdir_done()
    endif

    test(
        'Buffers',
        nunit_console,
        args: tests_buffers_lib,
        env: test_env,
    )

    tests_tools_export_lib = library(
        'BlessTests.Tools.Export',
        files(
            'tools/export/ExporterTests.cs',
        ),
        dependencies: nunit_dep,
        link_with: [
            buffers_lib,
            tools_export_lib,
            tools_export_plugins_lib,
        ],
    )

    test(
        'Tools.Export',
        nunit_console,
        args: tests_tools_export_lib,
        env: test_env,
    )

    tests_util_lib = library(
        'BlessTests.Util',
        files(
            'util/ByteArrayTests.cs',
            'util/DequeTests.cs',
            'util/IntervalTreeTests.cs',
            'util/ListTests.cs',
            'util/RangeTests.cs',
            'util/RedBlackTreeTests.cs',
        ),
        dependencies: nunit_dep,
        link_with: [
            util_lib,
        ],
    )

    test(
        'Util',
        nunit_console,
        args: tests_util_lib,
        env: test_env,
    )
endif