summaryrefslogtreecommitdiffstats
path: root/googletest
diff options
context:
space:
mode:
authorCopybara-Service <copybara-worker@google.com>2023-08-15 18:39:35 (GMT)
committerCopybara-Service <copybara-worker@google.com>2023-08-15 18:39:35 (GMT)
commit987e225614755fec7253aa95bf959c09e0d380d7 (patch)
tree1fd58277a0c19ab82cdf88c679985aa7ddaf19a2 /googletest
parentdd9a9569041c1551613d116ff0d092b356c836b1 (diff)
parent22eb2de1efab758bebf8e0142fb0c4a999925b3b (diff)
downloadgoogletest-987e225614755fec7253aa95bf959c09e0d380d7.zip
googletest-987e225614755fec7253aa95bf959c09e0d380d7.tar.gz
googletest-987e225614755fec7253aa95bf959c09e0d380d7.tar.bz2
Merge pull request #4333 from ngie-eign:gtest_help_test-fix-FreeBSD
PiperOrigin-RevId: 557197748 Change-Id: I55b86353f5351bbcbdf8e6bca70e82d7383a5080
Diffstat (limited to 'googletest')
-rwxr-xr-xgoogletest/test/gtest_help_test.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/googletest/test/gtest_help_test.py b/googletest/test/gtest_help_test.py
index b3b740d..38fc90f 100755
--- a/googletest/test/gtest_help_test.py
+++ b/googletest/test/gtest_help_test.py
@@ -43,11 +43,22 @@ import sys
from googletest.test import gtest_test_utils
+FREEBSD = ('FreeBSD', 'GNU/kFreeBSD')
+NETBSD = ('NetBSD',)
+OPENBSD = ('OpenBSD',)
+
+
+def is_bsd_based_os() -> bool:
+ """Determine whether or not the OS is BSD-based."""
+ if os.name != 'posix':
+ return False
+
+ return os.uname()[0] in (FREEBSD + NETBSD + OPENBSD)
+
+
IS_DARWIN = os.name == 'posix' and os.uname()[0] == 'Darwin'
IS_LINUX = os.name == 'posix' and os.uname()[0] == 'Linux'
IS_GNUHURD = os.name == 'posix' and os.uname()[0] == 'GNU'
-IS_GNUKFREEBSD = os.name == 'posix' and os.uname()[0] == 'GNU/kFreeBSD'
-IS_OPENBSD = os.name == 'posix' and os.uname()[0] == 'OpenBSD'
IS_WINDOWS = os.name == 'nt'
PROGRAM_PATH = gtest_test_utils.GetTestExecutablePath('gtest_help_test_')
@@ -133,7 +144,7 @@ class GTestHelpTest(gtest_test_utils.TestCase):
self.assertTrue(HELP_REGEX.search(output), output)
- if IS_DARWIN or IS_LINUX or IS_GNUHURD or IS_GNUKFREEBSD or IS_OPENBSD:
+ if IS_DARWIN or IS_LINUX or IS_GNUHURD or is_bsd_based_os():
self.assertIn(STREAM_RESULT_TO_FLAG, output)
else:
self.assertNotIn(STREAM_RESULT_TO_FLAG, output)