Revert "build: Drop the install-tests option"
authorJeremy Bicha <jeremy.bicha@canonical.com>
Thu, 12 Jan 2023 13:47:54 +0000 (08:47 -0500)
committerJeremy Bícha <jbicha@ubuntu.com>
Fri, 22 Sep 2023 14:27:13 +0000 (15:27 +0100)
Debian and Ubuntu uses these installed tests as part of their
autopkgtest system

This reverts commit 3121f88265ac61733e257f5335473d6f139f158c.

Gbp-Pq: Name Revert-build-Drop-the-install-tests-option.patch

12 files changed:
meson.build
meson_options.txt
testsuite/a11y/meson.build
testsuite/css/change/meson.build
testsuite/css/meson.build
testsuite/css/nodes/meson.build
testsuite/css/parser/meson.build
testsuite/css/style/meson.build
testsuite/gdk/meson.build
testsuite/gsk/meson.build
testsuite/gtk/meson.build
testsuite/tools/meson.build

index 66545a5b083dc7a82fc9acda2856ade9e7ba0865..eca29d107bd0fb3bc2c714ee57323fdd2edb6f89 100644 (file)
@@ -913,6 +913,7 @@ summary('Documentation', get_option('documentation'), section: 'Build')
 summary('Man pages', get_option('man-pages'), section: 'Build')
 summary('Testsuite', get_option('build-testsuite'), section: 'Build')
 summary('Tests', get_option('build-tests'), section: 'Build')
+summary('Install tests', get_option('install-tests'), section: 'Build')
 summary('Demos', get_option('build-demos'), section: 'Build')
 summary('Examples', get_option('build-examples'), section: 'Build')
 
index 4b794e781418fbeca1d0505799bd9a82c6ad63eb..a3e0f5ed810a886d79544d7d668b1a49d81a55b5 100644 (file)
@@ -158,3 +158,8 @@ option('build-tests',
        type: 'boolean',
        value: true,
        description : 'Build tests')
+
+option('install-tests',
+       type: 'boolean',
+       value: false,
+       description : 'Install tests')
index 2686d6c31ffc15b6eb0d2478fa415bee76858751..e70522d4ad8df1dca72dcbbdaf8da633ea7514f0 100644 (file)
@@ -1,3 +1,6 @@
+testexecdir = join_paths(installed_test_bindir, 'gtk')
+testdatadir = join_paths(installed_test_datadir, 'gtk')
+
 # Available keys for each test:
 #
 #  - 'name': the test name; used for the test and to determine the base
@@ -67,11 +70,12 @@ foreach t : tests
   test_extra_suites = t.get('suites', [])
   test_timeout = 60
 
