[vlc-commits] [Git][videolan/vlc][master] 4 commits: meson: generalize test infrastructure

Steve Lhomme (@robUx4) gitlab at videolan.org
Mon Jan 22 17:53:27 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
ee393c14 by Alexandre Janniaux at 2024-01-22T17:37:31+00:00
meson: generalize test infrastructure

By moving vlc_tests array declaration from test/meson.build to the root
folder, we can create tests from anywhere in the code base.

- - - - -
f5f18211 by Alexandre Janniaux at 2024-01-22T17:37:31+00:00
test: meson.build: allow moc sources as test input

Generate the moc sources from specified headers for test requiring moc
to be run before. When Qt is not found, the test must be skipped from
vlc_tests array.

- - - - -
ad9c0d46 by Alexandre Janniaux at 2024-01-22T17:37:31+00:00
qt: meson.build: expose base_model test

The test has been merged into autotools[^1] but wasn't ported to meson.

[^1]: 4ddc948f389ca53572cdd41119f6ebf06eb5758a

- - - - -
6e8611d6 by Alexandre Janniaux at 2024-01-22T17:37:31+00:00
qt: meson.build: expose QML tests independantly

Equivalent to commit d8e941f575f069ca93d0b0a41a3309a902dbb7e7 for
meson.build.

- - - - -


3 changed files:

- meson.build
- modules/gui/qt/meson.build
- test/meson.build


Changes:

=====================================
meson.build
=====================================
@@ -116,6 +116,8 @@ foreach d : feature_defines
     vlc_conf_prefix = vlc_conf_prefix + '#define @0@ @1@\n'.format(d.get(0), d.get(1))
 endforeach
 
+vlc_tests = []
+
 #
 # SIMD support
 #


=====================================
modules/gui/qt/meson.build
=====================================
@@ -539,6 +539,10 @@ if host_system == 'windows'
   qrc_files += files('windows.qrc')
 endif
 
+qml_tests = {
+    'tst_FSM': files('tests/tst_FSM.qml'),
+}
+
 if qt5_dep.found()
     qt5pre_qrc = qt5.preprocess(
         qresources: qrc_files,
@@ -705,6 +709,25 @@ if qt5_dep.found()
           dependencies: [test_qt5_dep],
           cpp_args: ['-DQUICK_TEST_SOURCE_DIR="' + meson.current_source_dir() + '/tests"']
         )
-        test('qml_test', qml_test, suite:'qt')
+        foreach test_name, test_file : qml_tests
+              test(test_name, qml_test, args: ['-input', test_file], suite:'qt')
+        endforeach
     endif
+
+    vlc_tests += {
+        'name': 'base_model_test',
+        'sources': files(
+            'tests/test_base_model.cpp',
+            'util/base_model.cpp',
+            'util/base_model.hpp',
+            'util/base_model_p.hpp'),
+        'moc_headers': files(
+            'util/base_model.hpp',
+            'util/listcache.hpp',
+            'util/locallistcacheloader.hpp'),
+        'suite': ['qt'],
+        'link_with': [libvlccore],
+        'dependencies': [qt5_dep, qt_extra_deps],
+    }
 endif
+


=====================================
test/meson.build
=====================================
@@ -1,5 +1,3 @@
-vlc_tests = []
-
 subdir('src')
 subdir('modules')
 subdir('libvlc')
@@ -16,6 +14,7 @@ foreach vlc_test: vlc_tests
     valid_dict_keys = [
         'name',
         'sources',
+        'moc_headers',
         'suite',
         'link_with',
         'module_depends',
@@ -47,8 +46,15 @@ foreach vlc_test: vlc_tests
         test_modules_deps += vlc_plugins_targets[module_name]
     endforeach
 
+    moc_sources = []
+    if vlc_test.has_key('moc_headers') and qt5_dep.found()
+        moc_sources += qt5.preprocess(moc_headers: vlc_test['moc_headers'],
+        include_directories: qt_include_dir,
+        dependencies: qt5_dep)
+    endif
+
     test(vlc_test['name'],
-        executable(vlc_test['name'], vlc_test['sources'],
+        executable(vlc_test['name'], vlc_test['sources'], moc_sources,
             build_by_default: false,
             link_with: [vlc_test.get('link_with', []),
                 vlc_libcompat],



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/af374ba7224ea342fe43443b306eac0a856f8784...6e8611d6138f01588c9f6012b21246fd979625da

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/af374ba7224ea342fe43443b306eac0a856f8784...6e8611d6138f01588c9f6012b21246fd979625da
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list