473,657 Members | 2,378 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I use trace to generate coverage data in multi-threadedprogram s?

I'm trying to use the trace module to build coverage files for
a multi-threaded program.

http://docs.python.org/lib/module-trace.html

I test my application using trace.py from the command-line like this:

/usr/lib/python2.5/trace.py --missing --count --summary tools/
testall.py

When I examine the *.cover files that are generated after a test run
I do not see coverage information for the methods that were run
in a separate thread. How can I collect coverage information for
methods that only run in a separate thread (never in the main thread)?

Any tips?

--
Noah Spurrier
Dec 20 '07 #1
2 1253
En Thu, 20 Dec 2007 00:33:00 -0300, Noah <no**@noah.orge scribió:
I'm trying to use the trace module to build coverage files for
a multi-threaded program.

http://docs.python.org/lib/module-trace.html

I test my application using trace.py from the command-line like this:

/usr/lib/python2.5/trace.py --missing --count --summary tools/
testall.py

When I examine the *.cover files that are generated after a test run
I do not see coverage information for the methods that were run
in a separate thread. How can I collect coverage information for
methods that only run in a separate thread (never in the main thread)?
There is a threading.settr ace function, which sets the trace function for
every thread just before it is started. I don't know if the trace module
allows for multiple threads, or will just crash :), but in any case if one
were to add support for this scenario, that would be the starting point.

--
Gabriel Genellina

Dec 20 '07 #2
On Dec 19, 7:33 pm, Noah <n...@noah.orgw rote:
/usr/lib/python2.5/trace.py --missing --count --summary tools/testall.py

When I examine the *.cover files that are generated after a test run
I do not see coverage information for the methods that were run
in a separate thread. How can I collect coverage information for
methods that only run in a separate thread (never in the main thread)?
Just for the record, the problem was due to the fact that I was
creating threads
using the "thread" module. When I switched to creating threads using
the
"threading" module I was able to see my thread code in coverage
reports.

--
Noah Spurrier
Dec 21 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1585
by: Vijay Sankar | last post by:
Hi, I am using coverage.py to check the code coverage for some of my Python scripts. For a particular script which uses 'exit' calls, I am getting the following error when I invoke the script with the -x option for coverage. Error in sys.exitfunc: Traceback (most recent call last):
1
2202
by: Daylor | last post by:
hi. i have application with 5 threads. can i use the trace and tracelistener, so if i trace in thread1 , it will write to file1, and if i trace to thread2 if will write to file2. hope im clear, have a nice day.
0
1257
by: momina_dar | last post by:
AlachiSoft “TierDeveloper” eradicates the problem of writing thousands of lines of code for your middle tier. Many software solutions on the market can do it for you but according to our research there are few solutions in market, which can really be of any benefit to the software developer, And TierDeveloper is one of them. TierDeveloper 3.0. is an O/R mapping and code generation tool that helps software developers boost their development...
0
1754
by: djaquay | last post by:
I've been using trace.py to get code coverage results for my unit tests, and like it. Now I'm trying to use it for code coverage of the GUI parts of my wxPython-based program, and I realized how nice it would be to be able to see what lines I'd covered and what remained to be exercised, without having to stop the trace to get the output updated. It occurred to me that accepting the "--trace" output from trace.py as input to another...
232
13242
by: robert maas, see http://tinyurl.com/uh3t | last post by:
I'm working on examples of programming in several languages, all (except PHP) running under CGI so that I can show both the source files and the actually running of the examples online. The first set of examples, after decoding the HTML FORM contents, merely verifies the text within a field to make sure it is a valid representation of an integer, without any junk thrown in, i.e. it must satisfy the regular expression: ^ *?+ *$ If the...
2
1777
by: Orin | last post by:
Hi, I have a problem in using coverage.py module in my project: ../cov -c Traceback (most recent call last): File "./cov", line 10, in ? coverage.the_coverage.command_line(sys.argv) File "/usr/lib/python2.4/site-packages/coverage.py", line 363, in command_line self.collect() File "/usr/lib/python2.4/site-packages/coverage.py", line 467, in
1
3349
by: | last post by:
I have a multi threaded app that runs fine 99 percent of the time. However, sporadically, I receive error {Cannot evaluate expression because the current thread is in a stack overflow state.} at different spots in the code. Random lines of code seem to generate this error, never the same line twice so far. The threading is defined like so... I'm hoping that there may be a way to accomplish the same threading and without generating this...
1
3172
by: ofirmgr | last post by:
im trying to understand how the profiler works. so i started 2 profilers,one listen to another and I saw the profiler is running: exec sp_trace_create @P1 output, 1, NULL, NULL, NULL which means @tracefile = NULL so where from the profiler read the results?!
1
1154
by: skip | last post by:
I am trying to use the trace module with the --count flag to test for statement coverage in my doctests. The trace coverage listing is very weird, marking many statements as unexecuted which were clearly executed during the run (I can see their output on the screen). Is this some known interaction between the trace and doctest modules? Thanks, -- Skip Montanaro - skip@pobox.com - http://www.webfast.com/~skip/
0
1373
by: gray d newbie | last post by:
Hi All, I am currently supporting an ASP based system which is using Commerce Server 2000. On and off when the end user using the module, as long as the module have to do with user profile processing, it may land on an error page saying "An invalid value has been specified for key member." (random occurence, sometime it works fine). After searching the MSDN via the link below: http://msdn.microsoft.com/en-us/library/ms962856.aspx It...
0
8838
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8513
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7351
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6176
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5638
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2740
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1969
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.