mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 05:42:29 +00:00
Make numerous improvements
- Python static hello world now 1.8mb - Python static fully loaded now 10mb - Python HTTPS client now uses MbedTLS - Python REPL now completes import stmts - Increase stack size for Python for now - Begin synthesizing posixpath and ntpath - Restore Python \N{UNICODE NAME} support - Restore Python NFKD symbol normalization - Add optimized code path for Intel SHA-NI - Get more Python unit tests passing faster - Get Python help() pagination working on NT - Python hashlib now supports MbedTLS PBKDF2 - Make memcpy/memmove/memcmp/bcmp/etc. faster - Add Mersenne Twister and Vigna to LIBC_RAND - Provide privileged __printf() for error code - Fix zipos opendir() so that it reports ENOTDIR - Add basic chmod() implementation for Windows NT - Add Cosmo's best functions to Python cosmo module - Pin function trace indent depth to that of caller - Show memory diagram on invalid access in MODE=dbg - Differentiate stack overflow on crash in MODE=dbg - Add stb_truetype and tools for analyzing font files - Upgrade to UNICODE 13 and reduce its binary footprint - COMPILE.COM now logs resource usage of build commands - Start implementing basic poll() support on bare metal - Set getauxval(AT_EXECFN) to GetModuleFileName() on NT - Add descriptions to strerror() in non-TINY build modes - Add COUNTBRANCH() macro to help with micro-optimizations - Make error / backtrace / asan / memory code more unbreakable - Add fast perfect C implementation of μ-Law and a-Law audio codecs - Make strtol() functions consistent with other libc implementations - Improve Linenoise implementation (see also github.com/jart/bestline) - COMPILE.COM now suppresses stdout/stderr of successful build commands
This commit is contained in:
parent
fa7b4f5bd1
commit
39bf41f4eb
806 changed files with 77494 additions and 63859 deletions
32
third_party/python/Lib/test/test_signal.py
vendored
32
third_party/python/Lib/test/test_signal.py
vendored
|
@ -275,7 +275,8 @@ class WakeupSignalTests(unittest.TestCase):
|
|||
raise InterruptSelect
|
||||
signal.signal(signal.SIGALRM, handler)
|
||||
|
||||
signal.alarm(1)
|
||||
# signal.alarm(1)
|
||||
signal.setitimer(signal.ITIMER_REAL, 0.001)
|
||||
|
||||
# We attempt to get a signal during the sleep,
|
||||
# before select is called
|
||||
|
@ -309,7 +310,9 @@ class WakeupSignalTests(unittest.TestCase):
|
|||
raise InterruptSelect
|
||||
signal.signal(signal.SIGALRM, handler)
|
||||
|
||||
signal.alarm(1)
|
||||
# signal.alarm(1)
|
||||
signal.setitimer(signal.ITIMER_REAL, 0.001)
|
||||
|
||||
before_time = time.monotonic()
|
||||
# We attempt to get a signal during the select call
|
||||
try:
|
||||
|
@ -466,7 +469,8 @@ class SiginterruptTest(unittest.TestCase):
|
|||
try:
|
||||
for loop in range(2):
|
||||
# send a SIGALRM in a second (during the read)
|
||||
signal.alarm(1)
|
||||
# signal.alarm(1)
|
||||
signal.setitimer(signal.ITIMER_REAL, 0.001)
|
||||
try:
|
||||
# blocking call: read from a pipe without data
|
||||
os.read(r, 1)
|
||||
|
@ -563,7 +567,7 @@ class ItimerTest(unittest.TestCase):
|
|||
|
||||
def test_itimer_real(self):
|
||||
self.itimer = signal.ITIMER_REAL
|
||||
signal.setitimer(self.itimer, 1.0)
|
||||
signal.setitimer(self.itimer, 0.01)
|
||||
signal.pause()
|
||||
self.assertEqual(self.hndl_called, True)
|
||||
|
||||
|
@ -574,7 +578,6 @@ class ItimerTest(unittest.TestCase):
|
|||
self.itimer = signal.ITIMER_VIRTUAL
|
||||
signal.signal(signal.SIGVTALRM, self.sig_vtalrm)
|
||||
signal.setitimer(self.itimer, 0.3, 0.2)
|
||||
|
||||
start_time = time.monotonic()
|
||||
while time.monotonic() - start_time < 60.0:
|
||||
# use up some virtual time by doing real work
|
||||
|
@ -584,7 +587,6 @@ class ItimerTest(unittest.TestCase):
|
|||
else: # Issue 8424
|
||||
self.skipTest("timeout: likely cause: machine too slow or load too "
|
||||
"high")
|
||||
|
||||
# virtual itimer should be (0.0, 0.0) now
|
||||
self.assertEqual(signal.getitimer(self.itimer), (0.0, 0.0))
|
||||
# and the handler should have been called
|
||||
|
@ -596,8 +598,7 @@ class ItimerTest(unittest.TestCase):
|
|||
def test_itimer_prof(self):
|
||||
self.itimer = signal.ITIMER_PROF
|
||||
signal.signal(signal.SIGPROF, self.sig_prof)
|
||||
signal.setitimer(self.itimer, 0.2, 0.2)
|
||||
|
||||
signal.setitimer(self.itimer, 0.1, 0.1)
|
||||
start_time = time.monotonic()
|
||||
while time.monotonic() - start_time < 60.0:
|
||||
# do some work
|
||||
|
@ -607,7 +608,6 @@ class ItimerTest(unittest.TestCase):
|
|||
else: # Issue 8424
|
||||
self.skipTest("timeout: likely cause: machine too slow or load too "
|
||||
"high")
|
||||
|
||||
# profiling itimer should be (0.0, 0.0) now
|
||||
self.assertEqual(signal.getitimer(self.itimer), (0.0, 0.0))
|
||||
# and the handler should have been called
|
||||
|
@ -619,7 +619,7 @@ class ItimerTest(unittest.TestCase):
|
|||
# the interval down to zero, which would disable the timer.
|
||||
self.itimer = signal.ITIMER_REAL
|
||||
signal.setitimer(self.itimer, 1e-6)
|
||||
time.sleep(1)
|
||||
time.sleep(.11)
|
||||
self.assertEqual(self.hndl_called, True)
|
||||
|
||||
|
||||
|
@ -750,7 +750,8 @@ class PendingSignalsTests(unittest.TestCase):
|
|||
def test_sigwait(self):
|
||||
self.wait_helper(signal.SIGALRM, '''
|
||||
def test(signum):
|
||||
signal.alarm(1)
|
||||
# signal.alarm(1)
|
||||
signal.setitimer(signal.ITIMER_REAL, 0.001)
|
||||
received = signal.sigwait([signum])
|
||||
assert isinstance(received, signal.Signals), received
|
||||
if received != signum:
|
||||
|
@ -762,7 +763,8 @@ class PendingSignalsTests(unittest.TestCase):
|
|||
def test_sigwaitinfo(self):
|
||||
self.wait_helper(signal.SIGALRM, '''
|
||||
def test(signum):
|
||||
signal.alarm(1)
|
||||
# signal.alarm(1)
|
||||
signal.setitimer(signal.ITIMER_REAL, 0.001)
|
||||
info = signal.sigwaitinfo([signum])
|
||||
if info.si_signo != signum:
|
||||
raise Exception("info.si_signo != %s" % signum)
|
||||
|
@ -773,7 +775,8 @@ class PendingSignalsTests(unittest.TestCase):
|
|||
def test_sigtimedwait(self):
|
||||
self.wait_helper(signal.SIGALRM, '''
|
||||
def test(signum):
|
||||
signal.alarm(1)
|
||||
# signal.alarm(1)
|
||||
signal.setitimer(signal.ITIMER_REAL, 0.001)
|
||||
info = signal.sigtimedwait([signum], 10.1000)
|
||||
if info.si_signo != signum:
|
||||
raise Exception('info.si_signo != %s' % signum)
|
||||
|
@ -820,15 +823,12 @@ class PendingSignalsTests(unittest.TestCase):
|
|||
# fork() and exec().
|
||||
assert_python_ok("-c", """if True:
|
||||
import os, threading, sys, time, signal
|
||||
|
||||
# the default handler terminates the process
|
||||
signum = signal.SIGUSR1
|
||||
|
||||
def kill_later():
|
||||
# wait until the main thread is waiting in sigwait()
|
||||
time.sleep(1)
|
||||
os.kill(os.getpid(), signum)
|
||||
|
||||
# the signal must be blocked by all the threads
|
||||
signal.pthread_sigmask(signal.SIG_BLOCK, [signum])
|
||||
killer = threading.Thread(target=kill_later)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue