Skip to content

Commit

Permalink
tests: update dependency factory tests to check type_name is sane
Browse files Browse the repository at this point in the history
Since we pass a method: 'foo' to every one of these
config-tool/pkg-config dependencies, we do not ever need to check which
type_name it has; change these to asserts instead.

In the process, we discover a bug! We kept checking for type
'configtool' instead of 'config-tool', so these tests all
short-circuited and checked nothing. Once moved to an assert, the
asserts failed.

Add a new lookup for a known system dependency and make it assert that
too.
  • Loading branch information
eli-schwartz committed Jun 17, 2021
1 parent bbcc91c commit ad20603
Showing 1 changed file with 26 additions and 11 deletions.
37 changes: 26 additions & 11 deletions test cases/common/164 dependency factory/meson.build
@@ -1,51 +1,66 @@
project('dependency factory', 'c', meson_version : '>=0.40')
project('dependency factory', 'c', meson_version : '>=0.53')

dep = dependency('gl', method: 'pkg-config', required: false)
if dep.found() and dep.type_name() == 'pkgconfig'
if dep.found()
assert(dep.type_name() == 'pkgconfig')
dep.get_pkgconfig_variable('prefix')
endif

dep = dependency('SDL2', method: 'pkg-config', required: false)
if dep.found() and dep.type_name() == 'pkgconfig'
if dep.found()
assert(dep.type_name() == 'pkgconfig')
dep.get_pkgconfig_variable('prefix')
endif

dep = dependency('SDL2', method: 'config-tool', required: false)
if dep.found() and dep.type_name() == 'configtool'
if dep.found()
assert(dep.type_name() == 'config-tool')
dep.get_configtool_variable('prefix')
endif

dep = dependency('Vulkan', method: 'pkg-config', required: false)
if dep.found() and dep.type_name() == 'pkgconfig'
if dep.found()
assert(dep.type_name() == 'pkgconfig')
dep.get_pkgconfig_variable('prefix')
endif

dep = dependency('pcap', method: 'pkg-config', required: false)
if dep.found() and dep.type_name() == 'pkgconfig'
if dep.found()
assert(dep.type_name() == 'pkgconfig')
dep.get_pkgconfig_variable('prefix')
endif

dep = dependency('pcap', method: 'config-tool', required: false)
if dep.found() and dep.type_name() == 'configtool'
if dep.found()
assert(dep.type_name() == 'config-tool')
dep.get_configtool_variable('prefix')
endif

dep = dependency('cups', method: 'pkg-config', required: false)
if dep.found() and dep.type_name() == 'pkgconfig'
if dep.found()
assert(dep.type_name() == 'pkgconfig')
dep.get_pkgconfig_variable('prefix')
endif

dep = dependency('cups', method: 'config-tool', required: false)
if dep.found() and dep.type_name() == 'configtool'
if dep.found()
assert(dep.type_name() == 'config-tool')
dep.get_configtool_variable('prefix')
endif

dep = dependency('libwmf', method: 'pkg-config', required: false)
if dep.found() and dep.type_name() == 'pkgconfig'
if dep.found()
assert(dep.type_name() == 'pkgconfig')
dep.get_pkgconfig_variable('prefix')
endif

dep = dependency('libwmf', method: 'config-tool', required: false)
if dep.found() and dep.type_name() == 'configtool'
if dep.found()
assert(dep.type_name() == 'config-tool')
dep.get_configtool_variable('prefix')
endif

dep = dependency('boost', method: 'system', required: false)
if dep.found()
assert(dep.type_name() == 'system')
endif

0 comments on commit ad20603

Please sign in to comment.