Blame tests/meson.build

Packit a4058c
# Resources; we cannot use gnome.compile_resources() here, because we need to
Packit a4058c
# override the environment in order to use the utilities we just built instead
Packit a4058c
# of the system ones
Packit a4058c
resources_c = custom_target('resources.c',
Packit a4058c
                            input: 'resources.gresource.xml',
Packit a4058c
                            output: 'resources.c',
Packit a4058c
                            command: [
Packit a4058c
                              gen_resources,
Packit a4058c
                              '--pixdata=@0@'.format(gdk_pixbuf_pixdata.full_path()),
Packit a4058c
                              '--loaders=@0@'.format(loaders_cache.full_path()),
Packit a4058c
                              '--sourcedir=@0@'.format(meson.current_source_dir()),
Packit a4058c
                              '--source',
Packit a4058c
                              '@INPUT@',
Packit a4058c
                              '@OUTPUT@',
Packit a4058c
                            ],
Packit a4058c
                            depends: [
Packit a4058c
                              gdk_pixbuf_pixdata,
Packit a4058c
                              loaders_cache,
Packit a4058c
                            ])
Packit a4058c
resources_h = custom_target('resources.h',
Packit a4058c
                            input: 'resources.gresource.xml',
Packit a4058c
                            output: 'resources.h',
Packit a4058c
                            command: [
Packit a4058c
                              gen_resources,
Packit a4058c
                              '--pixdata=@0@'.format(gdk_pixbuf_pixdata.full_path()),
Packit a4058c
                              '--loaders=@0@'.format(loaders_cache.full_path()),
Packit a4058c
                              '--sourcedir=@0@'.format(meson.current_source_dir()),
Packit a4058c
                              '--header',
Packit a4058c
                              '@INPUT@',
Packit a4058c
                              '@OUTPUT@',
Packit a4058c
                            ],
Packit a4058c
                            depends: [
Packit a4058c
                              gdk_pixbuf_pixdata,
Packit a4058c
                              loaders_cache,
Packit a4058c
                            ])
Packit a4058c
Packit a4058c
installed_tests = [
Packit a4058c
  [ 'animation' ],
Packit a4058c
  [ 'cve-2015-4491', true ],
Packit a4058c
  [ 'pixbuf-fail' ],
Packit a4058c
  [ 'pixbuf-icon-serialize' ],
Packit a4058c
  [ 'pixbuf-randomly-modified' ],
Packit a4058c
  [ 'pixbuf-threads' ],
Packit a4058c
  [ 'pixbuf-icc' ],
Packit a4058c
  [ 'pixbuf-jpeg' ],
Packit a4058c
  [ 'pixbuf-dpi' ],
Packit a4058c
  [ 'pixbuf-pixdata', true ],
Packit a4058c
  [ 'pixbuf-stream' ],
Packit a4058c
  [ 'pixbuf-reftest' ],
Packit a4058c
  [ 'pixbuf-resource', true ],
Packit a4058c
  [ 'pixbuf-scale' ],
Packit a4058c
  [ 'pixbuf-scale-two-step' ],
Packit a4058c
  [ 'pixbuf-short-gif-write' ],
Packit a4058c
  [ 'pixbuf-save' ],
Packit a4058c
  [ 'pixbuf-readonly-to-mutable' ],
Packit a4058c
  [ 'pixbuf-composite' ],
Packit a4058c
  [ 'pixbuf-area-updated' ],
Packit a4058c
]
Packit a4058c
Packit a4058c
test_data = [
Packit a4058c
  'test-image.png',
Packit a4058c
  'test-animation.gif',
Packit a4058c
  '1_partyanimsm2.gif',
Packit a4058c
  'test-animation.ani',
Packit a4058c
  'icc-profile.jpeg',
Packit a4058c
  'icc-profile.png',
Packit a4058c
  'dpi.jpeg',
Packit a4058c
  'dpi.png',
Packit a4058c
  'dpi.tiff',
Packit a4058c
  'premature-end.png',
Packit a4058c
  'premature-end.jpg',
Packit a4058c
  'bug143608-comment.jpg',
Packit a4058c
  'bug725582-testrotate.jpg',
Packit a4058c
  'bug725582-testrotate.png',
Packit a4058c
  'cve-2015-4491.bmp',
Packit a4058c
  'large.png',
Packit a4058c
  'large.jpg',
Packit a4058c
  'bug775218.jpg',
Packit a4058c
  'test-image.pixdata',
Packit a4058c
  'test-image-rle.pixdata',
Packit a4058c
  'bug775693.pixdata',
Packit a4058c
  'aero.gif',
Packit a4058c
]
Packit a4058c
Packit a4058c
installed_test_bindir = join_paths(gdk_pixbuf_libexecdir, 'installed-tests', gdk_pixbuf_api_name)
Packit a4058c
installed_test_datadir = join_paths(gdk_pixbuf_datadir, 'installed-tests', gdk_pixbuf_api_name)
Packit a4058c
Packit a4058c
install_data(test_data, install_dir: installed_test_bindir)
Packit a4058c
Packit a4058c
test_deps = gdk_pixbuf_deps + [ gdkpixbuf_dep ]
Packit a4058c
Packit a4058c
foreach t: installed_tests
Packit a4058c
  test_name = t[0]
Packit a4058c
  test_sources = [ test_name + '.c', 'test-common.c' ]
Packit a4058c
  needs_resources = t.get(1, false)
Packit a4058c
  if needs_resources
Packit a4058c
    test_sources += [ resources_c, resources_h ]
Packit a4058c
  endif
Packit a4058c
Packit a4058c
  custom_target(test_name + '.test',
Packit a4058c
                output: test_name + '.test',
Packit a4058c
                command: [
Packit a4058c
                  gen_installed_test,
Packit a4058c
                  '--testbindir=@0@'.format(installed_test_bindir),
Packit a4058c
                  '--testbin=@0@'.format(test_name),
Packit a4058c
                  '@OUTPUT@',
Packit a4058c
                ],
Packit a4058c
                install: true,
Packit a4058c
                install_dir: installed_test_datadir)
Packit a4058c
Packit a4058c
  test_bin = executable(test_name, test_sources,
Packit a4058c
                        dependencies: test_deps,
Packit a4058c
                        include_directories: [
Packit a4058c
                          root_inc,
Packit a4058c
                          gdk_pixbuf_inc,
Packit a4058c
                        ],
Packit a4058c
                        c_args: common_cflags)
Packit a4058c
Packit a4058c
  # Two particularly slow tests
Packit a4058c
  if test_name == 'pixbuf-area-updated' or test_name == 'pixbuf-randomly-modified'
Packit a4058c
    timeout = 300
Packit a4058c
  else
Packit a4058c
    timeout = 30
Packit a4058c
  endif
Packit a4058c
Packit a4058c
  test(test_name, test_bin,
Packit a4058c
       args: [ '-k', '--tap' ],
Packit a4058c
       env: [
Packit a4058c
         'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
Packit a4058c
         'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
Packit a4058c
         'GDK_PIXBUF_MODULE_FILE=@0@'.format(loaders_cache.full_path()),
Packit a4058c
       ],
Packit a4058c
       timeout: timeout)
Packit a4058c
endforeach
Packit a4058c
Packit a4058c
executable('pixbuf-read',
Packit a4058c
           'pixbuf-read.c',
Packit a4058c
           dependencies: test_deps,
Packit a4058c
           include_directories: [
Packit a4058c
             root_inc,
Packit a4058c
             include_directories('../gdk-pixbuf')
Packit a4058c
           ],
Packit a4058c
           c_args: common_cflags)