Random crashes while running (cmd) test runner

Frédéric Delanoy frederic.delanoy at gmail.com
Sat Jul 2 14:31:52 CDT 2011

Hi folks,

I'm in the process of writing a couple of cmd tests (on top of master,
not of my currently pending patches), and I at times have problems
where none of the tests is actually performed, but the test suite
still returns without any error indication, e.g.

batch.c:306: running TEST_BUILTINS.CMD test...
batch: 7 tests executed (0 marked as todo, 0 failures), 0 skipped.

which many more tests should be performed

After checking with "winedbg --gdb" it gets a SIGSEGV

I tried to reproduce with a mimimal output file and expected file, and
get weird results. Say you have the following files:

@echo off
echo should fail
<empty line>

and test_builtins.cmd.exp
<empty line>

When I run make testclean && make test in programs/cmd/tests, I get
the following (first line of .exp file executed somehow...)

batch.c:215: Test failed: unexpected char 0x73 position 0 in line 1
(got 'should fail', wanted 'dir')
batch.c:227: Test failed: too long output, got additional Volume
Serial Number is 0000-0000

Directory of Z:\path\to\wine\programs\cmd\tests

 2/07/2011     20:56  <DIR>         .
 2/07/2011     14:34  <DIR>         ..
 2/07/2011      2:34        11,074  batch.c

batch: 14 tests executed (0 marked as todo, 2 failures), 0 skipped.

If I run "/wine winedbg --gdb programs/cmd/tests/cmd.exe_test.exe.so"
and run (c)ont, I get a SIGSEGV:

Program received signal SIGSEGV, Segmentation fault.
0x7bc481f2 in HEAP_MakeInUseBlockFree (subheap=0x110014,
pArena=0x1106a8) at heap.c:640
640	        size += (pFree->size & ARENA_SIZE_MASK) + sizeof(ARENA_FREE);

Full backtrace:
#0  0x7bc481f2 in HEAP_MakeInUseBlockFree (subheap=0x110014,
pArena=0x1106a8) at heap.c:640
#1  0x7bc4b7f5 in RtlFreeHeap (heap=0x110000, flags=2, ptr=0x1106b0)
at heap.c:1757
#2  0x7bc6ed27 in RtlFreeUnicodeString (str=0x33f8fc) at rtlstr.c:319
#3  0x7b83f06c in CreateFileW (filename=0x7ffd8c00, access=1073741824,
sharing=0, sa=0x0,
    creation=2, attributes=128, template=0x0) at file.c:1421
#4  0x7b83f14a in CreateFileA (filename=0x7effd262 "test.cmd",
access=1073741824, sharing=0,
    sa=0x0, creation=2, attributes=128, template=0x0) at file.c:1443
#5  0x7effaf5a in run_cmd (cmd_data=0x110688 "@echo off\necho should
    cmd_size=34) at batch.c:68
#6  0x7effb9f4 in run_test (cmd_data=0x7efff52c "@echo off\necho
should fail\n\n\ndir\n\n",
    cmd_size=28, exp_data=0x7efff548 "\ndir\n\n", exp_size=6) at batch.c:239
#7  0x7effbe46 in test_enum_proc (module=0x7eff0000, type=0x7effd4ab "TESTCMD",
    name=0x110668 "TEST_BUILTINS.CMD", param=0) at batch.c:317
#8  0x7b86d748 in EnumResourceNamesA (hmod=0x7eff0000, type=0x7effd4ab
    lpfun=0x7effbd43 <test_enum_proc>, lparam=0) at resource.c:345
#9  0x7effc008 in func_batch () at batch.c:353
#10 0x7effcc92 in run_test (name=0x7effd745 "batch") at
#11 0x7effd057 in main (argc=1, argv=0x1103e0) at
#12 0x7effd136 in __wine_spec_exe_entry (peb=0x7ffdf000) at exe_entry.c:36
#13 0x7b860008 in call_process_entry () at process.c:1035
#14 0x7b86014f in start_process (peb=0x7ffdf000) at process.c:1087
#15 0x7bc7f22c in call_thread_func () at signal_i386.c:2473
#16 0x7bc7f26a in call_thread_entry_point (entry=0x7b86000a
<start_process>, arg=0x7ffdf000)
    at signal_i386.c:2499
#17 0x7bc542cf in start_process (kernel_start=0x7b86000a) at loader.c:2612
#18 0xf7609b95 in wine_call_on_stack () at port.c:60
#19 0xf7609b73 in wine_switch_to_stack (func=0x7bc542a9
<start_process>, arg=0x7b86000a,
    stack=0x340000) at port.c:59
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

Does anyone know what's going wrong exactly?


Note: wine-1.3.23-164-ge18c15d compiled with "-O0 -g" on Natty x86_64

More information about the wine-devel mailing list