[Piglit] [PATCH] modified TestResults::write() for thread safety
Ian Romanick
idr at freedesktop.org
Thu Jan 20 09:23:26 PST 2011
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 01/19/2011 05:26 PM, Eoff, Ullysses A wrote:
> That is correct.
Okay. I've applied the patch. Thanks.
>> -----Original Message-----
>> From: Ian Romanick [mailto:idr at freedesktop.org]
>> Sent: Wednesday, January 19, 2011 4:56 PM
>> To: Eoff, Ullysses A
>> Cc: piglit at lists.freedesktop.org
>> Subject: Re: [Piglit] [PATCH] modified TestResults::write() for thread
>> safety
>>
> On 01/19/2011 03:05 PM, U. Artie Eoff wrote:
>>>> made TestResults::write() thread-safe by writing results in one
>>>> chunk to the file so that when threaded tests are implemented
>>>> there will be no interleaving.
>
> This is just for writing the results to the summary file, right? In
> other words, this isn't the path that logs to the console.
>
>>>> ---
>>>> framework/core.py | 15 +++++++++------
>>>> 1 files changed, 9 insertions(+), 6 deletions(-)
>>>>
>>>> diff --git a/framework/core.py b/framework/core.py
>>>> index b237df6..b975cb3 100644
>>>> --- a/framework/core.py
>>>> +++ b/framework/core.py
>>>> @@ -31,6 +31,7 @@ import subprocess
>>>> import sys
>>>> import time
>>>> import traceback
>>>> +from cStringIO import StringIO
>>>>
>>>> __all__ = [
>>>> 'Environment',
>>>> @@ -107,17 +108,19 @@ class TestResult(dict):
>>>> return {name: self}
>>>>
>>>> def write(self, file, path):
>>>> - print >>file, "@test: " + encode(path)
>>>> + result = StringIO()
>>>> + print >> result, "@test: " + encode(path)
>>>> for k in self:
>>>> v = self[k]
>>>> if type(v) == list:
>>>> - print >>file, k + "!"
>>>> + print >> result, k + "!"
>>>> for s in v:
>>>> - print >>file, " " + encode(str(s))
>>>> - print >>file, "!"
>>>> + print >> result, " " + encode(str(s))
>>>> + print >> result, "!"
>>>> else:
>>>> - print >>file, k + ": " + encode(str(v))
>>>> - print >>file, "!"
>>>> + print >> result, k + ": " + encode(str(v))
>>>> + print >> result, "!"
>>>> + print >> file, result.getvalue(),
>>>>
>>>>
>>>> class GroupResult(dict):
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
iEYEARECAAYFAk04b44ACgkQX1gOwKyEAw/lSwCfUhizEFZ9mUPqYpHhOZP90m+c
mr8An2cC+kp2R4gbO/gU4xLkFS6JGob9
=5TCf
-----END PGP SIGNATURE-----
More information about the Piglit
mailing list