[tracker-miners: 3/5] tests: Use meson test suites to group tests



commit 58c96a81631bdbad33c75c7e75f7c8943932792c
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Fri Aug 23 00:13:51 2019 +0200

    tests: Use meson test suites to group tests
    
    Instead of using old-style separators for tests, use native meson suites.
    Use some "smarter" name parsing in order to generate suite from the naming
    conventions we already use.
    
    So we can optionally just run (or not) one test suite.

 tests/functional-tests/meson.build         | 28 ++++++++++++++++++++++++++--
 tests/libtracker-extract/meson.build       |  5 ++---
 tests/libtracker-miners-common/meson.build |  3 +--
 3 files changed, 29 insertions(+), 7 deletions(-)
---
diff --git a/tests/functional-tests/meson.build b/tests/functional-tests/meson.build
index a5ae5e4d6..827e82a1e 100644
--- a/tests/functional-tests/meson.build
+++ b/tests/functional-tests/meson.build
@@ -140,17 +140,41 @@ test_env.set('TRACKER_FUNCTIONAL_TEST_CONFIG', config_json_full_path)
 
 foreach t: extractor_tests
   data = join_paths('test-extraction-data', t) + '.expected.json'
-  test('functional/extract/' + t, python,
+  test_name = t
+  test_parts = t.split('/')
+  test_suite = []
+  if test_parts.length() == 2
+    test_name = test_parts[1]
+    test_suite = [test_parts[0]]
+  endif
+  test(test_name, python,
     args: ['400-extractor-metadata.py', data],
     env: test_env,
+    suite: ['extractor'] + test_suite,
     workdir: meson.current_source_dir())
 endforeach
 
 foreach t: functional_tests
   file = '@0@.py'.format(t)
-  test('functional-' + t, python,
+  test_parts = t.split('-')
+  test_name = t
+  test_suite = []
+  if test_parts.length() > 1
+    test_suite = [test_parts[1]]
+    parts = []
+    i = 0
+    foreach p: test_parts
+      if i > 1
+        parts += p
+      endif
+      i += 1
+    endforeach
+    test_name = '-'.join(parts)
+  endif
+  test(test_name, python,
     args: [file],
     env: test_env,
     workdir: meson.current_source_dir(),
+    suite: ['functional'] + test_suite,
     timeout: 120)
 endforeach
diff --git a/tests/libtracker-extract/meson.build b/tests/libtracker-extract/meson.build
index ba1b02f70..65f6da074 100644
--- a/tests/libtracker-extract/meson.build
+++ b/tests/libtracker-extract/meson.build
@@ -20,13 +20,12 @@ libtracker_extract_test_deps = [
 foreach base_name: libtracker_extract_tests
     source = 'tracker-@0@-test.c'.format(base_name)
     binary_name = 'tracker-@0@-test'.format(base_name)
-    test_name = 'extract-@0@'.format(base_name)
 
     binary = executable(binary_name, source,
       dependencies: libtracker_extract_test_deps,
       c_args: test_c_args)
 
-    test(test_name, binary)
+    test(base_name, binary, suite: 'extract')
 endforeach
 
 if libiptcdata.found() and libjpeg.found()
@@ -35,5 +34,5 @@ if libiptcdata.found() and libjpeg.found()
     dependencies: libtracker_extract_test_deps + [libjpeg],
     c_args: test_c_args,
   )
-  test('extract-iptc', iptc_test)
+  test('extract-iptc', iptc_test, suite: 'extract')
 endif
diff --git a/tests/libtracker-miners-common/meson.build b/tests/libtracker-miners-common/meson.build
index 1669a3eec..d284a66a1 100644
--- a/tests/libtracker-miners-common/meson.build
+++ b/tests/libtracker-miners-common/meson.build
@@ -14,11 +14,10 @@ libtracker_miners_common_test_deps = [
 foreach base_name: libtracker_common_tests
     source = 'tracker-@0@-test.c'.format(base_name)
     binary_name = 'tracker-@0@-test'.format(base_name)
-    test_name = 'miners-common-@0@'.format(base_name)
 
     binary = executable(binary_name, source,
       dependencies: libtracker_miners_common_test_deps,
       c_args: test_c_args)
 
-    test(test_name, binary)
+    test(base_name, binary, suite: 'miners-common')
 endforeach


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]