openzim / libzim

Reference implementation of the ZIM specification
https://download.openzim.org/release/libzim/
GNU General Public License v2.0
166 stars 49 forks source link

Add option for disabling tests #849

Closed data-man closed 8 months ago

data-man commented 10 months ago

Also I propose rename test directory to tests.

kelson42 commented 10 months ago

@data-man Which commands exactly run the tests and for which you would like to have a variant which would not?

data-man commented 10 months ago

I'm currently commenting out subdir('test') in meson.build for speed up compilation.

data-man commented 10 months ago

The possible patch:

diff --git a/meson.build b/meson.build
index 53b7522..13bfbae 100644
--- a/meson.build
+++ b/meson.build
@@ -91,7 +91,9 @@ subdir('src')
 if get_option('examples')
   subdir('examples')
 endif
-subdir('test')
+if get_option('tests')
+subdir('tests')
+endif
 if get_option('doc')
   subdir('docs')
 endif
diff --git a/meson_options.txt b/meson_options.txt
index f1bf953..253c773 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -18,6 +18,8 @@ option('doc', type : 'boolean', value : false,
   description : 'Build the documentations.')
 option('examples', type : 'boolean', value : true,
   description : 'Build the examples.')
+option('tests', type : 'boolean', value : true,
+  description : 'Build the tests.')
 option('with_xapian', type : 'boolean', value: true,
   description: 'Build libzim with xapian support')
 option('test_data_dir', type : 'string', value: '',
kelson42 commented 10 months ago

tests are not executed by running:

meson . build
ninja -C build

like written in the README.md, so I don't understand the problem.

data-man commented 10 months ago

I don't understand the problem.

Problem is slow compilation.

kelson42 commented 10 months ago

@data-man Please give me clear reproduction steps, what it does and what you expect to be done.

data-man commented 10 months ago
meson . build
ninja -C build

ninja: Entering directory `build' [0/133] ...

After commenting out subdir('test') in meson.build:

ninja: Entering directory `build' [1/46] ...

I don't want to compile unnecessary files.

kelson42 commented 10 months ago

Got it! Makes sense, would you be able to make a PR tackling the two points you have reported?