[tracker: 1/3] tests: Use meson suites



commit 8a747ea71e3840cbd8e771ea5c6b17e2657fc7a9
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Tue Oct 1 03:43:18 2019 +0200

    tests: Use meson suites
    
    Make possible to easily (not) run a sub-set of tests by using suites in
    tracker.
    
    Fixes https://gitlab.gnome.org/GNOME/tracker/issues/153

 tests/functional-tests/ipc/meson.build |  8 +++++---
 tests/functional-tests/meson.build     | 16 +++++++++++++++-
 tests/gvdb/meson.build                 |  1 +
 tests/libtracker-common/meson.build    |  6 +++---
 tests/libtracker-data/meson.build      |  8 ++++----
 tests/libtracker-fts/meson.build       |  1 +
 tests/libtracker-miner/meson.build     | 10 +++++-----
 tests/libtracker-sparql/meson.build    |  6 ++++--
 tests/meson.build                      | 13 ++++++++-----
 tests/tracker-steroids/meson.build     |  1 +
 10 files changed, 47 insertions(+), 23 deletions(-)
---
diff --git a/tests/functional-tests/ipc/meson.build b/tests/functional-tests/ipc/meson.build
index e8e85d0dc..4bcfb0540 100644
--- a/tests/functional-tests/ipc/meson.build
+++ b/tests/functional-tests/ipc/meson.build
@@ -17,16 +17,18 @@ test_env.set('TRACKER_TEST_DOMAIN_ONTOLOGY_RULE', tracker_uninstalled_domain_rul
 insert_or_replace_test = executable('test-insert-or-replace',
   'test-insert-or-replace.vala', tracker_sparql_vapi,
   dependencies: [tracker_common_dep, tracker_sparql_dep])
-test('functional-ipc-insert-or-replace', python,
+test('insert-or-replace', python,
   args: sandbox_args + [insert_or_replace_test],
-  env: test_env)
+  env: test_env,
+  suite: ['functional', 'ipc'])
 
 bus_query_cancellation_test = executable('test-bus-query-cancellation',
   'test-bus-query-cancellation.c',
   c_args: functional_ipc_test_c_args,
   dependencies: [tracker_common_dep, tracker_sparql_dep])
 
-test('functional-ipc-bus-query-cancellation', python,
+test('bus-query-cancellation', python,
   args: sandbox_args + [bus_query_cancellation_test],
   env: test_env,
+  suite: ['functional', 'ipc'],
   timeout: 60)
diff --git a/tests/functional-tests/meson.build b/tests/functional-tests/meson.build
index 8bc70c446..48be0f55e 100644
--- a/tests/functional-tests/meson.build
+++ b/tests/functional-tests/meson.build
@@ -46,10 +46,24 @@ test_env.set('TRACKER_FUNCTIONAL_TEST_CONFIG', config_json_full_path)
 
 foreach t: functional_tests
   file = '@0@.py'.format(t)
-  test('functional-' + t, python,
+  test_parts = t.split('-')
+  test_name = t
+  if test_parts.length() > 1
+    parts = []
+    i = 0
+    foreach p: test_parts
+      if i > 0
+        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'],
     timeout: 60)
 endforeach
 
diff --git a/tests/gvdb/meson.build b/tests/gvdb/meson.build
index 5d8fcf948..558f0f4e2 100644
--- a/tests/gvdb/meson.build
+++ b/tests/gvdb/meson.build
@@ -7,4 +7,5 @@ gvdb_test = executable('gvdb-test',
 tests += {
   'name': 'gvdb',
   'exe': gvdb_test,
+  'suite': ['gvdb']
 }
diff --git a/tests/libtracker-common/meson.build b/tests/libtracker-common/meson.build
index 55b7ada50..f6618f930 100644
--- a/tests/libtracker-common/meson.build
+++ b/tests/libtracker-common/meson.build
@@ -14,15 +14,15 @@ libtracker_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 = 'common-@0@'.format(base_name)
 
     binary = executable(binary_name, source,
       dependencies: libtracker_common_test_deps,
       c_args: test_c_args)
 
     tests += {
-        'name': test_name,
-        'exe': binary
+        'name': base_name,
+        'exe': binary,
+        'suite': ['common']
     }
 endforeach
 
diff --git a/tests/libtracker-data/meson.build b/tests/libtracker-data/meson.build
index f43720bc3..74fc2046e 100644
--- a/tests/libtracker-data/meson.build
+++ b/tests/libtracker-data/meson.build
@@ -15,15 +15,15 @@ libtracker_data_test_deps = [tracker_common_dep, tracker_data_dep, tracker_sparq
 foreach base_name: libtracker_data_tests
     source = 'tracker-@0@-test.c'.format(base_name)
     binary_name = 'tracker-@0@-test'.format(base_name)
-    test_name = 'data-@0@'.format(base_name)
 
     binary = executable(binary_name, source,
       dependencies: libtracker_data_test_deps,
       c_args: test_c_args)
 
     tests += {
-      'name': test_name,
+      'name': base_name,
       'exe': binary,
+      'suite': ['data'],
       'requires_dbus': true,
     }
 endforeach
@@ -31,15 +31,15 @@ endforeach
 foreach base_name: libtracker_data_slow_tests
     source = 'tracker-@0@-test.c'.format(base_name)
     binary_name = 'tracker-@0@-test'.format(base_name)
-    test_name = 'data-@0@'.format(base_name)
 
     binary = executable(binary_name, source,
       dependencies: libtracker_data_test_deps,
       c_args: test_c_args)
 
       tests += {
-        'name': test_name,
+        'name': base_name,
         'exe': binary,
+        'suite': ['data', 'slow'],
         'requires_dbus': true,
         'timeout': 180
     }
diff --git a/tests/libtracker-fts/meson.build b/tests/libtracker-fts/meson.build
index 7de35649b..536a227a7 100644
--- a/tests/libtracker-fts/meson.build
+++ b/tests/libtracker-fts/meson.build
@@ -7,5 +7,6 @@ fts_test = executable('tracker-fts-test',
 tests += {
   'name': 'fts',
   'exe': fts_test,
+  'suite': ['fts'],
   'requires_dbus': true,
 }
diff --git a/tests/libtracker-miner/meson.build b/tests/libtracker-miner/meson.build
index c441223ca..d01937469 100644
--- a/tests/libtracker-miner/meson.build
+++ b/tests/libtracker-miner/meson.build
@@ -27,7 +27,6 @@ libtracker_miner_test_deps = [tracker_common_dep, tracker_miner_dep, tracker_spa
 foreach base_name: libtracker_miner_tests
     source = 'tracker-@0@-test.c'.format(base_name)
     binary_name = 'tracker-@0@-test'.format(base_name)
-    test_name = 'miner-@0@'.format(base_name)
 
     binary = executable(binary_name, source,
       dependencies: libtracker_miner_test_deps,
@@ -35,15 +34,15 @@ foreach base_name: libtracker_miner_tests
       link_with: [libtracker_miner_private])
 
     tests += {
-      'name': test_name,
-      'exe': binary
+      'name': base_name,
+      'exe': binary,
+      'suite': ['miner'],
     }
 endforeach
 
 foreach base_name: libtracker_miner_slow_tests
     source = 'tracker-@0@-test.c'.format(base_name)
     binary_name = 'tracker-@0@-test'.format(base_name)
-    test_name = 'miner-@0@'.format(base_name)
 
     binary = executable(binary_name, source,
       dependencies: libtracker_miner_test_deps,
@@ -51,8 +50,9 @@ foreach base_name: libtracker_miner_slow_tests
       link_with: [libtracker_miner_private])
 
     tests += {
-      'name': test_name,
+      'name': base_name,
       'exe': binary,
+      'suite': ['miner', 'slow'],
       'timeout': 180
     }
 endforeach
diff --git a/tests/libtracker-sparql/meson.build b/tests/libtracker-sparql/meson.build
index 7dc9e9813..1eef9387f 100644
--- a/tests/libtracker-sparql/meson.build
+++ b/tests/libtracker-sparql/meson.build
@@ -14,8 +14,9 @@ tracker_resource_test = executable('tracker-resource-test',
   c_args: libtracker_sparql_test_c_args)
 
 tests += {
-  'name': 'tracker-resource-test',
+  'name': 'resource',
   'exe': tracker_resource_test,
+  'suite': ['resource'],
 }
 
 tracker_sparql_test = executable('tracker-sparql-test',
@@ -24,8 +25,9 @@ tracker_sparql_test = executable('tracker-sparql-test',
   c_args: libtracker_sparql_test_c_args)
 
 tests += {
-  'name': 'tracker-sparql-test',
+  'name': 'sparql',
   'exe': tracker_sparql_test,
+  'suite': ['sparql'],
   'is_parallel': false,
   'requires_dbus': true,
 }
diff --git a/tests/meson.build b/tests/meson.build
index 2e19b0623..c7467781a 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -28,6 +28,7 @@ test_bus_conf_file = configure_file(
 foreach t: tests
   test_name = t.get('name')
   test_exe = t.get('exe')
+  test_suite = t.get('suite', [])
   test_timeout = t.get('timeout', 30)
 
   # This flag marks unit tests which can't run alongside other unit tests. It
@@ -47,17 +48,19 @@ foreach t: tests
   test_env.set('LANG', 'en_US.UTF8')
 
   if test_requires_dbus
-    test (test_name, dbus_run_session,
+    test(test_name, dbus_run_session,
       env: test_env,
       args: ['--config-file=@0@'.format(join_paths(meson.current_build_dir(), 'test-bus.conf')),
              '--',
              test_exe],
+      suite: test_suite,
       timeout: test_timeout,
       is_parallel: test_is_parallel)
   else
-    test (test_name, test_exe,
-          env: test_env,
-          timeout: test_timeout,
-          is_parallel: test_is_parallel)
+    test(test_name, test_exe,
+      env: test_env,
+      timeout: test_timeout,
+      suite: test_suite,
+      is_parallel: test_is_parallel)
   endif
 endforeach
diff --git a/tests/tracker-steroids/meson.build b/tests/tracker-steroids/meson.build
index a9dff2d11..aac7e1941 100644
--- a/tests/tracker-steroids/meson.build
+++ b/tests/tracker-steroids/meson.build
@@ -10,5 +10,6 @@ steroids_test = executable('tracker-steroids-test',
 tests += {
   'name': 'steroids',
   'exe': steroids_test,
+  'suite': ['steroids'],
   'requires_dbus': true,
 }


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