Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 412dc9c

Browse files
committed
Merged revisions 60350-60363 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r60355 | neal.norwitz | 2008-01-27 18:10:14 +0100 (Sun, 27 Jan 2008) | 1 line Whitespace cleanup ........ r60356 | neal.norwitz | 2008-01-27 18:10:29 +0100 (Sun, 27 Jan 2008) | 1 line Add assertion that we do not blow out newl ........ r60357 | neal.norwitz | 2008-01-27 18:10:35 +0100 (Sun, 27 Jan 2008) | 1 line Initialize variable to prevent warning on some platform/config. ........ r60358 | neal.norwitz | 2008-01-27 18:10:43 +0100 (Sun, 27 Jan 2008) | 1 line Update to newer version of ffi. Fixes crashes and test failures of longdouble ........ r60359 | neal.norwitz | 2008-01-27 18:10:50 +0100 (Sun, 27 Jan 2008) | 1 line Add a tiny sleep and additional flush to force the file to really be synced. ........ r60360 | neal.norwitz | 2008-01-27 18:10:58 +0100 (Sun, 27 Jan 2008) | 1 line Retry connection in case it fails to reduce flakiness ........ r60361 | neal.norwitz | 2008-01-27 18:11:11 +0100 (Sun, 27 Jan 2008) | 4 lines Catch socket errors that are often the cause of transient failures. Many of these exceptions are due to resource unavailable, so the existing code should be able to handle many more spurious errors. ........ r60362 | neal.norwitz | 2008-01-27 18:12:15 +0100 (Sun, 27 Jan 2008) | 1 line Reduce buffer size since we do not need 1k ........ r60363 | neal.norwitz | 2008-01-27 18:13:07 +0100 (Sun, 27 Jan 2008) | 1 line Print periodic "still working" messages since this suite is slow. ........
1 parent 661b0a1 commit 412dc9c

9 files changed

Lines changed: 133 additions & 54 deletions

File tree

