[1/2] shell32/tests: Trace the last ShellExecute command whenever a corresponding test fails.

Francois Gouget fgouget at codeweavers.com
Fri Jan 22 05:15:32 CST 2016


On Fri, 22 Jan 2016, Alexandre Julliard wrote:

> Francois Gouget <fgouget at codeweavers.com> writes:
> 
> > Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
> > ---
> >  dlls/shell32/tests/shlexec.c | 75 ++++++++++++++++++++++++++++++--------------
> >  1 file changed, 52 insertions(+), 23 deletions(-)
> >
> > diff --git a/dlls/shell32/tests/shlexec.c b/dlls/shell32/tests/shlexec.c
> > index 8f03799..360fb2b 100644
> > --- a/dlls/shell32/tests/shlexec.c
> > +++ b/dlls/shell32/tests/shlexec.c
> > @@ -94,6 +94,28 @@ static int _todo_wait = 0;
> >  #define todo_wait for (_todo_wait = 1; _todo_wait; _todo_wait = 0)
> >  
> >  static char shell_call[2048]="";
> > +static char last_shell_call[2048]="";
> > +static void WINETEST_PRINTF_ATTR(2,3) _okShell(int condition, const char *msg, ...)
> > +{
> > +    va_list valist;
> > +
> > +    /* Note: if winetest_debug > 1 the ShellExecute() command has already been
> > +     * traced.
> > +     */
> > +    if (winetest_debug <= 1 && !condition && strcmp(last_shell_call, shell_call))
> > +    {
> > +        winetest_trace("Called %s\n", shell_call);
> > +        strcpy(last_shell_call, shell_call);
> > +    }
> > +
> > +    va_start(valist, msg);
> > +    winetest_vok(condition, msg, valist);
> > +    va_end(valist);
> > +}
> 
> Why is that better than always printing it in the failing calls?

Because usually there is more than one failing call: there's the ok() 
after the shell_execute() and then multiple okChildXxx() calls to verify 
the data received by the child and there is often multiple failures. 
There is no reason for each of them to repeat the information about what 
ShellExecute() call failed. By comparing shell_call and last_shell_call 
okShell ensures that information is printed once before the series of 
failing tests.

It also makes it easier to ensure that this information is not 
duplicated when running with WINETEST_DEBUG > 1 since in that case 
shell_execute{_ex}() already traces the ShellExecute() call.

Another approach would be to systematically print the ShellExecute() 
call in shell_execute{_ex}() before we know if it fails or not. But that 
would only make the already large logs larger for no good reason.


-- 
Francois Gouget <fgouget at codeweavers.com>



More information about the wine-devel mailing list