$OpenBSD: patch-run_unittests_py,v 1.9 2019/04/04 09:28:42 ajacoutot Exp $

XXX Our pkg-config(1) output differs from GNU

From d4cece3b34b91ff9f726da2ffe340645ff0d7ad4 Mon Sep 17 00:00:00 2001
From: Antoine Jacoutot <ajacoutot@openbsd.org>
Date: Wed, 3 Apr 2019 10:34:06 +0200
Subject: [PATCH] test_pkgconfig_formatting: OpenBSD, libintil is a separate library

From c1c699eda4ed4f8778e621e5d635e31264400053 Mon Sep 17 00:00:00 2001
From: Antoine Jacoutot <ajacoutot@openbsd.org>
Date: Sun, 10 Mar 2019 14:37:25 +0100
Subject: [PATCH] Fix unit test: test_find_library_patterns

From f7af1a628514d4f0ab061db449a30b3079f59834 Mon Sep 17 00:00:00 2001
From: Antoine Jacoutot <ajacoutot@openbsd.org>
Date: Tue, 12 Mar 2019 19:03:54 +0100
Subject: [PATCH] compilers: -fsanitize is not supported on OpenBSD

From 5d3e20984dadefb122e9e4fae584b40d936844e8 Mon Sep 17 00:00:00 2001
From: Antoine Jacoutot <ajacoutot@openbsd.org>
Date: Wed, 13 Mar 2019 09:36:05 +0100
Subject: [PATCH] compilers: -fsanitize is not supported on OpenBSD (second pass)

Index: run_unittests.py
--- run_unittests.py.orig
+++ run_unittests.py
@@ -734,7 +734,7 @@ class InternalTests(unittest.TestCase):
         unix_static = ('lib{}.a', '{}.a')
         msvc_static = ('lib{}.a', 'lib{}.lib', '{}.a', '{}.lib')
         # This is the priority list of pattern matching for library searching
-        patterns = {'openbsd': {'shared': ('lib{}.so', '{}.so', 'lib{}.so.[0-9]*.[0-9]*'),
+        patterns = {'openbsd': {'shared': ('lib{}.so', '{}.so', 'lib{}.so.[0-9]*.[0-9]*', '{}.so.[0-9]*.[0-9]*'),
                                 'static': unix_static},
                     'linux': {'shared': ('lib{}.so', '{}.so'),
                               'static': unix_static},
@@ -759,15 +759,13 @@ class InternalTests(unittest.TestCase):
                 self._test_all_naming(cc, env, patterns, 'windows-msvc')
             else:
                 self._test_all_naming(cc, env, patterns, 'windows-mingw')
+        elif is_openbsd():
+            self._test_all_naming(cc, env, patterns, 'openbsd')
         else:
             self._test_all_naming(cc, env, patterns, 'linux')
-            # Mock OpenBSD since we don't have tests for it
             true = lambda x, y: True
-            if not is_openbsd():
-                with PatchModule(mesonbuild.compilers.c.for_openbsd,
-                                 'mesonbuild.compilers.c.for_openbsd', true):
-                    self._test_all_naming(cc, env, patterns, 'openbsd')
-            else:
+            with PatchModule(mesonbuild.compilers.c.for_openbsd,
+                             'mesonbuild.compilers.c.for_openbsd', true):
                 self._test_all_naming(cc, env, patterns, 'openbsd')
             with PatchModule(mesonbuild.compilers.c.for_darwin,
                              'mesonbuild.compilers.c.for_darwin', true):
@@ -4164,11 +4162,11 @@ class LinuxlikeTests(BasePlatformTests):
 
         cmd = ['pkg-config', 'requires-test']
         out = self._run(cmd + ['--print-requires']).strip().split('\n')
-        self.assertEqual(sorted(out), sorted(['libexposed', 'libfoo >= 1.0', 'libhello']))
+        self.assertEqual(sorted(out), sorted(['libexposed', 'libfoo>=1.0', 'libhello']))
 
         cmd = ['pkg-config', 'requires-private-test']
         out = self._run(cmd + ['--print-requires-private']).strip().split('\n')
-        self.assertEqual(sorted(out), sorted(['libexposed', 'libfoo >= 1.0', 'libhello']))
+        self.assertEqual(sorted(out), sorted(['libexposed', 'libfoo>=1.0', 'libhello']))
 
     def test_pkg_unfound(self):
         testdir = os.path.join(self.unit_test_dir, '23 unfound pkgconfig')
@@ -4237,6 +4235,8 @@ class LinuxlikeTests(BasePlatformTests):
     def test_generate_gir_with_address_sanitizer(self):
         if is_cygwin():
             raise unittest.SkipTest('asan not available on Cygwin')
+        if is_openbsd():
+            raise unittest.SkipTest('-fsanitize=address is not supported on OpenBSD')
 
         testdir = os.path.join(self.framework_test_dir, '7 gnome')
         self.init(testdir, ['-Db_sanitize=address', '-Db_lundef=false'])
@@ -4702,6 +4702,8 @@ class LinuxlikeTests(BasePlatformTests):
     def test_pch_with_address_sanitizer(self):
         if is_cygwin():
             raise unittest.SkipTest('asan not available on Cygwin')
+        if is_openbsd():
+            raise unittest.SkipTest('-fsanitize=address is not supported on OpenBSD')
 
         testdir = os.path.join(self.common_test_dir, '13 pch')
         self.init(testdir, ['-Db_sanitize=address'])
@@ -4852,7 +4854,7 @@ endian = 'little'
         myenv['PKG_CONFIG_PATH'] = self.privatedir
         stdo = subprocess.check_output(['pkg-config', '--libs-only-l', 'libsomething'], env=myenv)
         deps = [b'-lgobject-2.0', b'-lgio-2.0', b'-lglib-2.0', b'-lsomething']
-        if is_windows() or is_cygwin() or is_osx():
+        if is_windows() or is_cygwin() or is_osx() or is_openbsd():
             # On Windows, libintl is a separate library
             deps.append(b'-lintl')
         self.assertEqual(set(deps), set(stdo.split()))