Lib/test/test_bsddb3.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
Run all test cases.
44
"""
55
import sys
6+
import time
67
import unittest
78
import test.test_support
89
from test.test_support import requires, run_unittest, unlink
@@ -22,6 +23,30 @@
2223
sys.argv.remove('silent')
2324

2425

26+
class TimingCheck(unittest.TestCase):
27+
28+
"""This class is not a real test. Its purpose is to print a message
29+
periodically when the test runs slowly. This will prevent the buildbots
30+
from timing out on slow machines."""
31+
32+
# How much time in seconds before printing a 'Still working' message.
33+
# Since this is run at most once between each test module, use a smaller
34+
# interval than other tests.
35+
_PRINT_WORKING_MSG_INTERVAL = 4 * 60
36+
37+
# next_time is used as a global variable that survives each instance.
38+
# This is necessary since a new instance will be created for each test.
39+
next_time = time.time() + _PRINT_WORKING_MSG_INTERVAL
40+
41+
def testCheckElapsedTime(self):
42+
# Print still working message since these tests can be really slow.
43+
now = time.time()
44+
if self.next_time <= now:
45+
TimingCheck.next_time = now + self._PRINT_WORKING_MSG_INTERVAL
46+
sys.__stdout__.write(' test_bsddb3 still working, be patient...\n')
47+
sys.__stdout__.flush()
48+
49+
2550
def suite():
2651
try:
2752
# this is special, it used to segfault the interpreter
@@ -56,6 +81,7 @@ def suite():
5681
module = __import__("bsddb.test."+name, globals(), locals(), name)
5782
#print module,name
5883
alltests.addTest(module.test_suite())
84+
alltests.addTest(unittest.makeSuite(TimingCheck))
5985
return alltests
6086

6187

Lib/test/test_resource.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import unittest
22
from test import test_support
33

4-
5-
import os, resource
4+
import os
5+
import resource
6+
import time
67

78
# This test is checking a few specific problem spots with the resource module.
89

@@ -59,6 +60,8 @@ def test_fsize_enforced(self):
5960
# an attempt to ensure the file is really synced and
6061
# the exception raised.
6162
for i in range(5):
63+
time.sleep(.1)
64+
f.flush()
6265
f.close()
6366
except IOError:
6467
if not limit_set:

Lib/test/test_xmlrpc.py

Lines changed: 46 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -345,9 +345,11 @@ def test_simple1(self):
345345
try:
346346
p = xmlrpclib.ServerProxy('http://localhost:%d' % PORT)
347347
self.assertEqual(p.pow(6,8), 6**8)
348-
except xmlrpclib.ProtocolError as e:
349-
# protocol error; provide additional information in test output
350-
self.fail("%s\n%s" % (e, e.headers))
348+
except (xmlrpclib.ProtocolError, socket.error) as e:
349+
# ignore failures due to non-blocking socket 'unavailable' errors
350+
if not is_unavailable_exception(e):
351+
# protocol error; provide additional information in test output
352+
self.fail("%s\n%s" % (e, e.headers))
351353

352354
# [ch] The test 404 is causing lots of false alarms.
353355
def XXXtest_404(self):
@@ -369,27 +371,32 @@ def test_introspection1(self):
369371
'system.listMethods', 'system.methodHelp',
370372
'system.methodSignature', 'system.multicall'])
371373
self.assertEqual(set(meth), expected_methods)
372-
except xmlrpclib.ProtocolError as e:
373-
# protocol error; provide additional information in test output
374-
self.fail("%s\n%s" % (e, e.headers))
374+
except (xmlrpclib.ProtocolError, socket.error) as e:
375+
# ignore failures due to non-blocking socket 'unavailable' errors
376+
if not is_unavailable_exception(e):
377+
# protocol error; provide additional information in test output
378+
self.fail("%s\n%s" % (e, e.headers))
379+
375380

376381
def test_introspection2(self):
377382
try:
378383
# test _methodHelp()
379384
p = xmlrpclib.ServerProxy('http://localhost:%d' % PORT)
380385
divhelp = p.system.methodHelp('div')
381386
self.assertEqual(divhelp, 'This is the div function')
382-
except xmlrpclib.ProtocolError as e:
383-
# protocol error; provide additional information in test output
384-
self.fail("%s\n%s" % (e, e.headers))
387+
except (xmlrpclib.ProtocolError, socket.error) as e:
388+
# ignore failures due to non-blocking socket 'unavailable' errors
389+
if not is_unavailable_exception(e):
390+
# protocol error; provide additional information in test output
391+
self.fail("%s\n%s" % (e, e.headers))
385392

386393
def test_introspection3(self):
387394
try:
388395
# test native doc
389396
p = xmlrpclib.ServerProxy('http://localhost:%d' % PORT)
390397
myfunction = p.system.methodHelp('my_function')
391398
self.assertEqual(myfunction, 'This is my function')
392-
except xmlrpclib.ProtocolError as e:
399+
except (xmlrpclib.ProtocolError, socket.error) as e:
393400
# ignore failures due to non-blocking socket 'unavailable' errors
394401
if not is_unavailable_exception(e):
395402
# protocol error; provide additional information in test output
@@ -402,9 +409,11 @@ def test_introspection4(self):
402409
p = xmlrpclib.ServerProxy('http://localhost:%d' % PORT)
403410
divsig = p.system.methodSignature('div')
404411
self.assertEqual(divsig, 'signatures not supported')
405-
except xmlrpclib.ProtocolError as e:
406-
# protocol error; provide additional information in test output
407-
self.fail("%s\n%s" % (e, e.headers))
412+
except (xmlrpclib.ProtocolError, socket.error) as e:
413+
# ignore failures due to non-blocking socket 'unavailable' errors
414+
if not is_unavailable_exception(e):
415+
# protocol error; provide additional information in test output
416+
self.fail("%s\n%s" % (e, e.headers))
408417

409418
def test_multicall(self):
410419
try:
@@ -417,9 +426,11 @@ def test_multicall(self):
417426
self.assertEqual(add_result, 2+3)
418427
self.assertEqual(pow_result, 6**8)
419428
self.assertEqual(div_result, 127//42)
420-
except xmlrpclib.ProtocolError as e:
421-
# protocol error; provide additional information in test output
422-
self.fail("%s\n%s" % (e, e.headers))
429+
except (xmlrpclib.ProtocolError, socket.error) as e:
430+
# ignore failures due to non-blocking socket 'unavailable' errors
431+
if not is_unavailable_exception(e):
432+
# protocol error; provide additional information in test output
433+
self.fail("%s\n%s" % (e, e.headers))
423434

424435
def test_non_existing_multicall(self):
425436
try:
@@ -436,7 +447,7 @@ def test_non_existing_multicall(self):
436447
self.assertEqual(result.results[0]['faultString'],
437448
'<type \'Exception\'>:method "this_is_not_exists" '
438449
'is not supported')
439-
except xmlrpclib.ProtocolError as e:
450+
except (xmlrpclib.ProtocolError, socket.error) as e:
440451
# ignore failures due to non-blocking socket 'unavailable' errors
441452
if not is_unavailable_exception(e):
442453
# protocol error; provide additional information in test output
@@ -483,9 +494,11 @@ def test_basic(self):
483494
try:
484495
p = xmlrpclib.ServerProxy('http://localhost:%d' % PORT)
485496
self.assertEqual(p.pow(6,8), 6**8)
486-
except xmlrpclib.ProtocolError as e:
487-
# protocol error; provide additional information in test output
488-
self.fail("%s\n%s" % (e, e.headers))
497+
except (xmlrpclib.ProtocolError, socket.error) as e:
498+
# ignore failures due to non-blocking socket 'unavailable' errors
499+
if not is_unavailable_exception(e):
500+
# protocol error; provide additional information in test output
501+
self.fail("%s\n%s" % (e, e.headers))
489502

490503
def test_fail_no_info(self):
491504
# use the broken message class
@@ -494,10 +507,12 @@ def test_fail_no_info(self):
494507
try:
495508
p = xmlrpclib.ServerProxy('http://localhost:%d' % PORT)
496509
p.pow(6,8)
497-
except xmlrpclib.ProtocolError as e:
498-
# The two server-side error headers shouldn't be sent back in this case
499-
self.assertTrue(e.headers.get("X-exception") is None)
500-
self.assertTrue(e.headers.get("X-traceback") is None)
510+
except (xmlrpclib.ProtocolError, socket.error) as e:
511+
# ignore failures due to non-blocking socket 'unavailable' errors
512+
if not is_unavailable_exception(e):
513+
# The two server-side error headers shouldn't be sent back in this case
514+
self.assertTrue(e.headers.get("X-exception") is None)
515+
self.assertTrue(e.headers.get("X-traceback") is None)
501516
else:
502517
self.fail('ProtocolError not raised')
503518

@@ -512,11 +527,13 @@ def test_fail_with_info(self):
512527
try:
513528
p = xmlrpclib.ServerProxy('http://localhost:%d' % PORT)
514529
p.pow(6,8)
515-
except xmlrpclib.ProtocolError as e:
516-
# We should get error info in the response
517-
expected_err = "invalid literal for int() with base 10: 'I am broken'"
518-
self.assertEqual(e.headers.get("x-exception"), expected_err)
519-
self.assertTrue(e.headers.get("x-traceback") is not None)
530+
except (xmlrpclib.ProtocolError, socket.error) as e:
531+
# ignore failures due to non-blocking socket 'unavailable' errors
532+
if not is_unavailable_exception(e):
533+
# We should get error info in the response
534+
expected_err = "invalid literal for int() with base 10: 'I am broken'"
535+
self.assertEqual(e.headers.get("x-exception"), expected_err)
536+
self.assertTrue(e.headers.get("x-traceback") is not None)
520537
else:
521538
self.fail('ProtocolError not raised')
522539

Modules/_ctypes/libffi/src/alpha/ffi.c

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,22 @@
2525

2626
#include <ffi.h>
2727
#include <ffi_common.h>
28-
2928
#include <stdlib.h>
3029

31-
extern void ffi_call_osf(void *, unsigned long, unsigned, void *, void (*)(void));
32-
extern void ffi_closure_osf(void);
30+
/* Force FFI_TYPE_LONGDOUBLE to be different than FFI_TYPE_DOUBLE;
31+
all further uses in this file will refer to the 128-bit type. */
32+
#if defined(__LONG_DOUBLE_128__)
33+
# if FFI_TYPE_LONGDOUBLE != 4
34+
# error FFI_TYPE_LONGDOUBLE out of date
35+
# endif
36+
#else
37+
# undef FFI_TYPE_LONGDOUBLE
38+
# define FFI_TYPE_LONGDOUBLE 4
39+
#endif
40+
41+
extern void ffi_call_osf(void *, unsigned long, unsigned, void *, void (*)(void))
42+
FFI_HIDDEN;
43+
extern void ffi_closure_osf(void) FFI_HIDDEN;
3344

3445

3546
ffi_status
@@ -49,6 +60,11 @@ ffi_prep_cif_machdep(ffi_cif *cif)
4960
cif->flags = cif->rtype->type;
5061
break;
5162

63+
case FFI_TYPE_LONGDOUBLE:
64+
/* 128-bit long double is returned in memory, like a struct. */
65+
cif->flags = FFI_TYPE_STRUCT;
66+
break;
67+
5268
default:
5369
cif->flags = FFI_TYPE_INT;
5470
break;
@@ -57,15 +73,14 @@ ffi_prep_cif_machdep(ffi_cif *cif)
5773
return FFI_OK;
5874
}
5975

76+
6077
void
6178
ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
6279
{
6380
unsigned long *stack, *argp;
6481
long i, avn;
6582
ffi_type **arg_types;
6683

67-
FFI_ASSERT (cif->abi == FFI_OSF);
68-
6984
/* If the return value is a struct and we don't have a return
7085
value address then we need to make one. */
7186
if (rvalue == NULL && cif->flags == FFI_TYPE_STRUCT)
@@ -84,6 +99,8 @@ ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
8499

85100
while (i < avn)
86101
{
102+
size_t size = (*arg_types)->size;
103+
87104
switch ((*arg_types)->type)
88105
{
89106
case FFI_TYPE_SINT8:
@@ -129,6 +146,12 @@ ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
129146
*(double *) argp = *(double *)(* avalue);
130147
break;
131148

149+
case FFI_TYPE_LONGDOUBLE:
150+
/* 128-bit long double is passed by reference. */
151+
*(long double **) argp = (long double *)(* avalue);
152+
size = sizeof (long double *);
153+
break;
154+
132155
case FFI_TYPE_STRUCT:
133156
memcpy(argp, *avalue, (*arg_types)->size);
134157
break;
@@ -137,7 +160,7 @@ ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
137160
FFI_ASSERT(0);
138161
}
139162

140-
argp += ALIGN((*arg_types)->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG;
163+
argp += ALIGN(size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG;
141164
i++, arg_types++, avalue++;
142165
}
143166

@@ -153,8 +176,6 @@ ffi_prep_closure (ffi_closure* closure,
153176
{
154177
unsigned int *tramp;
155178

156-
FFI_ASSERT (cif->abi == FFI_OSF);
157-
158179
tramp = (unsigned int *) &closure->tramp[0];
159180
tramp[0] = 0x47fb0401; /* mov $27,$1 */
160181
tramp[1] = 0xa77b0010; /* ldq $27,16($27) */
@@ -177,7 +198,8 @@ ffi_prep_closure (ffi_closure* closure,
177198
return FFI_OK;
178199
}
179200

180-
int
201+
202+
long FFI_HIDDEN
181203
ffi_closure_osf_inner(ffi_closure *closure, void *rvalue, unsigned long *argp)
182204
{
183205
ffi_cif *cif;
@@ -205,6 +227,8 @@ ffi_closure_osf_inner(ffi_closure *closure, void *rvalue, unsigned long *argp)
205227
/* Grab the addresses of the arguments from the stack frame. */
206228
while (i < avn)
207229
{
230+
size_t size = arg_types[i]->size;
231+
208232
switch (arg_types[i]->type)
209233
{
210234
case FFI_TYPE_SINT8:
@@ -236,16 +260,22 @@ ffi_closure_osf_inner(ffi_closure *closure, void *rvalue, unsigned long *argp)
236260
avalue[i] = &argp[argn - (argn < 6 ? 6 : 0)];
237261
break;
238262

263+
case FFI_TYPE_LONGDOUBLE:
264+
/* 128-bit long double is passed by reference. */
265+
avalue[i] = (long double *) argp[argn];
266+
size = sizeof (long double *);
267+
break;
268+
239269
default:
240-
FFI_ASSERT(0);
270+
abort ();
241271
}
242272

243-
argn += ALIGN(arg_types[i]->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG;
273+
argn += ALIGN(size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG;
244274
i++;
245275
}
246276

247277
/* Invoke the closure. */
248-
(closure->fun) (cif, rvalue, avalue, closure->user_data);
278+
closure->fun (cif, rvalue, avalue, closure->user_data);
249279

250280
/* Tell ffi_closure_osf how to perform return type promotions. */
251281
return cif->rtype->type;

Modules/_ctypes/libffi/src/alpha/osf.S

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
/* -----------------------------------------------------------------------
2-
osf.S - Copyright (c) 1998, 2001 Red Hat
2+
osf.S - Copyright (c) 1998, 2001, 2007 Red Hat
33
44
Alpha/OSF Foreign Function Interface
55
6-
$Id: osf.S,v 1.2 2006/03/03 20:24:26 theller Exp $
7-
86
Permission is hereby granted, free of charge, to any person obtaining
97
a copy of this software and associated documentation files (the
108
``Software''), to deal in the Software without restriction, including
@@ -42,6 +40,8 @@
4240
.align 3
4341
.globl ffi_call_osf
4442
.ent ffi_call_osf
43+
FFI_HIDDEN(ffi_call_osf)
44+
4545
ffi_call_osf:
4646
.frame $15, 32, $26, 0
4747
.mask 0x4008000, -32
@@ -129,6 +129,8 @@ $LFE1:
129129
.align 3
130130
.globl ffi_closure_osf
131131
.ent ffi_closure_osf
132+
FFI_HIDDEN(ffi_closure_osf)
133+
132134
ffi_closure_osf:
133135
.frame $30, 16*8, $26, 0
134136
.mask 0x4000000, -16*8
@@ -265,7 +267,7 @@ $load_table:
265267
.gprel32 $load_32 # FFI_TYPE_INT
266268
.gprel32 $load_float # FFI_TYPE_FLOAT
267269
.gprel32 $load_double # FFI_TYPE_DOUBLE
268-
.gprel32 $load_double # FFI_TYPE_LONGDOUBLE
270+
.gprel32 $load_none # FFI_TYPE_LONGDOUBLE
269271
.gprel32 $load_u8 # FFI_TYPE_UINT8
270272
.gprel32 $load_s8 # FFI_TYPE_SINT8
271273
.gprel32 $load_u16 # FFI_TYPE_UINT16

0 commit comments

Comments
 (0)