[qmtest] QMTest running concurrent threads

Stefan Seefeld stefan at codesourcery.com
Wed Nov 18 20:22:29 UTC 2009


On 11/18/2009 02:24 PM, Gary Yuan wrote:
> Hi,
>
> I have a problem when running QMTest using the -j# concurrent option.
> The executable I am testing requires it to be run in a certain
> directory away from the QM testdatabase since it needs to open certain
> resource and definition files (assuming they reside in the present
> working directory). I've implemented a test extension to this effect
> using a mechanism like BASH's pusp/pop directory directive. The
> problem is that when running when concurrent threads, QMTest doesn't
> use a new sandbox environment for each thread but rather picks up
> where any current test leaves off.

It is the test's responsability to do whatever is necessary to protect 
the QMTest application's state from whatever it is that your test is doing.

>   This has the problem of trying to
> push a directory from an unintended location, i.e. a directory that
> was already pushed. Do you know of any clean solution to this problem?
>    

How exactly are you "pushing" the directory ? Are you calling something 
akin to Python's os.chdir() ? That changes the application's global 
state, and thus is a dangerous thing to do, in particular when running 
multi-threaded.

You may encapsulate all this into a wrapper (shell) script that gets 
executed by your test's Run() method. That has the advantage of 
preventing any such changes to affect QMTest's own global state, and 
thus, isolates tests from each other.

Regards,
         Stefan

-- 
Stefan Seefeld
CodeSourcery
stefan at codesourcery.com
(650) 331-3385 x718




More information about the qmtest mailing list