Skip to content

Commit bff3b36

Browse files
committed
meson: add tests
Localization is not implemented. Signed-off-by: Rosen Penev <[email protected]>
1 parent 4c380a2 commit bff3b36

File tree

4 files changed

+57
-6
lines changed

4 files changed

+57
-6
lines changed

.github/workflows/on_PR_meson.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474

7575
- name: Compile and Test
7676
run: |
77-
meson setup "${{github.workspace}}/build" --wrap-mode=${{matrix.deps}} -Dwarning_level=3 -Dcpp_std=c++latest -Db_sanitize=address
77+
meson setup "${{github.workspace}}/build" --wrap-mode=${{matrix.deps}} -Dwarning_level=3 -Dcpp_std=c++latest -Ddefault_library=static
7878
meson compile -C "${{github.workspace}}/build" --verbose
7979
meson test -C "${{github.workspace}}/build" --verbose
8080
VisualStudio-clang-cl:
@@ -97,7 +97,7 @@ jobs:
9797
CC: clang-cl
9898
CXX: clang-cl
9999
run: |
100-
meson setup "${{github.workspace}}/build" --wrap-mode=${{matrix.deps}} -Dwarning_level=3 -Dcpp_std=c++latest -Db_sanitize=address
100+
meson setup "${{github.workspace}}/build" --wrap-mode=${{matrix.deps}} -Dwarning_level=3 -Dcpp_std=c++latest -Db_sanitize=address -Ddefault_library=static
101101
meson compile -C "${{github.workspace}}/build" --verbose
102102
meson test -C "${{github.workspace}}/build" --verbose
103103
MSYS2:
@@ -133,7 +133,7 @@ jobs:
133133
134134
- name: Compile and Test
135135
run: |
136-
meson setup "${{github.workspace}}/build" -Dauto_features=${{matrix.deps}} -Dwarning_level=3
136+
meson setup "${{github.workspace}}/build" -Dauto_features=${{matrix.deps}} -Dwarning_level=3 -Ddefault_library=static
137137
meson compile -C "${{github.workspace}}/build" --verbose
138138
meson test -C "${{github.workspace}}/build" --verbose
139139
MSYS:
@@ -182,7 +182,7 @@ jobs:
182182
- uses: vmactions/freebsd-vm@v1
183183
with:
184184
prepare: |
185-
pkg install -y cmake curl ninja meson gettext pkgconf googletest expat inih brotli libfmt
185+
pkg install -y cmake curl ninja meson gettext python pkgconf googletest expat inih brotli
186186
run: |
187187
meson setup "${{github.workspace}}/build" -Dwarning_level=3
188188
meson compile -C "${{github.workspace}}/build" --verbose

meson.build

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ executable(
159159
install: true,
160160
)
161161

162+
subdir('unitTests')
163+
subdir('po')
164+
162165
samples = {
163166
'addmoddel': [],
164167
'conntest': web_dep,
@@ -175,6 +178,7 @@ samples = {
175178
'iptceasy': [],
176179
'iptcprint': [],
177180
'iptctest': [],
181+
'jpegparsetest': [],
178182
'key-test': [],
179183
'largeiptc-test': [],
180184
'mmap-test': [],
@@ -208,5 +212,5 @@ foreach g : gopt
208212
executable(g, 'samples/@[email protected]'.format(g), 'app/getopt.cpp', dependencies: exiv2_dep, include_directories: [exiv2inc, ginc])
209213
endforeach
210214

211-
subdir('unitTests')
212-
subdir('po')
215+
bindir = 'EXIV2_BINDIR=@0@'.format(meson.current_build_dir())
216+
subdir('tests')

meson_options.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ option('unitTests', type : 'feature',
4545
description : 'Build and run unit tests',
4646
)
4747

48+
option('tests', type : 'feature',
49+
description : 'Build and run Python tests',
50+
)
51+
4852
option('webready', type : 'boolean',
4953
value: true,
5054
description : 'Build with support for webready',

tests/meson.build

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
runner = find_program('runner.py', required: get_option('tests'))
2+
if not runner.found()
3+
subdir_done()
4+
endif
5+
6+
# these are all needed. Not sure if conditional testing is desired.
7+
if not (brotli_dep.found() and expat_dep.found() and inih_dep.found() and web_dep.found() and zlib_dep.found())
8+
subdir_done()
9+
endif
10+
11+
# windows does conversion without iconv
12+
if not (host_machine.system() == 'windows' or iconv_dep.found())
13+
subdir_done()
14+
endif
15+
16+
tests = {
17+
'bashTests': 'bash_tests',
18+
'bugfixTests': 'bugfixes',
19+
'lensTests': 'lens_tests',
20+
'tiffTests': 'tiff_test',
21+
'versionTests': 'bash_tests/version_test.py',
22+
}
23+
24+
foreach n, t : tests
25+
test(
26+
n,
27+
runner,
28+
env: bindir,
29+
args: ['--verbose', t],
30+
timeout: 1200,
31+
workdir: meson.current_source_dir(),
32+
)
33+
endforeach
34+
35+
test(
36+
'regressionTests',
37+
runner,
38+
env: bindir,
39+
args: ['--verbose', 'regression_tests'],
40+
timeout: 1200,
41+
is_parallel: false,
42+
workdir: meson.current_source_dir(),
43+
)

0 commit comments

Comments
 (0)