[PATCH 1/4] infosoft/tests: Fix the infinite loop and crash on Windows 10 1607+.
The test only has expected data for the first four words. So abort if more are found. Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com> --- With this patch, instead of the many many failures and crash we get just a handful of failures that show what's wrong. The fixes for those come in part 4. See: https://test.winehq.org/data/patterns.html#infosoft:infosoft --- dlls/infosoft/tests/infosoft.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/dlls/infosoft/tests/infosoft.c b/dlls/infosoft/tests/infosoft.c index 12bf65a56d3..9ea79008364 100644 --- a/dlls/infosoft/tests/infosoft.c +++ b/dlls/infosoft/tests/infosoft.c @@ -70,11 +70,20 @@ static ULONG WINAPI ws_Release(IWordSink *iface) static HRESULT WINAPI ws_PutWord(IWordSink *iface, ULONG cwc, const WCHAR *pwcInBuf, ULONG cwcSrcLen, ULONG cwcSrcPos) { - ok(testres[wordnum].len == cwcSrcLen, "wrong length\n"); - ok(!cwcSrcPos ||(testres[wordnum].ofs == cwcSrcPos), "wrong offset\n"); - ok(!memcmp(testres[wordnum].data, pwcInBuf, cwcSrcLen), "wrong data\n"); + HRESULT rc = S_OK; + if (wordnum < ARRAY_SIZE(testres)) + { + ok(testres[wordnum].len == cwcSrcLen, "wrong length\n"); + ok(!cwcSrcPos ||(testres[wordnum].ofs == cwcSrcPos), "wrong offset\n"); + ok(!memcmp(testres[wordnum].data, pwcInBuf, cwcSrcLen), "wrong data\n"); + } + else + { + ok(0, "found too many words: %d\n", wordnum + 1); + rc = E_FAIL; + } wordnum++; - return S_OK; + return rc; } static HRESULT WINAPI ws_PutAltWord(IWordSink *iface, ULONG cwc, const WCHAR *pwcInBuf, -- 2.20.1
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com> --- The original failure messages were very uninformative. --- dlls/infosoft/tests/infosoft.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/dlls/infosoft/tests/infosoft.c b/dlls/infosoft/tests/infosoft.c index 9ea79008364..d221cee5732 100644 --- a/dlls/infosoft/tests/infosoft.c +++ b/dlls/infosoft/tests/infosoft.c @@ -71,17 +71,26 @@ static HRESULT WINAPI ws_PutWord(IWordSink *iface, ULONG cwc, const WCHAR *pwcIn ULONG cwcSrcLen, ULONG cwcSrcPos) { HRESULT rc = S_OK; + + winetest_push_context("word %d", wordnum); if (wordnum < ARRAY_SIZE(testres)) { - ok(testres[wordnum].len == cwcSrcLen, "wrong length\n"); - ok(!cwcSrcPos ||(testres[wordnum].ofs == cwcSrcPos), "wrong offset\n"); - ok(!memcmp(testres[wordnum].data, pwcInBuf, cwcSrcLen), "wrong data\n"); + ok(testres[wordnum].len == cwcSrcLen, "expected length %d, got %d\n", + testres[wordnum].len, cwcSrcLen); + ok(!cwcSrcPos || (testres[wordnum].ofs == cwcSrcPos), + "expected offset %d, got %d\n", testres[wordnum].ofs, cwcSrcPos); + ok(!memcmp(testres[wordnum].data, pwcInBuf, cwcSrcLen), + "expected data %s, got %s\n", + wine_dbgstr_wn(testres[wordnum].data, cwcSrcLen), + wine_dbgstr_wn(pwcInBuf, cwcSrcLen)); } else { ok(0, "found too many words: %d\n", wordnum + 1); rc = E_FAIL; } + winetest_pop_context(); + wordnum++; return rc; } @@ -166,7 +175,7 @@ START_TEST(infosoft) TEXT_SOURCE ts; r = CoInitialize(NULL); - ok( r == S_OK, "failed\n"); + ok( r == S_OK, "failed: %08x\n", r); r = CoCreateInstance( &CLSID_wb_neutral, NULL, CLSCTX_INPROC_SERVER, &_IID_IWordBreaker, (LPVOID)&wb); @@ -184,9 +193,9 @@ START_TEST(infosoft) ts.iEnd = lstrlenW(ts.awcBuffer); ts.iCur = 0; r = IWordBreaker_BreakText(wb, &ts, &wordsink.IWordSink_iface, NULL); - ok( r == S_OK, "failed\n"); + ok( r == S_OK, "failed: %08x\n", r); - ok(wordnum == 4, "words not processed\n"); + ok(wordnum == 4, "expected 4 words, got %d\n", wordnum); wordnum = 0; ts.pfnFillTextBuffer = fillbuf_many; @@ -195,12 +204,12 @@ START_TEST(infosoft) ts.iCur = 0; r = fillbuf_many(&ts); - ok( r == S_OK, "failed\n"); + ok( r == S_OK, "failed: %08x\n", r); r = IWordBreaker_BreakText(wb, &ts, &wordsink.IWordSink_iface, NULL); - ok( r == S_OK, "failed\n"); + ok( r == S_OK, "failed: %08x\n", r); - ok(wordnum == 4, "words not processed\n"); + ok(wordnum == 4, "expected 4 words, got %d\n", wordnum); IWordBreaker_Release( wb ); CoUninitialize(); -- 2.20.1
Hi, While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check? Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=90141 Your paranoid android. === w2008s64 (32 bit report) === infosoft: infosoft.c:196: Test failed: failed: 80004005 infosoft.c:210: Test failed: failed: 80004005 === w7u_2qxl (32 bit report) === infosoft: infosoft.c:196: Test failed: failed: 80004005 infosoft.c:210: Test failed: failed: 80004005 === w7u_adm (32 bit report) === infosoft: infosoft.c:196: Test failed: failed: 80004005 infosoft.c:210: Test failed: failed: 80004005 === w7u_el (32 bit report) === infosoft: infosoft.c:196: Test failed: failed: 80004005 infosoft.c:210: Test failed: failed: 80004005 === w8 (32 bit report) === infosoft: infosoft.c:196: Test failed: failed: 80004005 infosoft.c:210: Test failed: failed: 80004005 === w8adm (32 bit report) === infosoft: infosoft.c:196: Test failed: failed: 80004005 infosoft.c:210: Test failed: failed: 80004005 === w864 (32 bit report) === infosoft: infosoft.c:196: Test failed: failed: 80004005 infosoft.c:210: Test failed: failed: 80004005 === w1064v1507 (32 bit report) === infosoft: infosoft.c:196: Test failed: failed: 80004005 infosoft.c:210: Test failed: failed: 80004005 === w1064v1809 (32 bit report) === infosoft: infosoft.c:210: Test failed: failed: 80004005 infosoft.c:212: Test failed: expected 4 words, got 5 === w1064 (32 bit report) === infosoft: infosoft.c:210: Test failed: failed: 80004005 infosoft.c:212: Test failed: expected 4 words, got 5 === w1064_tsign (32 bit report) === infosoft: infosoft.c:210: Test failed: failed: 80004005 infosoft.c:212: Test failed: expected 4 words, got 5 === w10pro64 (32 bit report) === infosoft: infosoft.c:210: Test failed: failed: 80004005 infosoft.c:212: Test failed: expected 4 words, got 5 === wvistau64 (64 bit report) === infosoft: infosoft.c:196: Test failed: failed: 80004005 infosoft.c:210: Test failed: failed: 80004005 === w2008s64 (64 bit report) === infosoft: infosoft.c:196: Test failed: failed: 80004005 infosoft.c:210: Test failed: failed: 80004005 === w864 (64 bit report) === infosoft: infosoft.c:196: Test failed: failed: 80004005 infosoft.c:210: Test failed: failed: 80004005 === w1064v1507 (64 bit report) === infosoft: infosoft.c:196: Test failed: failed: 80004005 infosoft.c:210: Test failed: failed: 80004005 === w1064v1809 (64 bit report) === infosoft: infosoft.c:210: Test failed: failed: 80004005 infosoft.c:212: Test failed: expected 4 words, got 5 === w1064 (64 bit report) === infosoft: infosoft.c:210: Test failed: failed: 80004005 infosoft.c:212: Test failed: expected 4 words, got 5 === w1064_2qxl (64 bit report) === infosoft: infosoft.c:210: Test failed: failed: 80004005 infosoft.c:212: Test failed: expected 4 words, got 5 === w1064_tsign (64 bit report) === infosoft: infosoft.c:210: Test failed: failed: 80004005 infosoft.c:212: Test failed: expected 4 words, got 5 === w10pro64 (64 bit report) === infosoft: infosoft.c:210: Test failed: failed: 80004005 infosoft.c:212: Test failed: expected 4 words, got 5 === w10pro64_ar (64 bit report) === infosoft: infosoft.c:210: Test failed: failed: 80004005 infosoft.c:212: Test failed: expected 4 words, got 5 === w10pro64_he (64 bit report) === infosoft: infosoft.c:210: Test failed: failed: 80004005 infosoft.c:212: Test failed: expected 4 words, got 5 === w10pro64_ja (64 bit report) === infosoft: infosoft.c:210: Test failed: failed: 80004005 infosoft.c:212: Test failed: expected 4 words, got 5 === w10pro64_zh_CN (64 bit report) === infosoft: infosoft.c:210: Test failed: failed: 80004005 infosoft.c:212: Test failed: expected 4 words, got 5
Windows Vista to Windows 10 1507 expect pfnFillTextBuffer() to return WBREAK_E_END_OF_TEXT to signal the end of the string. Returning unexpected values such as E_FAIL causes BreakText() to abort and report them to the caller. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50843 Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com> --- This should fix the failures on Windows 10 1507 and older. The failures on Windows 10 1607+ have another sours and are fixed in the next part. --- dlls/infosoft/tests/infosoft.c | 5 +++-- include/cierror.h | 7 +++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/dlls/infosoft/tests/infosoft.c b/dlls/infosoft/tests/infosoft.c index d221cee5732..c76aba63466 100644 --- a/dlls/infosoft/tests/infosoft.c +++ b/dlls/infosoft/tests/infosoft.c @@ -24,6 +24,7 @@ #include <stdio.h> #include <ole2.h> #include "indexsrv.h" +#include "cierror.h" #include "wine/test.h" @@ -141,7 +142,7 @@ static wordsink_impl wordsink = { { &wsvt } }; static HRESULT WINAPI fillbuf_none(TEXT_SOURCE *ts) { - return E_FAIL; + return WBREAK_E_END_OF_TEXT; } static HRESULT WINAPI fillbuf_many(TEXT_SOURCE *ts) @@ -154,7 +155,7 @@ static HRESULT WINAPI fillbuf_many(TEXT_SOURCE *ts) ts->awcBuffer += ts->iCur; if (!ts->awcBuffer[0]) - return E_FAIL; + return WBREAK_E_END_OF_TEXT; for( i=0; ts->awcBuffer[i] && ts->awcBuffer[i] != ' '; i++) ; diff --git a/include/cierror.h b/include/cierror.h index 049985beb11..e646c18e4b0 100644 --- a/include/cierror.h +++ b/include/cierror.h @@ -19,6 +19,13 @@ #ifndef __WINE_CIERROR_H__ #define __WINE_CIERROR_H__ +#define WBREAK_E_END_OF_TEXT 0x80041780 +#define LANGUAGE_S_LARGE_WORD 0x00041781 +#define WBREAK_E_QUERY_ONLY 0x80041782 +#define WBREAK_E_BUFFER_TOO_SMALL 0x80041783 +#define LANGUAGE_E_DATABASE_NOT_FOUND 0x80041784 +#define WBREAK_E_INIT_FAILED 0x80041785 + #define CI_E_ALREADY_INITIALIZED 0x8004180a #define CI_E_NOT_INITIALIZED 0x8004180b #define CI_E_BUFFERTOOSMALL 0x8004180c -- 2.20.1
Hi, While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check? Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=90142 Your paranoid android. === w1064v1809 (32 bit report) === infosoft: infosoft.c:211: Test failed: failed: 80004005 infosoft.c:213: Test failed: expected 4 words, got 5 === w1064 (32 bit report) === infosoft: infosoft.c:211: Test failed: failed: 80004005 infosoft.c:213: Test failed: expected 4 words, got 5 === w1064_tsign (32 bit report) === infosoft: infosoft.c:211: Test failed: failed: 80004005 infosoft.c:213: Test failed: expected 4 words, got 5 === w10pro64 (32 bit report) === infosoft: infosoft.c:211: Test failed: failed: 80004005 infosoft.c:213: Test failed: expected 4 words, got 5 === w1064v1809 (64 bit report) === infosoft: infosoft.c:211: Test failed: failed: 80004005 infosoft.c:213: Test failed: expected 4 words, got 5 === w1064 (64 bit report) === infosoft: infosoft.c:211: Test failed: failed: 80004005 infosoft.c:213: Test failed: expected 4 words, got 5 === w1064_2qxl (64 bit report) === infosoft: infosoft.c:211: Test failed: failed: 80004005 infosoft.c:213: Test failed: expected 4 words, got 5 === w1064_tsign (64 bit report) === infosoft: infosoft.c:211: Test failed: failed: 80004005 infosoft.c:213: Test failed: expected 4 words, got 5 === w10pro64 (64 bit report) === infosoft: infosoft.c:211: Test failed: failed: 80004005 infosoft.c:213: Test failed: expected 4 words, got 5 === w10pro64_ar (64 bit report) === infosoft: infosoft.c:211: Test failed: failed: 80004005 infosoft.c:213: Test failed: expected 4 words, got 5 === w10pro64_he (64 bit report) === infosoft: infosoft.c:211: Test failed: failed: 80004005 infosoft.c:213: Test failed: expected 4 words, got 5 === w10pro64_ja (64 bit report) === infosoft: infosoft.c:211: Test failed: failed: 80004005 infosoft.c:213: Test failed: expected 4 words, got 5 === w10pro64_zh_CN (64 bit report) === infosoft: infosoft.c:211: Test failed: failed: 80004005 infosoft.c:213: Test failed: expected 4 words, got 5
Up to Windows 10 1507 BreakText() would increment iCur but later Windows versions leave it unchanged. So assume all characters up to iEnd have been processed. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50844 Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com> --- dlls/infosoft/tests/infosoft.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/infosoft/tests/infosoft.c b/dlls/infosoft/tests/infosoft.c index c76aba63466..996af73ca20 100644 --- a/dlls/infosoft/tests/infosoft.c +++ b/dlls/infosoft/tests/infosoft.c @@ -152,7 +152,7 @@ static HRESULT WINAPI fillbuf_many(TEXT_SOURCE *ts) if (ts->awcBuffer == NULL) ts->awcBuffer = teststring; else - ts->awcBuffer += ts->iCur; + ts->awcBuffer += ts->iEnd; if (!ts->awcBuffer[0]) return WBREAK_E_END_OF_TEXT; -- 2.20.1
Hi, While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check? Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=90140 Your paranoid android. === w1064v1809 (32 bit report) === infosoft: infosoft.c:82: Test failed: found too many words: 5 infosoft.c:201: Test failed: failed infosoft.c:203: Test failed: words not processed === w1064 (32 bit report) === infosoft: infosoft.c:82: Test failed: found too many words: 5 infosoft.c:201: Test failed: failed infosoft.c:203: Test failed: words not processed === w1064_tsign (32 bit report) === infosoft: infosoft.c:82: Test failed: found too many words: 5 infosoft.c:201: Test failed: failed infosoft.c:203: Test failed: words not processed === w10pro64 (32 bit report) === infosoft: infosoft.c:82: Test failed: found too many words: 5 infosoft.c:201: Test failed: failed infosoft.c:203: Test failed: words not processed === w1064v1809 (64 bit report) === infosoft: infosoft.c:82: Test failed: found too many words: 5 infosoft.c:201: Test failed: failed infosoft.c:203: Test failed: words not processed === w1064 (64 bit report) === infosoft: infosoft.c:82: Test failed: found too many words: 5 infosoft.c:201: Test failed: failed infosoft.c:203: Test failed: words not processed === w1064_2qxl (64 bit report) === infosoft: infosoft.c:82: Test failed: found too many words: 5 infosoft.c:201: Test failed: failed infosoft.c:203: Test failed: words not processed === w1064_tsign (64 bit report) === infosoft: infosoft.c:82: Test failed: found too many words: 5 infosoft.c:201: Test failed: failed infosoft.c:203: Test failed: words not processed === w10pro64 (64 bit report) === infosoft: infosoft.c:82: Test failed: found too many words: 5 infosoft.c:201: Test failed: failed infosoft.c:203: Test failed: words not processed === w10pro64_ar (64 bit report) === infosoft: infosoft.c:82: Test failed: found too many words: 5 infosoft.c:201: Test failed: failed infosoft.c:203: Test failed: words not processed === w10pro64_he (64 bit report) === infosoft: infosoft.c:82: Test failed: found too many words: 5 infosoft.c:201: Test failed: failed infosoft.c:203: Test failed: words not processed === w10pro64_ja (64 bit report) === infosoft: infosoft.c:82: Test failed: found too many words: 5 infosoft.c:201: Test failed: failed infosoft.c:203: Test failed: words not processed === w10pro64_zh_CN (64 bit report) === infosoft: infosoft.c:82: Test failed: found too many words: 5 infosoft.c:201: Test failed: failed infosoft.c:203: Test failed: words not processed
participants (2)
-
Francois Gouget -
Marvin