[PATCH v5] winetest: Add GUI to display results of individual tests.
Isira Seneviratne
isirasen96 at gmail.com
Tue Feb 26 01:47:22 CST 2019
On Tue, Feb 26, 2019 at 9:53 AM Zebediah Figura <z.figura12 at gmail.com>
wrote:
>
>
> On 2/18/19 6:49 AM, Isira Seneviratne wrote:
> > From 462243a2e8860ebbac2bedb90fa6cb97050a6080 Mon Sep 17 00:00:00 2001
> > From: Isira Seneviratne <isirasen96 at gmail.com>
> > Date: Sun, 16 Dec 2018 14:59:20 +0530
> > Subject: [PATCH v5] winetest: Add GUI to display results of individual
> tests.
> >
> > This patch adds a listview control displaying the results of each
> > test, together with the component being tested.
> >
> > Advancing the file pointer of the log file by 1 eliminates most of the
> > duplicate test entries displayed with the previous revision, except for
> > advapi32:security tests, which has two entries due to those tests using
> > two threads.
>
> What you want to do about this is to loop until you find the last line
> matching
> that process, and then add it to the listview. That's what the
> test.winehq.org
> dissect script does.
>
Is there a way for me to see how this script works?
> >
> > Signed-off-by: Isira Seneviratne <isirasen96 at gmail.com>
> > ---
> > programs/winetest/gui.c | 25 +++++++++++++--
> > programs/winetest/main.c | 60 +++++++++++++++++++++++++++++++++--
> > programs/winetest/resource.h | 2 ++
> > programs/winetest/winetest.h | 4 +++
> > programs/winetest/winetest.rc | 20 +++++++-----
> > 5 files changed, 99 insertions(+), 12 deletions(-)
> >
> > diff --git a/programs/winetest/gui.c b/programs/winetest/gui.c
> > index bda00f3707..607918bb08 100644
> > --- a/programs/winetest/gui.c
> > +++ b/programs/winetest/gui.c
> > @@ -2,6 +2,7 @@
> > * GUI support
> > *
> > * Copyright 2004 Ferenc Wagner
> > + * Copyright 2018-2019 Isira Seneviratne
> > *
> > * This library is free software; you can redistribute it and/or
> > * modify it under the terms of the GNU Lesser General Public
> > @@ -43,6 +44,9 @@ static int progressGroup;
> >
> > static WNDPROC DefEditProc;
> >
> > +/* List view handle */
> > +HWND res_list_view;
> > +
> > static int
> > MBdefault (int uType)
> > {
> > @@ -130,7 +134,7 @@ guiStep (va_list ap)
> > {
> > const int pgID = IDC_ST0 + progressGroup * 2;
> > char *str = vstrmake (NULL, ap);
> > -
> > +
> > progressCurr++;
> > SetDlgItemTextA (dialog, pgID, str);
> > SendDlgItemMessageA(dialog, pgID+1, PBM_SETPOS,
> > @@ -421,6 +425,8 @@ AboutProc (HWND hwnd, UINT msg, WPARAM wParam,
> LPARAM lParam)
> > static INT_PTR CALLBACK
> > DlgProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
> > {
> > + LVCOLUMNA lvCol;
> > +
> > switch (msg) {
> > case WM_INITDIALOG:
> > SendMessageA(hwnd, WM_SETICON, ICON_SMALL,
> > @@ -430,6 +436,21 @@ DlgProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM
> lParam)
> > SendMessageA(hwnd, WM_SETICON, ICON_BIG,
> > (LPARAM)LoadIconA( GetModuleHandleA(NULL),
> MAKEINTRESOURCEA(IDI_WINE)));
> > dialog = hwnd;
> > +
> > + /* Initializes the list view control that the main dialog
> window contains */
> > + res_list_view = GetDlgItem(dialog, IDD_RES_LIST);
> > +
> > + lvCol.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
> > + lvCol.cx = 130;
> > + lvCol.fmt = LVCFMT_LEFT;
> > +
> > + lvCol.pszText = (char *) "Component";
> > + ListView_InsertColumnA(res_list_view, 0, &lvCol);
> > +
> > + lvCol.pszText = (char *) "No. of failures";
> > + lvCol.cx = 90;
> > + ListView_InsertColumnA(res_list_view, 1, &lvCol);
> > +
> > if (!SetEvent (initEvent)) {
> > report (R_STATUS, "Can't signal main thread: %d",
> > GetLastError ());
> > @@ -545,7 +566,7 @@ report (enum report_type t, ...)
> > }
> > }
> > }
> > -
> > +
> > va_start (ap, t);
> > if (t < ARRAY_SIZE(text_funcs)) ret = funcs[t](ap);
> > else report (R_WARNING, "unimplemented report type: %d", t);
> > diff --git a/programs/winetest/main.c b/programs/winetest/main.c
> > index 3d6cc660ec..8c841ab08e 100644
> > --- a/programs/winetest/main.c
> > +++ b/programs/winetest/main.c
> > @@ -4,6 +4,7 @@
> > * Copyright 2003, 2004 Jakob Eriksson (for Solid Form Sweden AB)
> > * Copyright 2003 Dimitrie O. Paun
> > * Copyright 2003 Ferenc Wagner
> > + * Copyright 2018-2019 Isira Seneviratne
> > *
> > * This library is free software; you can redistribute it and/or
> > * modify it under the terms of the GNU Lesser General Public
> > @@ -30,10 +31,12 @@
> >
> > #define COBJMACROS
> > #include <stdio.h>
> > +#include <string.h>
> > #include <assert.h>
> > #include <windows.h>
> > #include <winternl.h>
> > #include <mshtml.h>
> > +#include <commctrl.h>
> >
> > #include "winetest.h"
> > #include "resource.h"
> > @@ -85,6 +88,9 @@ static void (WINAPI *pReleaseActCtx)(HANDLE);
> > /* To store the current PATH setting (related to .NET only provided
> dlls) */
> > static char *curpath;
> >
> > +/* To display the test results in a listview control */
> > +static int cur_row = 0;
> > +
> > /* check if test is being filtered out */
> > static BOOL test_filtered_out( LPCSTR module, LPCSTR testname )
> > {
> > @@ -533,7 +539,7 @@ static void* extract_rcdata (LPCSTR name, LPCSTR
> type, DWORD* size)
> > HRSRC rsrc;
> > HGLOBAL hdl;
> > LPVOID addr;
> > -
> > +
> > if (!(rsrc = FindResourceA(NULL, name, type)) ||
> > !(*size = SizeofResource (0, rsrc)) ||
> > !(hdl = LoadResource (0, rsrc)) ||
> > @@ -788,12 +794,62 @@ run_test (struct wine_test* test, const char*
> subtest, HANDLE out_file, const ch
> > }
> > else
> > {
> > - int status;
> > + int status, test_fail_count, test_count, test_todo_count,
> test_skipped_count;
> > + int match_count;
> > + char test_fail_count_str[10];
> > + char buffer[1000];
> > + char subtest_name[20];
> > + char test_subtest_name[50];
> > + char *cur_line = buffer, *next_line;
> > DWORD pid, start = GetTickCount();
> > + DWORD read_count;
> > + LVITEMA lv_item;
> > char *cmd = strmake (NULL, "%s %s", test->exename, subtest);
> > +
> > report (R_STEP, "Running: %s:%s", test->name, subtest);
> > xprintf ("%s:%s start %s -\n", test->name, subtest, file);
> > status = run_ex (cmd, out_file, tempdir, 120000, &pid);
> > +
> > + lv_item.mask = LVIF_TEXT;
> > + lv_item.state = 0;
> > + lv_item.stateMask = 0;
> > +
> > + SetFilePointer (out_file, -sizeof(buffer), NULL, FILE_CURRENT);
> > + ReadFile (out_file, buffer, sizeof(buffer), &read_count, NULL);
> > + SetFilePointer (out_file, 1, NULL, FILE_CURRENT);
>
> This doesn't work. You're extending the file pointer 1 past the file's
> actual
> length, so a '\0' byte will be written. The reason this only prints out one
> line of output is because the strchr() call below will break out of the
> loop
> after [at most] the first output report in the buffer. But that won't
> necessarily be the right one. For example, if I add an artificial
> failure into
> advapi32:lsa, that doesn't show up in the failures column.
>
> I think what you want to do instead is essentially the same thing as I
> recommend to take care of tests that print subprocess reports: just loop
> over
> all report lines in the log, discarding any but the last. While you're
> at it,
> you should probably validate the test name from the output report
> against the
> name of the test you're running, in case the test crashes or hangs.
>
> > +
> > + /*
> > + * Traverses the buffer line by line, reading the lines of the
> test output
> > + * where the test results are saved.
> > + */
> > + while (1)
> > + {
> > + match_count = sscanf (cur_line, "%*x:%s %d tests executed
> (%d marked as todo, %d failures), %d skipped.",
> > + subtest_name, &test_count, &test_todo_count,
> &test_fail_count, &test_skipped_count);
> > +
> > + if (match_count == 5)
> > + {
> > + sprintf (test_subtest_name, "%s:%s", test->name,
> subtest);
> > + sprintf (test_fail_count_str, "%d", test_fail_count);
> > +
> > + /* Adds a single row to the list view control
> (component name and no. of failed tests). */
> > + lv_item.iSubItem = 0;
> > + lv_item.iItem = cur_row;
> > + lv_item.pszText = test_subtest_name;
> > + ListView_InsertItemA (res_list_view, &lv_item);
> > +
> > + lv_item.iSubItem = 1;
> > + lv_item.pszText = test_fail_count_str;
> > + ListView_SetItemA (res_list_view, &lv_item);
> > +
> > + cur_row++;
> > + }
> > + next_line = strchr (cur_line, '\n');
> > + if (!next_line)
> > + break;
> > + cur_line = next_line+1;
> > + }
> > +
> > heap_free (cmd);
> > xprintf ("%s:%s:%04x done (%d) in %ds\n", test->name, subtest,
> pid, status, (GetTickCount()-start)/1000);
> > if (status) failures++;
> > diff --git a/programs/winetest/resource.h b/programs/winetest/resource.h
> > index be71274f58..90c684e130 100644
> > --- a/programs/winetest/resource.h
> > +++ b/programs/winetest/resource.h
> > @@ -2,6 +2,7 @@
> > * Resource definitions
> > *
> > * Copyright 2004 Ferenc Wagner
> > + * Copyright 2018-2019 Isira Seneviratne
> > *
> > * This library is free software; you can redistribute it and/or
> > * modify it under the terms of the GNU Lesser General Public
> > @@ -24,6 +25,7 @@
> > #define IDD_ABOUT 101
> > #define IDD_TAG 102
> > #define IDD_EMAIL 103
> > +#define IDD_RES_LIST 105
> >
> > #define IDC_STATIC -1
> >
> > diff --git a/programs/winetest/winetest.h b/programs/winetest/winetest.h
> > index 0446ad5bdc..342e25b506 100644
> > --- a/programs/winetest/winetest.h
> > +++ b/programs/winetest/winetest.h
> > @@ -3,6 +3,7 @@
> > *
> > * Copyright 2003 Dimitrie O. Paun
> > * Copyright 2003 Ferenc Wagner
> > + * Copyright 2018-2019 Isira Seneviratne
> > *
> > * This library is free software; you can redistribute it and/or
> > * modify it under the terms of the GNU Lesser General Public
> > @@ -74,4 +75,7 @@ int guiAskTag (void);
> > int guiAskEmail (void);
> > int report (enum report_type t, ...);
> >
> > +/* Listview handle */
> > +extern HWND res_list_view;
> > +
> > #endif /* __WINETESTS_H */
> > diff --git a/programs/winetest/winetest.rc
> b/programs/winetest/winetest.rc
> > index a3898b6ce0..25d10505c6 100644
> > --- a/programs/winetest/winetest.rc
> > +++ b/programs/winetest/winetest.rc
> > @@ -2,6 +2,7 @@
> > * Winetest resources
> > *
> > * Copyright 2004 Ferenc Wagner
> > + * Copyright 2018-2019 Isira Seneviratne
> > *
> > * This library is free software; you can redistribute it and/or
> > * modify it under the terms of the GNU Lesser General Public
> > @@ -48,7 +49,7 @@ BEGIN
> > PUSHBUTTON "Abort", IDABORT, 85, 45, 40, 14
> > END
> >
> > -IDD_STATUS DIALOG 0, 0, 160, 150
> > +IDD_STATUS DIALOG 0, 0, 160, 275
> > STYLE WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX
> > CAPTION "Wine Test Shell"
> > FONT 8, "MS Shell Dlg"
> > @@ -59,21 +60,24 @@ BEGIN
> > CONTROL "PB1", IDC_PB1, PROGRESS_CLASSA, 0, 5, 40, 150, 10
> > LTEXT "Network transfer:", IDC_ST2, 5, 55, 140, 10
> > CONTROL "PB2", IDC_PB2, PROGRESS_CLASSA, 0, 5, 65, 150, 10
> > -
> > +
> > LTEXT "Tag:", IDC_STATIC, 5, 89, 100, 10
> > - EDITTEXT IDC_TAG, 25, 88, 125, 10,
> > + EDITTEXT IDC_TAG, 25, 88, 130, 10,
> > ES_READONLY
> > LTEXT "Working directory:", IDC_STATIC, 5, 100, 100, 10
> > - EDITTEXT IDC_DIR, 71, 99, 79, 10,
> > + EDITTEXT IDC_DIR, 71, 99, 84, 10,
> > ES_READONLY | ES_AUTOHSCROLL
> > LTEXT "Output file:", IDC_STATIC, 5, 111, 100, 10
> > - EDITTEXT IDC_OUT, 46, 110, 104, 10,
> > + EDITTEXT IDC_OUT, 46, 110, 109, 10,
> > ES_READONLY | ES_AUTOHSCROLL
> >
> > - DEFPUSHBUTTON "About", IDHELP, 20, 123, 30, 14
> > - PUSHBUTTON "Edit", IDCANCEL, 65, 123, 30, 14,
> > + CONTROL "", IDD_RES_LIST, "SysListView32", WS_CHILD | WS_VISIBLE |
> WS_BORDER | LVS_REPORT,
> > + 5, 130, 150, 100
> > +
> > + DEFPUSHBUTTON "About", IDHELP, 20, 243, 30, 14
> > + PUSHBUTTON "Edit", IDCANCEL, 65, 243, 30, 14,
> > WS_DISABLED
> > - PUSHBUTTON "Stop", IDABORT, 110, 123, 30, 14
> > + PUSHBUTTON "Stop", IDABORT, 110, 243, 30, 14
> >
> > CONTROL "Created", IDC_SB, STATUSCLASSNAMEA, 0, 0,0,0,0
> > END
> > --
> > 2.20.1
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20190226/1f0481a7/attachment-0001.html>
More information about the wine-devel
mailing list