Report the error sent by the CGI script.
Make progress bar selection explicit.
This commit is contained in:
parent
69880eb587
commit
feaad968b8
|
@ -39,7 +39,7 @@ double progressScale;
|
||||||
|
|
||||||
/* Progress group counter for the gui* functions.
|
/* Progress group counter for the gui* functions.
|
||||||
*/
|
*/
|
||||||
int progressGroup = -1;
|
int progressGroup;
|
||||||
|
|
||||||
char *
|
char *
|
||||||
renderString (va_list ap)
|
renderString (va_list ap)
|
||||||
|
@ -90,7 +90,7 @@ guiStatus (va_list ap)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* report (R_PROGRESS, steps) */
|
/* report (R_PROGRESS, barnum, steps) */
|
||||||
int
|
int
|
||||||
textProgress (va_list ap)
|
textProgress (va_list ap)
|
||||||
{
|
{
|
||||||
|
@ -102,16 +102,18 @@ textProgress (va_list ap)
|
||||||
int
|
int
|
||||||
guiProgress (va_list ap)
|
guiProgress (va_list ap)
|
||||||
{
|
{
|
||||||
unsigned int max = va_arg (ap, int);
|
unsigned int max;
|
||||||
HWND pb = GetDlgItem (dialog, IDC_PB0 + ++progressGroup * 2);
|
HWND pb;
|
||||||
|
|
||||||
progressMax = max;
|
progressGroup = va_arg (ap, int);
|
||||||
|
progressMax = max = va_arg (ap, int);
|
||||||
progressCurr = 0;
|
progressCurr = 0;
|
||||||
if (max > 0xffff) {
|
if (max > 0xffff) {
|
||||||
progressScale = (double)0xffff / max;
|
progressScale = (double)0xffff / max;
|
||||||
max = 0xffff;
|
max = 0xffff;
|
||||||
}
|
}
|
||||||
else progressScale = 1;
|
else progressScale = 1;
|
||||||
|
pb = GetDlgItem (dialog, IDC_PB0 + progressGroup * 2);
|
||||||
SendMessage (pb, PBM_SETRANGE, 0, MAKELPARAM (0, max));
|
SendMessage (pb, PBM_SETRANGE, 0, MAKELPARAM (0, max));
|
||||||
SendMessage (pb, PBM_SETSTEP, (WPARAM)1, 0);
|
SendMessage (pb, PBM_SETSTEP, (WPARAM)1, 0);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -311,7 +311,7 @@ run_tests (char *logname, const char *tag)
|
||||||
wine_tests = xmalloc (nr_of_files * sizeof wine_tests[0]);
|
wine_tests = xmalloc (nr_of_files * sizeof wine_tests[0]);
|
||||||
|
|
||||||
report (R_STATUS, "Extracting tests");
|
report (R_STATUS, "Extracting tests");
|
||||||
report (R_PROGRESS, nr_of_files);
|
report (R_PROGRESS, 0, nr_of_files);
|
||||||
for (i = 0; i < nr_of_files; i++) {
|
for (i = 0; i < nr_of_files; i++) {
|
||||||
get_subtests (tempdir, wine_tests+i, i+1);
|
get_subtests (tempdir, wine_tests+i, i+1);
|
||||||
nr_of_tests += wine_tests[i].subtest_count;
|
nr_of_tests += wine_tests[i].subtest_count;
|
||||||
|
@ -319,7 +319,7 @@ run_tests (char *logname, const char *tag)
|
||||||
report (R_DELTA, 0, "Extracting: Done");
|
report (R_DELTA, 0, "Extracting: Done");
|
||||||
|
|
||||||
report (R_STATUS, "Running tests");
|
report (R_STATUS, "Running tests");
|
||||||
report (R_PROGRESS, nr_of_tests);
|
report (R_PROGRESS, 1, nr_of_tests);
|
||||||
for (i = 0; i < nr_of_files; i++) {
|
for (i = 0; i < nr_of_files; i++) {
|
||||||
struct wine_test *test = wine_tests + i;
|
struct wine_test *test = wine_tests + i;
|
||||||
int j;
|
int j;
|
||||||
|
@ -385,8 +385,7 @@ int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst,
|
||||||
submit = strtok (NULL, " ");
|
submit = strtok (NULL, " ");
|
||||||
if (tag)
|
if (tag)
|
||||||
report (R_WARNING, "ignoring tag for submit");
|
report (R_WARNING, "ignoring tag for submit");
|
||||||
if (send_file (submit))
|
send_file (submit);
|
||||||
report (R_ERROR, "can't submit file %s", submit);
|
|
||||||
break;
|
break;
|
||||||
case 'o':
|
case 'o':
|
||||||
logname = strtok (NULL, " ");
|
logname = strtok (NULL, " ");
|
||||||
|
@ -411,11 +410,9 @@ int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst,
|
||||||
if (!logname && !submit) {
|
if (!logname && !submit) {
|
||||||
report (R_STATUS, "Starting up");
|
report (R_STATUS, "Starting up");
|
||||||
logname = run_tests (NULL, tag);
|
logname = run_tests (NULL, tag);
|
||||||
if (report (R_ASK, MB_YESNO,
|
if (report (R_ASK, MB_YESNO, "Do you want to submit the "
|
||||||
"Do you want to submit the test results?") == IDYES)
|
"test results?") == IDYES)
|
||||||
if (send_file (logname))
|
if (!send_file (logname) && remove (logname))
|
||||||
report (R_FATAL, "Can't submit logfile '%s'", logname);
|
|
||||||
if (remove (logname))
|
|
||||||
report (R_WARNING, "Can't remove logfile: %d.", errno);
|
report (R_WARNING, "Can't remove logfile: %d.", errno);
|
||||||
free (logname);
|
free (logname);
|
||||||
report (R_STATUS, "Finished");
|
report (R_STATUS, "Finished");
|
||||||
|
|
|
@ -91,14 +91,15 @@ send_file (const char *name)
|
||||||
{
|
{
|
||||||
SOCKET s;
|
SOCKET s;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
unsigned char buffer[8192];
|
#define BUFLEN 8192
|
||||||
|
unsigned char *buffer;
|
||||||
size_t bytes_read, total, filesize;
|
size_t bytes_read, total, filesize;
|
||||||
char *str;
|
char *str;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* RFC 2068 */
|
/* RFC 2068 */
|
||||||
#define SEP "-"
|
#define SEP "-"
|
||||||
const char head[] = "POST /~wferi/cgi-bin/winetests.cgi HTTP/1.0\r\n"
|
const char head[] = "POST /~wferi/cgi-bin/winetest.cgi HTTP/1.0\r\n"
|
||||||
"Host: afavant\r\n"
|
"Host: afavant\r\n"
|
||||||
"User-Agent: Winetests Shell\r\n"
|
"User-Agent: Winetests Shell\r\n"
|
||||||
"Content-Type: multipart/form-data; boundary=" SEP "\r\n"
|
"Content-Type: multipart/form-data; boundary=" SEP "\r\n"
|
||||||
|
@ -111,6 +112,7 @@ send_file (const char *name)
|
||||||
"Upload File\r\n"
|
"Upload File\r\n"
|
||||||
"--" SEP "--\r\n";
|
"--" SEP "--\r\n";
|
||||||
|
|
||||||
|
buffer = xmalloc (BUFLEN + 1);
|
||||||
s = open_http ("157.181.170.47");
|
s = open_http ("157.181.170.47");
|
||||||
if (s == INVALID_SOCKET) {
|
if (s == INVALID_SOCKET) {
|
||||||
report (R_WARNING, "Can't open network connection: %d",
|
report (R_WARNING, "Can't open network connection: %d",
|
||||||
|
@ -145,8 +147,8 @@ send_file (const char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
report (R_STATUS, "Sending %u bytes of data", filesize);
|
report (R_STATUS, "Sending %u bytes of data", filesize);
|
||||||
report (R_PROGRESS, filesize);
|
report (R_PROGRESS, 2, filesize);
|
||||||
while ((bytes_read = fread (buffer, 1, sizeof buffer / 8, f))) {
|
while ((bytes_read = fread (buffer, 1, BUFLEN / 8, f))) {
|
||||||
if (send_buf (s, buffer, bytes_read)) {
|
if (send_buf (s, buffer, bytes_read)) {
|
||||||
report (R_WARNING, "Error sending body: %d, %d",
|
report (R_WARNING, "Error sending body: %d, %d",
|
||||||
errno, WSAGetLastError ());
|
errno, WSAGetLastError ());
|
||||||
|
@ -164,15 +166,14 @@ send_file (const char *name)
|
||||||
report (R_DELTA, 0, "Network transfer: Done");
|
report (R_DELTA, 0, "Network transfer: Done");
|
||||||
|
|
||||||
total = 0;
|
total = 0;
|
||||||
while ((bytes_read = recv (s, buffer + total,
|
while ((bytes_read = recv (s, buffer+total, BUFLEN-total, 0))) {
|
||||||
sizeof buffer - total, 0))) {
|
|
||||||
if ((signed)bytes_read == SOCKET_ERROR) {
|
if ((signed)bytes_read == SOCKET_ERROR) {
|
||||||
report (R_WARNING, "Error receiving reply: %d, %d",
|
report (R_WARNING, "Error receiving reply: %d, %d",
|
||||||
errno, WSAGetLastError ());
|
errno, WSAGetLastError ());
|
||||||
goto abort1;
|
goto abort1;
|
||||||
}
|
}
|
||||||
total += bytes_read;
|
total += bytes_read;
|
||||||
if (total == sizeof buffer) {
|
if (total == BUFLEN) {
|
||||||
report (R_WARNING, "Buffer overflow");
|
report (R_WARNING, "Buffer overflow");
|
||||||
goto abort1;
|
goto abort1;
|
||||||
}
|
}
|
||||||
|
@ -187,11 +188,20 @@ send_file (const char *name)
|
||||||
name, filesize);
|
name, filesize);
|
||||||
ret = memcmp (str, buffer + total - bytes_read, bytes_read);
|
ret = memcmp (str, buffer + total - bytes_read, bytes_read);
|
||||||
free (str);
|
free (str);
|
||||||
return ret!=0;
|
if (ret) {
|
||||||
|
buffer[total] = 0;
|
||||||
|
str = strstr (buffer, "\r\n\r\n");
|
||||||
|
if (str) buffer = str + 4;
|
||||||
|
report (R_ERROR, "Can't submit logfile '%s'. "
|
||||||
|
"Server response: %s", name, buffer);
|
||||||
|
}
|
||||||
|
free (buffer);
|
||||||
|
return ret;
|
||||||
|
|
||||||
abort2:
|
abort2:
|
||||||
fclose (f);
|
fclose (f);
|
||||||
abort1:
|
abort1:
|
||||||
close_http (s);
|
close_http (s);
|
||||||
|
free (buffer);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue