Le 06/04/2013 10:42, Pierre Labastie a écrit :
>> Now, I have a new test failure in pmap:
>> FAIL: pmap extra extended output (footer)
>> :-(
>> Needs more testing, but the behavior seems to be different when running
>> in jhalfs and by hand...
I think I have got the picture. jhalfs is not at fault, except that the 
tests suppose some timing conditions, which are not always met.

First, it is possible to use the dejagnu debugging tools: I changed the 
make check in the jhalfs script to:
make RUNTESTFLAGS='-a -de -v -v' DEJATOOL=pmap check.

This has the effect that a file dbg.log is created in testsuite.
That file contains debugging info on what is matched and how, when using 
the expect command.
The principle of spawn <command>...expect <regexp> commands is that the 
output of the command run by 'spawn' is monitored against regexp. As 
soon as a match is found, the following expect command is executed, so 
that different parts of the output can be monitored in order.
In the failed test, we have (simplifying a bit):
spawn pmap -X $pid
expect "$pid:\\s+\\S+\[^\\r\]+\\s+\\s+\(?:\[A-Z\]\[a-z\]+ +\)+"
expect ".+"
expect "\[= \]+"

Now the first regexp is matched correctly by the first two lines of the 
output, but then, the next one is matched by any non empty string 
following. Since the default matching is greedy, it could happen that 
the whole output matches, and that nothing is left for the last regexp. 
But that is not always true: expect matches in real time whatever comes 
from the spawned command. So it may also happen that the second regexp 
is matched against a partial chunk of output, and that the next chunk of 
output matches the last regexp.

For some reason, the pmap -X test seems to send its whole output at 
once, so there is nothing left for the last regexp and the test fails.

the pmap -XX test (which has the same expect's) sends its output in 
several chunks, so that something is left for the last regexp and the 
test passes.

Actually, the last regexp might not be what upstream intended, since it 
may be matched by any sequence of spaces with no '='.

So, at the end, it is a problem of badly crafted regexp and race 
conditions (and I am happy to say that jhalfs has nothing to do with it)...

To have the tests pass, we could try the sed:
sed -i 's|"\.+"|"\[^=\]+"|' testsuite/pmap.test/pmap.exp

But we could as well disable the tests and wait for upstream to fix them...

Pierre
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to