@@ -147,6 +147,21 @@ def decorated(self, *args, **kwargs):
147147 return decorated
148148
149149
150+ def requires_pkg_config (func ):
151+ assert callable (func )
152+
153+ @wraps (func )
154+ def decorated (self , * args , ** kwargs ):
155+ if not utils .which ('pkg-config' ):
156+ if 'EMTEST_SKIP_PKG_CONFIG' in os .environ :
157+ self .skipTest ('test requires pkg-config and EMTEST_SKIP_PKG_CONFIG is set' )
158+ else :
159+ self .fail ('pkg-config is required to run this test' )
160+ return func (self , * args , ** kwargs )
161+
162+ return decorated
163+
164+
150165class other (RunnerCore ):
151166 def assertIsObjectFile (self , filename ):
152167 self .assertTrue (building .is_wasm (filename ))
@@ -816,14 +831,25 @@ def test_cmake_find_modules(self):
816831 self .assertContained ('AL_VERSION: 1.1' , output )
817832 self .assertContained ('SDL version: 2.0.' , output )
818833
834+ @requires_pkg_config
819835 def test_cmake_find_pkg_config (self ):
820- if not utils .which ('pkg-config' ):
821- self .fail ('pkg-config is required to run this test' )
822836 out = self .run_process ([EMCMAKE , 'cmake' , test_file ('cmake/find_pkg_config' )], stdout = PIPE ).stdout
823837 libdir = shared .Cache .get_sysroot_dir ('local/lib/pkgconfig' )
824838 libdir += os .path .pathsep + shared .Cache .get_sysroot_dir ('lib/pkgconfig' )
825839 self .assertContained ('PKG_CONFIG_LIBDIR: ' + libdir , out )
826840
841+ @requires_pkg_config
842+ def test_pkg_config_packages (self ):
843+ packages = [
844+ ('egl' , '10.2.2' ),
845+ ('glesv2' , '10.2.2' ),
846+ ('glfw3' , '3.2.1' ),
847+ ('sdl' , '1.2.15' ),
848+ ]
849+ for package , version in packages :
850+ out = self .run_process ([emmake , 'pkg-config' , '--modversion' , package ], stdout = PIPE ).stdout
851+ self .assertContained (version , out )
852+
827853 def test_system_include_paths (self ):
828854 # Verify that all default include paths are within `emscripten/system`
829855
0 commit comments