-  test_exe = executable(test_name,
-    sources: test_srcs,
+  test_exe = executable(test_name, test_srcs,
     c_args: test_cargs + test_extra_cargs,
     link_args: test_extra_ldflags,
     dependencies: libgtk_dep,
+    install: get_option('install-tests'),
+    install_dir: testexecdir,
   )
 
   if test_extra_suites.contains('slow')
index f78d27e372c7d521795b2845c037161476b3bb33..e0ef9d4bb83b8e4b304acbee72d3379589c5a4fa 100644 (file)
@@ -6,10 +6,17 @@ changetest_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
 changetest_env.set('GSETTINGS_BACKEND', 'memory')
 changetest_env.set('G_ENABLE_DIAGNOSTIC', '0')
 
-test_change = executable('test-css-change',
-  sources: ['test-css-change.c', '../../testutils.c'],
+testexecdir = join_paths(installed_test_bindir, 'css', 'change')
+testdatadir = join_paths(installed_test_datadir, 'css')
+
+test_change = executable(
+  'test-css-change',
+  'test-css-change.c',
+  '../../testutils.c',
   c_args: common_cflags,
   dependencies: libgtk_dep,
+  install: get_option('install-tests'),
+  install_dir: testexecdir,
 )
 
 test('change', test_change,
@@ -18,3 +25,22 @@ test('change', test_change,
   env: changetest_env,
   suite: 'css',
 )
+
+test_data = [
+  'test1.css', 'test1.ui', 'test1.nodes',
+  'test2.css', 'test2.ui', 'test2.nodes',
+  'test3.css', 'test3.ui', 'test3.nodes',
+  'test4.css', 'test4.ui', 'test4.nodes',
+]
+
+if get_option('install-tests')
+  conf = configuration_data()
+  conf.set('libexecdir', gtk_libexecdir)
+  configure_file(input: 'change.test.in',
+                 output: 'change.test',
+                 configuration: conf,
+                 install_dir: testdatadir)
+
+  install_data(test_data, install_dir: testexecdir)
+
+endif
index 746b042203e3ae271d950607fb6fa410b195829e..c3ed7172ac053b87cf9a53c179e666b704299414 100644 (file)
@@ -12,10 +12,14 @@ subdir('nodes')
 subdir('style')
 subdir('change')
 
-test_api = executable('api',
-  sources: ['api.c'],
+testexecdir = join_paths(installed_test_bindir, 'css')
+testdatadir = join_paths(installed_test_datadir, 'css')
+
+test_api = executable('api', 'api.c',
   c_args: common_cflags,
   dependencies: libgtk_dep,
+  install: get_option('install-tests'),
+  install_dir: testexecdir,
 )
 
 test('api', test_api,
@@ -25,11 +29,12 @@ test('api', test_api,
   suite: 'css',
 )
 
-test_data = executable('data',
-  sources: ['data.c'],
+test_data = executable('data', 'data.c',
   c_args: common_cflags + ['-DGTK_COMPILATION'],
   include_directories: [confinc, ],
   dependencies: libgtk_static_dep,
+  install: get_option('install-tests'),
+  install_dir: testexecdir,
 )
 
 test('data', test_data,
@@ -39,10 +44,11 @@ test('data', test_data,
   suite: 'css',
 )
 
-transition = executable('transition',
-  sources: ['transition.c'],
+transition = executable('transition', 'transition.c',
   c_args: common_cflags + ['-DGTK_COMPILATION'],
   dependencies: libgtk_static_dep,
+  install: get_option('install-tests'),
+  install_dir: testexecdir,
 )
 
 test('transition', transition,
@@ -52,6 +58,24 @@ test('transition', transition,
      suite: 'css'
 )
 
+if get_option('install-tests')
+  conf = configuration_data()
+  conf.set('libexecdir', gtk_libexecdir)
+  configure_file(input: 'api.test.in',
+    output: 'api.test',
+    configuration: conf,
+    install_dir: testdatadir,
+  )
+
+  conf = configuration_data()
+  conf.set('libexecdir', gtk_libexecdir)
+  configure_file(input: 'data.test.in',
+    output: 'data.test',
+    configuration: conf,
+    install_dir: testdatadir,
+  )
+endif
+
 if false and get_option ('profiler')
 
   adwaita_env = csstest_env
index f682cdbb01cfd9945241c77831b01c3ce85b6af7..a7cb3e2010b047b50961513485ea55920f6b43ef 100644 (file)
@@ -6,15 +6,81 @@ nodetest_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
 nodetest_env.set('GSETTINGS_BACKEND', 'memory')
 nodetest_env.set('G_ENABLE_DIAGNOSTIC', '0')
 
-test_nodes = executable('test-css-nodes',
-  sources: ['test-css-nodes.c', '../../testutils.c'],
-  c_args: common_cflags,
-  dependencies: libgtk_dep,
-)
+testexecdir = join_paths(installed_test_bindir, 'css', 'nodes')
+testdatadir = join_paths(installed_test_datadir, 'css')
 
+test_nodes = executable('test-css-nodes', 'test-css-nodes.c', '../../testutils.c',
+                        c_args: common_cflags,
+                        install: get_option('install-tests'),
+                        install_dir: testexecdir,
+                        dependencies: libgtk_dep)
 test('nodes', test_nodes,
   args: [ '--tap', '-k' ],
   protocol: 'tap',
   env: nodetest_env,
   suite: 'css',
 )
+
+test_data = [
+  'box.ltr.nodes',
+  'box.ltr.ui',
+  'box.rtl.nodes',
+  'box.rtl.ui',
+  'buttons.nodes',
+  'buttons.ui',
+  'checkbutton.ltr.nodes',
+  'checkbutton.ltr.ui',
+  'checkbutton.rtl.nodes',
+  'checkbutton.rtl.ui',
+  'combobox.nodes',
+  'combobox.ui',
+  'entries.nodes',
+  'entries.ui',
+  'expander.ltr.nodes',
+  'expander.ltr.ui',
+  'expander.rtl.nodes',
+  'expander.rtl.ui',
+  'levelbar.ltr.nodes',
+  'levelbar.ltr.ui',
+  'levelbar.rtl.nodes',
+  'levelbar.rtl.ui',
+  'notebook-arrows2.nodes',
+  'notebook-arrows2.ui',
+  'notebook-arrows.nodes',
+  'notebook-arrows.ui',
+  'notebook.bottom.ltr.nodes',
+  'notebook.bottom.ltr.ui',
+  'notebook.bottom.rtl.nodes',
+  'notebook.bottom.rtl.ui',
+  'notebook.left.ltr.nodes',
+  'notebook.left.ltr.ui',
+  'notebook.left.rtl.nodes',
+  'notebook.left.rtl.ui',
+  'notebook.right.ltr.nodes',
+  'notebook.right.ltr.ui',
+  'notebook.right.rtl.nodes',
+  'notebook.right.rtl.ui',
+  'notebook.top.ltr.nodes',
+  'notebook.top.ltr.ui',
+  'notebook.top.rtl.nodes',
+  'notebook.top.rtl.ui',
+  'paned.ltr.nodes',
+  'paned.ltr.ui',
+  'paned.rtl.nodes',
+  'paned.rtl.ui',
+  'progressbar.nodes',
+  'progressbar.ui',
+  'scale.nodes',
+  'scale.ui',
+]
+
+if get_option('install-tests')
+  conf = configuration_data()
+  conf.set('libexecdir', gtk_libexecdir)
+  configure_file(input: 'nodes.test.in',
+                 output: 'nodes.test',
+                 configuration: conf,
+                 install_dir: testdatadir)
+
+  install_data(test_data, install_dir: testexecdir)
+endif
index b05efb7fd2331611af55dbd6974c10dc601e25eb..bfb9936017392a9c846fa23ebbfce33a737aa4a2 100644 (file)
@@ -1,8 +1,11 @@
-test_parser = executable('test-css-parser',
-  sources: ['test-css-parser.c', '../../testutils.c'],
-  c_args: common_cflags,
-  dependencies: libgtk_dep,
-)
+testexecdir = join_paths(installed_test_bindir, 'css', 'parser')
+testdatadir = join_paths(installed_test_datadir, 'css')
+
+test_parser = executable('test-css-parser', 'test-css-parser.c', '../../testutils.c',
+                         c_args: common_cflags,
+                         install: get_option('install-tests'),
+                         install_dir: testexecdir,
+                         dependencies: libgtk_dep)
 
 test_data = [
   'animation-crash-3.12.css',
@@ -623,3 +626,15 @@ foreach testname : test_data
          suite: 'css')
   endif
 endforeach
+
+if get_option('install-tests')
+  conf = configuration_data()
+  conf.set('libexecdir', gtk_libexecdir)
+  configure_file(input: 'parser.test.in',
+                 output: 'parser.test',
+                 configuration: conf,
+                 install_dir: testdatadir)
+
+  install_data(test_data, install_dir: testexecdir)
+
+endif
index 7fc4036bfa4c75565ded2dac3372b8fbcd4de4b7..52c962ce1a410a7c89ed4a2e70df8a216687e052 100644 (file)
@@ -6,21 +6,73 @@ styletest_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
 styletest_env.set('GSETTINGS_BACKEND', 'memory')
 styletest_env.set('G_ENABLE_DIAGNOSTIC', '0')
 
+testexecdir = join_paths(installed_test_bindir, 'css', 'style')
+testdatadir = join_paths(installed_test_datadir, 'css')
+
 cssresources = gnome.compile_resources(
   'cssresources',
   'test-css-style.gresource.xml',
   source_dir: meson.current_source_dir(),
 )
 
-test_style = executable('test-css-style',
-  sources: ['test-css-style.c', '../../testutils.c', cssresources],
+test_style = executable(
+  'test-css-style',
+  'test-css-style.c',
+  '../../testutils.c',
+  cssresources,
   c_args: common_cflags,
   dependencies: libgtk_dep,
+  install: get_option('install-tests'),
+  install_dir: testexecdir,
 )
-
 test('style', test_style,
   args: [ '--tap', '-k' ],
   protocol: 'tap',
   env: styletest_env,
   suite: 'css',
 )
+
+test_data = [
+  'adjacent-states.css',
+  'adjacent-states.nodes',
+  'adjacent-states.ui',
+  'bloomfilter-not.css',
+  'bloomfilter-not.nodes',
+  'bloomfilter-not.ui',
+  'colornames.css',
+  'colornames.nodes',
+  'colornames.ui',
+  'currentcolor.css',
+  'currentcolor.nodes',
+  'currentcolor.ui',
+  'font.css',
+  'font.nodes',
+  'font.ui',
+  'gradient.css',
+  'gradient.nodes',
+  'gradient.ui',
+  'gtk.css',
+  'inherit.css',
+  'inherit.nodes',
+  'inherit.ui',
+  'label.css',
+  'label.nodes',
+  'label.ui',
+  'misc.css',
+  'misc.nodes',
+  'misc.ui',
+  'nth-child.css',
+  'nth-child.nodes',
+  'nth-child.ui',
+]
+
+if get_option('install-tests')
+  conf = configuration_data()
+  conf.set('libexecdir', gtk_libexecdir)
+  configure_file(input: 'style.test.in',
+                 output: 'style.test',
+                 configuration: conf,
+                 install_dir: testdatadir)
+
+  install_data(test_data, install_dir: testexecdir)
+endif
index 2cc27d5eb7c6110bbbd4341f8d9a948e2335e565..92dc6abe7f32b6ad090b511ca92a25e0a43265a7 100644 (file)
@@ -1,10 +1,13 @@
+testexecdir = join_paths(installed_test_bindir, 'gdk')
+testdatadir = join_paths(installed_test_datadir, 'gdk')
+
 clipboard_client = executable('clipboard-client',
-  sources: ['clipboard-client.c'],
-  include_directories: [confinc],
-  c_args: common_cflags,
-  dependencies: [ libgtk_dep ],
-  install: false,
-)
+                              sources: ['clipboard-client.c'],
+                              include_directories: [confinc],
+                              c_args: common_cflags,
+                              dependencies: [ libgtk_dep ],
+                              install: get_option('install-tests'),
+                              install_dir: testexecdir)
 
 tests = [
   { 'name': 'array' },
@@ -33,7 +36,8 @@ foreach t : tests
     sources: '@0@.c'.format(test_name),
     c_args: common_cflags,
     dependencies: libgtk_dep,
-    install: false,
+    install: get_option('install-tests'),
+    install_dir: testexecdir,
   )
 
   suites = ['gdk'] + t.get('suites', [])
@@ -61,7 +65,8 @@ foreach t : internal_tests
   test_exe = executable(t, '@0@.c'.format(t),
     c_args: common_cflags + ['-DGTK_COMPILATION'],
     dependencies: libgtk_static_dep,
-    install: false,
+    install: get_option('install-tests'),
+    install_dir: testexecdir,
   )
 
   test(t, test_exe,
@@ -75,3 +80,28 @@ foreach t : internal_tests
     suite: 'gdk',
   )
 endforeach
+
+
+if get_option('install-tests')
+  foreach t : tests
+    test_name = t.get('name')
+    suites = t.get('suites', [])
+
+    if suites.contains('flaky') or suites.contains('failing')
+      continue
+    endif
+
+    test_cdata = configuration_data()
+    test_cdata.set('testexecdir', testexecdir)
+    test_cdata.set('test', test_name)
+    configure_file(input: 'gdk.test.in',
+      output: '@0@.test'.format(test_name),
+      configuration: test_cdata,
+      install: true,
+      install_dir: testdatadir,
+    )
+  endforeach
+
+  install_subdir('clipboard-data', install_dir: testexecdir)
+  install_subdir('image-data', install_dir: testexecdir)
+endif
index cd1a32c33106dd1277e8c60f8b7993a59056d663..35b07f2f0cd69ba070b601824133c6aa387d4d60 100644 (file)
@@ -1,12 +1,22 @@
-compare_render = executable('compare-render',
+testexecdir = join_paths(installed_test_bindir, 'gsk')
+testdatadir = join_paths(installed_test_datadir, 'gsk')
+
+compare_render = executable(
+  'compare-render',
   ['compare-render.c', '../reftests/reftest-compare.c'],
   dependencies: libgtk_dep,
   c_args: common_cflags,
+  install: get_option('install-tests'),
+  install_dir: testexecdir
 )
 
-node_parser = executable('node-parser', 'node-parser.c',
+node_parser = executable(
+  'node-parser',
+  ['node-parser.c'],
   dependencies: libgtk_dep,
   c_args: common_cflags,
+  install: get_option('install-tests'),
+  install_dir: testexecdir
 )
 
 compare_render_tests = [
@@ -378,9 +388,11 @@ foreach t : tests
   test_extra_ldflags = t.get(3, [])
 
   test_exe = executable(test_name, test_srcs,
-    dependencies : libgtk_dep,
     c_args : test_cargs + test_extra_cargs + common_cflags,
     link_args : test_extra_ldflags,
+    dependencies : libgtk_dep,
+    install: get_option('install-tests'),
+    install_dir: testexecdir,
   )
 
   test(test_name, test_exe,
@@ -409,11 +421,12 @@ foreach t : internal_tests
   test_extra_cargs = t.get(2, [])
   test_extra_ldflags = t.get(3, [])
 
-  test_exe = executable(test_name,
-    sources: test_srcs,
-    dependencies : libgtk_static_dep,
+  test_exe = executable(test_name, test_srcs,
     c_args : test_cargs + test_extra_cargs + common_cflags + ['-DGTK_COMPILATION'],
     link_args : test_extra_ldflags,
+    dependencies : libgtk_static_dep,
+    install: get_option('install-tests'),
+    install_dir: testexecdir,
   )
 
   test(test_name, test_exe,
index 12b025f3179b18f93475b113e0d2b0e849c2d2b0..f7700bb3da2cfd651b397f07a3559c3bbce880a4 100644 (file)
@@ -1,3 +1,6 @@
+testexecdir = join_paths(installed_test_bindir, 'gtk')
+testdatadir = join_paths(installed_test_datadir, 'gtk')
+
 gtk_tests_export_dynamic_ldflag = []
 
 if cc.get_id() != 'msvc'
@@ -167,6 +170,8 @@ foreach t : tests
     c_args: test_cargs + test_extra_cargs,
     link_args: test_extra_ldflags,
     dependencies: libgtk_dep,
+    install: get_option('install-tests'),
+    install_dir: testexecdir,
   )
 
   if test_extra_suites.contains('slow')
@@ -195,6 +200,8 @@ foreach t : internal_tests
     c_args: test_cargs + test_extra_cargs + ['-DGTK_COMPILATION'],
     link_args: test_extra_ldflags,
     dependencies: libgtk_static_dep,
+    install: get_option('install-tests'),
+    install_dir: testexecdir,
   )
 
   if test_extra_suites.contains('slow')
@@ -213,8 +220,10 @@ endforeach
 # FIXME: if objc autotestkeywords_CPPFLAGS += -DHAVE_OBJC=1 -x objective-c++
 if add_languages('cpp', required: false, native: false)
   test_exe = executable('autotestkeywords',
-    sources: ['autotestkeywords.cc'],
+    sources: 'autotestkeywords.cc',
     dependencies: libgtk_dep,
+    install: get_option('install-tests'),
+    install_dir: testexecdir,
   )
   test('c++ keywords', test_exe,
     args: [ '--tap', '-k' ],
@@ -222,6 +231,16 @@ if add_languages('cpp', required: false, native: false)
     env: test_env,
     suite: 'gtk',
   )
+  if get_option('install-tests')
+    conf = configuration_data()
+    conf.set('testexecdir', testexecdir)
+    conf.set('test', 'autotestkeywords')
+    configure_file(input: 'gtk.test.in',
+      output: 'autotestkeywords.test',
+      configuration: conf,
+      install_dir: testdatadir,
+    )
+  endif
 endif
 
 
@@ -247,10 +266,13 @@ focus_chain_tests = [
   #[ 'widget-factory3', 'tab-backward' ],
 ]
 
-focus_chain = executable('test-focus-chain',
+focus_chain = executable(
+  'test-focus-chain',
   sources: ['test-focus-chain.c', '../testutils.c'],
   dependencies: libgtk_dep,
   c_args: common_cflags,
+  install: get_option('install-tests'),
+  install_dir: testexecdir
 )
 
 foreach test : focus_chain_tests
@@ -273,6 +295,30 @@ test('potfiles', make_pot,
      workdir: meson.project_source_root(),
      suite: ['gtk', 'translations' ])
 
+if get_option('install-tests')
+  foreach t : tests
+    test_name = t.get('name')
+    suites = t.get('suites', [])
+
+    if suites.contains('flaky') or suites.contains('failing')
+      continue
+    endif
+
+    conf = configuration_data()
+    conf.set('testexecdir', testexecdir)
+    conf.set('test', test_name)
+    configure_file(input: 'gtk.test.in',
+      output: '@0@.test'.format(test_name),
+      configuration: conf,
+      install_dir: testdatadir,
+    )
+  endforeach
+
+  install_subdir('icons', install_dir: testexecdir)
+  install_subdir('icons2', install_dir: testexecdir)
+  install_subdir('ui', install_dir: testexecdir)
+endif
+
 if false and get_option ('profiler')
 
   performance_env = test_env
index e19a8195d628de84266479f9d1bb4ea190995a7f..54ede78118bbc8e6e51c9f50a303dc6d92f71bb1 100644 (file)
@@ -1,12 +1,23 @@
+testexecdir = join_paths(installed_test_bindir, 'tools')
+testdatadir = join_paths(installed_test_datadir, 'tools')
+
 bash = find_program('bash', required : false)
 if bash.found()
   test_env = environment()
 
   foreach t : ['simplify', 'simplify-3to4', 'validate', 'enumerate', 'settings']
-    configure_file(output: t,
-      input: '@0@.in'.format(t),
-      copy: true,
-    )
+    if get_option('install-tests')
+      configure_file(output: t,
+        input: '@0@.in'.format(t),
+        copy: true,
+        install_dir: testexecdir,
+      )
+    else
+      configure_file(output: t,
+        input: '@0@.in'.format(t),
+        copy: true,
+      )
+    endif
     test(t, bash,
       args: t,
       workdir: meson.current_build_dir(),
@@ -23,3 +34,20 @@ if bash.found()
     )
   endforeach
 endif
+
+if get_option('install-tests')
+  foreach t : ['simplify', 'settings']
+    test_conf = configuration_data()
+    test_conf.set('testexecdir', testexecdir)
+    test_conf.set('test', t)
+    configure_file(output: '@0@.test'.format(t),
+      input: 'tools.test.in',
+      configuration: test_conf,
+      install_dir: testdatadir,
+    )
+  endforeach
+
+  install_subdir('simplify-data', install_dir: testexecdir)
+  install_subdir('simplify-data-3to4', install_dir: testexecdir)
+  install_subdir('validate-data', install_dir: testexecdir)
+endif