Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
1e2f67c0
Kaydet (Commit)
1e2f67c0
authored
Eki 17, 2013
tarafından
Richard Oudkerk
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Try doing a raw test of os.fork()/os.kill().
üst
7d270ee0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
5 deletions
+36
-5
_test_multiprocessing.py
Lib/test/_test_multiprocessing.py
+36
-5
No files found.
Lib/test/_test_multiprocessing.py
Dosyayı görüntüle @
1e2f67c0
...
...
@@ -273,10 +273,11 @@ class _TestProcess(BaseTestCase):
@classmethod
def
_test_terminate
(
cls
):
print
(
'signal.getsignal(SIGTERM) ='
,
signal
.
getsignal
(
signal
.
SIGTERM
))
print
(
'starting sleep'
)
print
(
'signal.getsignal(SIGTERM) ='
,
signal
.
getsignal
(
signal
.
SIGTERM
),
file
=
sys
.
stderr
)
print
(
'starting sleep'
,
file
=
sys
.
stderr
)
time
.
sleep
(
100
)
print
(
'finished sleep'
)
print
(
'finished sleep'
,
file
=
sys
.
stderr
)
def
test_terminate
(
self
):
if
self
.
TYPE
==
'threads'
:
...
...
@@ -314,11 +315,12 @@ class _TestProcess(BaseTestCase):
try
:
signal
.
alarm
(
10
)
self
.
assertEqual
(
join
(),
None
)
signal
.
alarm
(
0
)
except
RuntimeError
:
print
(
'os.waitpid() ='
,
os
.
waitpid
(
p
.
pid
,
os
.
WNOHANG
))
print
(
'os.waitpid() ='
,
os
.
waitpid
(
p
.
pid
,
os
.
WNOHANG
),
file
=
sys
.
stderr
)
raise
finally
:
signal
.
alarm
(
0
)
signal
.
signal
(
signal
.
SIGALRM
,
old_handler
)
else
:
self
.
assertEqual
(
join
(),
None
)
...
...
@@ -333,6 +335,35 @@ class _TestProcess(BaseTestCase):
# XXX sometimes get p.exitcode == 0 on Windows ...
#self.assertEqual(p.exitcode, -signal.SIGTERM)
@unittest.skipIf
(
WIN32
,
'Unix only'
)
def
test_sigterm
(
self
):
# A test for the Gentoo build bot which does not directly use
# multiprocessing. Start and terminate child processes.
if
self
.
TYPE
!=
'processes'
:
return
for
i
in
range
(
10
):
pid
=
os
.
fork
()
if
pid
==
0
:
try
:
print
(
'sleeping'
,
file
=
sys
.
stderr
)
time
.
sleep
(
100
)
print
(
'waking'
,
file
=
sys
.
stderr
)
finally
:
sys
.
stderr
.
flush
()
os
.
_exit
(
0
)
else
:
os
.
kill
(
pid
,
signal
.
SIGTERM
)
def
handler
(
*
args
):
raise
RuntimeError
(
'join took too long:
%
s'
%
p
)
old_handler
=
signal
.
signal
(
signal
.
SIGALRM
,
handler
)
try
:
signal
.
alarm
(
10
)
pid_status
=
os
.
waitpid
(
pid
,
0
)
self
.
assertEqual
(
pid_status
[
0
],
pid
)
finally
:
signal
.
alarm
(
0
)
signal
.
signal
(
signal
.
SIGALRM
,
old_handler
)
def
test_cpu_count
(
self
):
try
:
cpus
=
multiprocessing
.
cpu_count
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment