[PATCH 1/3] [cmd] Convert the set /a tests to validate better

Ann and Jason Edmeades us at edmeades.me.uk
Sat Dec 15 15:41:56 CST 2012

>NB: replies on wine-devel should be only the bottom

Hmm... gmail.... new style compose window.... missed the ...'s - How
obvious is that... hopefully sorted?

I don't really understand your point here. You're echoing the variable
> name anyway, so if the 'set foo' displays it as well; I don't see the
> advantage of your method

If you have a script which does e.g. set WINE_var1, then it outputs
'WINE_var1=42' or whatever, but is that the right value? With the existing
echo behviour its a real pain to know, and relies on you using the make
test to run all the suite, then compare the output with some predefined
list of results. If you have a script which echo's something like
'wine_var1 correctly 42' or 'ERROR: wine_var1 is 42 and it should be -1'
then you immediately see the result. This is especially useful in that you
can then extract the portion you need to test into a standalone command
file, test on multiple os's, add other tests, then put back into the test
suite trivially. Far better than just a straight echo out. I'd also suggest
such coding mirrors all the other testsuites, where you check the results
you expect then and there, meaning the code and expected values are all
side by side.

> An interim option might be something like 'checkcontents var value var
> > value' type routine - would that be better?
> Seems convoluted. Why just no go KISS?
Because of the above - I very strongly believe the above its far clearer
when both writing and debugging - See the cmd copy tests, for example

Unfortunately this is the point NT4 kicks in and is a right pain...

My ideal solution:
if "%1"=="" goto :eof
for /f "tokens=2 delims==" %%i in ('set %1') do (
  if "%%i"=="%2" (echo %1 correctly %2) else echo ERROR: %1 incorrectly %%i
set %1=
rem shift
goto :check_vars

This doesnt work as NT4s for /f is just screwed. The only solution I ended
up with is the far from ideal

if "%1"=="" goto :eof
call :executecmd set wine_result=%%%1%%
if "%wine_result%"=="%2" (
  echo %1 correctly %2
) else echo ERROR: %1 incorrectly %wine_result% [%2]
set %1=
rem shift
goto :check_vars
goto :eof

Any alternative suggestions?

In other "non-for /a" test, there's never a WINE_foo1 anywhere. Using
> "foo", "bar" and "baz" when you have at most 3 arguments seems
> standard practice to me.

Ok, I really dont care what they are called - easy enough to fix with a
simple search/replace.

 Any comments on the rest of the patches, especially the code one?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20121215/07de2609/attachment.html>

More information about the wine-devel mailing list