8000 bpo-31904: Fix fifo test cases for VxWorks (GH-20254) · python/cpython@b2d0c66 · GitHub
[go: up one dir, main page]

Skip to content

Commit b2d0c66

Browse files
authored
bpo-31904: Fix fifo test cases for VxWorks (GH-20254)
1 parent cc061d0 commit b2d0c66

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

Lib/test/test_posix.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -642,12 +642,17 @@ def test_stat(self):
642642

643643
@unittest.skipUnless(hasattr(posix, 'mkfifo'), "don't have mkfifo()")
644644
def test_mkfifo(self):
645-
os_helper.unlink(os_helper.TESTFN)
645+
if sys.platform == "vxworks":
646+
fifo_path = os.path.join("/fifos/", os_helper.TESTFN)
647+
else:
648+
fifo_path = os_helper.TESTFN
649+
os_helper.unlink(fifo_path)
650+
self.addCleanup(os_helper.unlink, fifo_path)
646651
try:
647-
posix.mkfifo(os_helper.TESTFN, stat.S_IRUSR | stat.S_IWUSR)
652+
posix.mkfifo(fifo_path, stat.S_IRUSR | stat.S_IWUSR)
648653
except PermissionError as e:
649654
self.skipTest('posix.mkfifo(): %s' % e)
650-
self.assertTrue(stat.S_ISFIFO(posix.stat(os_helper.TESTFN).st_mode))
655+
self.assertTrue(stat.S_ISFIFO(posix.stat(fifo_path).st_mode))
651656

652657
@unittest.skipUnless(hasattr(posix, 'mknod') and hasattr(stat, 'S_IFIFO'),
653658
"don't have mknod()/S_IFIFO")
@@ -1929,7 +1934,7 @@ def test_posix_spawnp(self):
19291934
class TestPosixWeaklinking(unittest.TestCase):
19301935
# These test cases verify that weak linking support on macOS works
19311936
# as expected. These cases only test new behaviour introduced by weak linking,
1932-
# regular behaviour is tested by the normal test cases.
1937+
# regular behaviour is tested by the normal test cases.
19331938
#
19341939
# See the section on Weak Linking in Mac/README.txt for more information.
19351940
def setUp(self):

Lib/test/test_stat.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import os
33
import socket
44
import sys
5+
from test.support import os_helper
56
from test.support import socket_helper
67
from test.support.import_helper import import_fresh_module
78
from test.support.os_helper import TESTFN
@@ -173,11 +174,16 @@ def test_link(self):
173174

174175
@unittest.skipUnless(hasattr(os, 'mkfifo'), 'os.mkfifo not available')
175176
def test_fifo(self):
177+
if sys.platform == "vxworks":
178+
fifo_path = os.path.join("/fifos/", TESTFN)
179+
else:
180+
fifo_path = TESTFN
181+
self.addCleanup(os_helper.unlink, fifo_path)
176182
try:
177-
os.mkfifo(TESTFN, 0o700)
183+
os.mkfifo(fifo_path, 0o700)
178184
except PermissionError as e:
179185
self.skipTest('os.mkfifo(): %s' % e)
180-
st_mode, modestr = self.get_mode()
186+
st_mode, modestr = self.get_mode(fifo_path)
181187
self.assertEqual(modestr, 'prwx------')
182188
self.assertS_IS("FIFO", st_mode)
183189

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix fifo test cases for VxWorks RTOS.

0 commit comments

Comments
 (0)
0