ReactOS 0.4.17-dev-972-gd004b2c
test.h
Go to the documentation of this file.
1/*
2 * Definitions for Wine C unit tests.
3 *
4 * Copyright (C) 2002 Alexandre Julliard
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21#ifndef __WINE_WINE_TEST_H
22#define __WINE_WINE_TEST_H
23
24#include <stdarg.h>
25#include <stdlib.h>
26#include <windef.h>
27#include <winbase.h>
28#include <stdio.h> // In the future: replace by <wine/debug.h>
29
30#ifdef __GNUC__
31#pragma GCC diagnostic push
32#pragma GCC diagnostic ignored "-Wunused-function"
33#endif
34
35#ifdef __WINE_CONFIG_H
36#error config.h should not be used in Wine tests
37#endif
38#ifdef __WINE_WINE_LIBRARY_H
39#error wine/library.h should not be used in Wine tests
40#endif
41#ifdef __WINE_WINE_UNICODE_H
42#error wine/unicode.h should not be used in Wine tests
43#endif
44#ifdef __WINE_WINE_DEBUG_H
45#error wine/debug.h should not be used in Wine tests
46#endif
47
48#ifndef __WINE_PRINTF_ATTR /* wine/debug.h defines this too; either may come first */
49#ifdef __GNUC__
50# define __WINE_PRINTF_ATTR(fmt,args) __attribute__((format (printf,fmt,args)))
51#else /* __GNUC__ */
52# define __WINE_PRINTF_ATTR(fmt,args)
53#endif /* __GNUC__ */
54#endif /* !__WINE_PRINTF_ATTR */
55
56#ifdef __cplusplus
57extern "C" {
58#endif
59
60#ifndef INVALID_FILE_ATTRIBUTES
61#define INVALID_FILE_ATTRIBUTES (~0u)
62#endif
63#ifndef INVALID_SET_FILE_POINTER
64#define INVALID_SET_FILE_POINTER (~0u)
65#endif
66
67/* debug level */
68extern int winetest_debug;
69
70/* trace timing information */
71extern int winetest_time;
73
74/* running in interactive mode? */
75extern int winetest_interactive;
76
77/* report failed flaky tests as failures (BOOL) */
78extern int winetest_report_flaky;
79
80/* report successful tests (BOOL) */
82
83/* silence todos and skips above this threshold */
85
86/* current platform */
87extern const char *winetest_platform;
89
90/* use ANSI escape codes for output coloring */
91extern int winetest_color;
92
93extern LONG winetest_successes; /* number of successful tests */
94extern LONG winetest_failures; /* number of failures */
95extern LONG winetest_flaky_failures; /* number of failures inside flaky block */
96extern LONG winetest_skipped; /* number of skipped test chunks */
97extern LONG winetest_todo_successes; /* number of successful tests inside todo block */
98extern LONG winetest_todo_failures; /* number of failures inside todo block */
99extern LONG winetest_muted_traces; /* number of silenced traces */
100extern LONG winetest_muted_skipped; /* same as skipped but silent */
101extern LONG winetest_muted_todo_successes; /* same as todo_successes but silent */
102
103/* The following data must be kept track of on a per-thread basis */
105{
106 const char* current_file; /* file of current check */
107 int current_line; /* line of current check */
108 unsigned int flaky_level; /* current flaky nesting level */
110 unsigned int todo_level; /* current todo nesting level */
111 unsigned int nocount_level;
113 char *str_pos; /* position in debug buffer */
114 char strings[2000]; /* buffer for debug strings */
115 char context[8][128]; /* data to print before messages */
116 unsigned int context_count; /* number of context prefixes */
117};
118
120extern void winetest_print_lock(void);
121extern void winetest_print_unlock(void);
122extern int winetest_vprintf( const char *msg, va_list args );
123extern int winetest_get_time(void);
124
125extern int winetest_get_mainargs( char*** pargv );
127
128#ifdef STANDALONE
129#define START_TEST(name) \
130 static void func_##name(void); \
131 const struct test winetest_testlist[] = { { #name, func_##name }, { 0, 0 } }; \
132 static void func_##name(void)
133#else
134#define START_TEST(name) EXTERN_C void func_##name(void)
135#endif
136
137#ifdef WINETEST_NO_LINE_NUMBERS
138# define subtest_(file, line) (winetest_set_location(file, 0), 0) ? (void)0 : winetest_subtest
139# define ignore_exceptions_(file, line) (winetest_set_location(file, 0), 0) ? (void)0 : winetest_ignore_exceptions
140# define ok_(file, line) (winetest_set_location(file, 0), 0) ? (void)0 : winetest_ok
141# define skip_(file, line) (winetest_set_location(file, 0), 0) ? (void)0 : winetest_skip
142# define win_skip_(file, line) (winetest_set_location(file, 0), 0) ? (void)0 : winetest_win_skip
143# define trace_(file, line) (winetest_set_location(file, 0), 0) ? (void)0 : winetest_trace
144# define wait_child_process_(file, line) (winetest_set_location(file, 0), 0) ? (void)0 : winetest_wait_child_process
145#else
146# define subtest_(file, line) (winetest_set_location(file, line), 0) ? (void)0 : winetest_subtest
147# define ignore_exceptions_(file, line) (winetest_set_location(file, line), 0) ? (void)0 : winetest_ignore_exceptions
148# define ok_(file, line) (winetest_set_location(file, line), 0) ? (void)0 : winetest_ok
149# define skip_(file, line) (winetest_set_location(file, line), 0) ? (void)0 : winetest_skip
150# define win_skip_(file, line) (winetest_set_location(file, line), 0) ? (void)0 : winetest_win_skip
151# define trace_(file, line) (winetest_set_location(file, line), 0) ? (void)0 : winetest_trace
152# define wait_child_process_(file, line) (winetest_set_location(file, line), 0) ? (void)0 : winetest_wait_child_process
153#endif
154
155#define subtest subtest_(__FILE__, __LINE__)
156#define ignore_exceptions ignore_exceptions_(__FILE__, __LINE__)
157#define ok ok_(__FILE__, __LINE__)
158#define skip skip_(__FILE__, __LINE__)
159#define win_skip win_skip_(__FILE__, __LINE__)
160#define trace trace_(__FILE__, __LINE__)
161#define wait_child_process wait_child_process_(__FILE__, __LINE__)
162
163#define flaky_if(is_flaky) for (winetest_start_flaky(is_flaky); \
164 winetest_loop_flaky(); \
165 winetest_end_flaky())
166#define flaky flaky_if(TRUE)
167#define flaky_wine flaky_if(winetest_platform_is_wine)
168#define flaky_wine_if(is_flaky) flaky_if((is_flaky) && winetest_platform_is_wine)
169
170#define todo_if(is_todo) for (winetest_start_todo(is_todo); \
171 winetest_loop_todo(); \
172 winetest_end_todo())
173
174#define todo_ros todo_if(!strcmp(winetest_platform, "reactos"))
175#define todo_ros_if(is_todo) todo_if((is_todo) && !strcmp(winetest_platform, "reactos"))
176#ifdef USE_WINE_TODOS
177#define todo_wine todo_ros
178#define todo_wine_if todo_ros_if
179#else
180#define todo_wine todo_if(!strcmp(winetest_platform, "wine"))
181#define todo_wine_if(is_todo) todo_if((is_todo) && !strcmp(winetest_platform, "wine"))
182#endif
183
184#ifndef ARRAY_SIZE
185# define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
186#endif
187
188/* Records the location of the next check.
189 * See the xxx_(file, line) macros.
190 *
191 * Parameters:
192 * - file - source file name of the check
193 * - line - source line number of the check
194 */
195static inline void winetest_set_location( const char *file, int line )
196{
198#if defined(WINETEST_MSVC_IDE_FORMATTING)
199 data->current_file = file;
200#else
201 data->current_file=strrchr(file,'/');
202 if (data->current_file==NULL)
203 data->current_file=strrchr(file,'\\');
204 if (data->current_file==NULL)
205 data->current_file=file;
206 else
207 data->current_file++;
208#endif
209 data->current_line=line;
210}
211
212static const char winetest_color_reset[] = "\x1b[0m";
213static const char winetest_color_dark_red[] = "\x1b[31m";
214static const char winetest_color_dark_purple[] = "\x1b[35m";
215static const char winetest_color_green[] = "\x1b[32m";
216static const char winetest_color_yellow[] = "\x1b[33m";
217static const char winetest_color_blue[] = "\x1b[34m";
218static const char winetest_color_bright_red[] = "\x1b[1;91m";
219static const char winetest_color_bright_purple[] = "\x1b[1;95m";
220
221/* Define WINETEST_MSVC_IDE_FORMATTING to alter the output format winetest will use for file/line numbers.
222 This alternate format makes the file/line numbers clickable in visual studio, to directly jump to them. */
223#if defined(WINETEST_MSVC_IDE_FORMATTING)
224# define __winetest_file_line_prefix "%s(%d)"
225#else
226# define __winetest_file_line_prefix "%s:%d"
227#endif
228
229static int winetest_printf( const char *msg, ... ) __WINE_PRINTF_ATTR(1,2);
230static int winetest_printf( const char *msg, ... )
231{
234 int ret;
235
236 fprintf( stdout, __winetest_file_line_prefix ": ", data->current_file, data->current_line );
237 va_start( valist, msg );
239 va_end( valist );
240
241 return ret;
242}
243
244static const char *winetest_elapsed( char *buffer )
245{
246 int now;
247
248 if (!winetest_time) return "";
250 sprintf( buffer, "%.3f", (now - winetest_start_time) / 1000.0 );
251 return buffer;
252}
253
254static void winetest_print_location( const char *msg, ... ) __WINE_PRINTF_ATTR(1,2);
255static void winetest_print_location( const char *msg, ... )
256{
259
260 winetest_printf( "%s:%d ", data->current_file, data->current_line );
261 va_start( valist, msg );
263 va_end( valist );
264}
265
266static void winetest_print_context( const char *msgtype )
267{
269 unsigned int i;
270
271 winetest_printf( "%s", msgtype );
272 for (i = 0; i < data->context_count; ++i)
273 fprintf( stdout, "%s: ", data->context[i] );
274}
275
276static inline void winetest_subtest( const char *name )
277{
280 data->current_file, data->current_line, name);
281}
282
283static inline void winetest_ignore_exceptions( BOOL ignore )
284{
285 winetest_print_location( "IgnoreExceptions=%d\n", ignore ? 1 : 0 );
286}
287
288static inline int broken( int condition )
289{
290 return ((strcmp(winetest_platform, "windows") == 0)
291#ifndef USE_WINE_TODOS
292 || (strcmp(winetest_platform, "reactos") == 0)
293#endif
294 ) && condition;
295}
296
298{
299 /* counts how many times a given line printed a message */
300 static LONG line_counters[16384];
301
303 int index, count;
304
305 if (winetest_debug > 1)
306 return 0;
307
309 index = data->current_line % ARRAY_SIZE(line_counters);
310 count = InterlockedIncrement(line_counters + index) - 1;
312 {
313 //winetest_print_lock();
314 winetest_print_location( "Line has been silenced after %d occurrences\n", winetest_mute_threshold );
315 //winetest_print_unlock();
316 }
317
318 return count;
319}
320
321/*
322 * Checks that a condition has the expected value, that is true except if
323 * preceded by a todo indicating the check is expected to fail.
324 *
325 * Parameters:
326 * - condition - true if the check succeeded, false otherwise;
327 * - msg - failure message format;
328 * - args - arguments for the failure message
329 * Return:
330 * 0 if condition does not have the expected value, 1 otherwise
331 */
332static int winetest_vok( int condition, const char *msg, va_list args )
333{
335
336 if (data->todo_level)
337 {
338 if (condition)
339 {
340 winetest_print_context( "Test succeeded inside todo block: " );
342 if ((data->nocount_level & 2) == 0)
344 return 0;
345 }
346 else
347 {
348 /* show todos even if traces are disabled*/
349 /*if (winetest_debug > 0)*/
350 {
351 winetest_print_context( "Test marked todo: " );
353 }
354 if ((data->nocount_level & 1) == 0)
356 return 1;
357 }
358 }
359 else
360 {
361 if (!condition)
362 {
363 winetest_print_context( "Test failed: " );
365 if ((data->nocount_level & 2) == 0)
367 return 0;
368 }
369 else
370 {
371 if (winetest_report_success && (data->nocount_level & 1) == 0)
372 {
373 winetest_printf("Test succeeded\n");
374 }
375 if ((data->nocount_level & 1) == 0)
377 return 1;
378 }
379 }
380}
381
382void winetest_ok( int condition, const char *msg, ... ) __WINE_PRINTF_ATTR(2,3);
383#ifdef STANDALONE
384void winetest_ok( int condition, const char *msg, ... )
385{
387
390 va_end(valist);
391}
392#endif // STANDALONE
393
394void winetest_trace( const char *msg, ... ) __WINE_PRINTF_ATTR(1,2);
395#ifdef STANDALONE
396void winetest_trace( const char *msg, ... )
397{
399
400 if (winetest_debug > 0)
401 {
405 va_end(valist);
406 }
407}
408#endif // STANDALONE
409
410static void winetest_vskip( const char *msg, va_list args )
411{
412 winetest_print_context( "Tests skipped: " );
415}
416
417/*
418 * Prints a message to indicate that a group of tests is being skipped
419 * because the requirements for running them are not met.
420 *
421 * Parameters:
422 * - msg - failure message format;
423 * - args - arguments for the failure message
424 */
425void winetest_skip( const char *msg, ... ) __WINE_PRINTF_ATTR(1,2);
426#ifdef STANDALONE
427void winetest_skip( const char *msg, ... )
428{
432 va_end(valist);
433}
434#endif // STANDALONE
435
436static void winetest_win_skip( const char *msg, ... ) __WINE_PRINTF_ATTR(1,2);
437static inline void winetest_win_skip( const char *msg, ... )
438{
441 if ((strcmp(winetest_platform, "windows") == 0)
442#if !defined(USE_WINE_TODOS) || defined(USE_WIN_SKIP)
443 || (strcmp(winetest_platform, "reactos") == 0)
444#endif
445 )
447 else
449 va_end(valist);
450}
451
452/* If is_flaky is true, indicates that the next test may occasionally fail due
453 * to unavoidable outside race conditions. Such failures will be flagged as
454 * flaky so they can be ignored by automated testing tools.
455 *
456 * Remarks:
457 * - This is not meant to paper over race conditions within the test itself.
458 * Those are bugs and should be fixed.
459 * - This is not meant to be used for tests that normally succeed but
460 * systematically fail on a specific platform or locale.
461 * - The failures should be rare to start with. If a test fails 25% of the time
462 * it is probably wrong.
463 */
464static inline void winetest_start_flaky( int is_flaky )
465{
467 data->flaky_level = (data->flaky_level << 1) | (is_flaky != 0);
468 data->flaky_do_loop = 1;
469}
470
471static inline int winetest_loop_flaky(void)
472{
474 int do_flaky = data->flaky_do_loop;
475 data->flaky_do_loop = 0;
476 return do_flaky;
477}
478
479static inline void winetest_end_flaky(void)
480{
482 data->flaky_level >>= 1;
483}
484
485/* If is_todo is true, indicates that the next test is expected to fail on this
486 * platform. This is used to identify tests that are known to fail in Wine.
487 *
488 * Remarks:
489 * - is_todo should never be true on Windows. To ensure this, always use
490 * todo_wine_if().
491 */
492static inline void winetest_start_todo( int is_todo )
493{
495 data->todo_level = (data->todo_level << 1) | (is_todo != 0);
496 data->todo_do_loop=1;
497}
498
499static inline int winetest_loop_todo(void)
500{
502 int do_loop=data->todo_do_loop;
503 data->todo_do_loop=0;
504 return do_loop;
505}
506
507static inline void winetest_end_todo(void)
508{
510 data->todo_level >>= 1;
511}
512
513/* Adds a string to be prepended to the test traces and failure messages.
514 * This must be paired with a winetest_pop_context() call.
515 *
516 * Parameters:
517 * - msg - failure message format;
518 * - args - arguments for the failure message
519 *
520 * Remarks:
521 * - Failure messages must always make it possible to figure out what was being
522 * tested. While not ideal the line number can usually be used for that
523 * purpose except when the test loops on a list of test parameters. In such
524 * cases either the test parameters or the loop index should be added to the
525 * context.
526 *
527 * Example:
528 *
529 * for (i = 0; i < ARRAY_SIZE(test_parameters); i++)
530 * {
531 * winetest_push_context("%d", i);
532 * ...
533 * ok(WinAPI(test_parameters[i]), ...);
534 * ...
535 * winetest_pop_context();
536 * }
537 */
538static void winetest_push_context( const char *fmt, ... ) __WINE_PRINTF_ATTR(1, 2);
539static inline void winetest_push_context( const char *fmt, ... )
540{
543
544 if (data->context_count < ARRAY_SIZE(data->context))
545 {
547 vsnprintf( data->context[data->context_count], sizeof(data->context[data->context_count]), fmt, valist );
548 va_end(valist);
549 data->context[data->context_count][sizeof(data->context[data->context_count]) - 1] = 0;
550 }
551 ++data->context_count;
552}
553
554static inline void winetest_pop_context(void)
555{
557
558 if (data->context_count)
559 --data->context_count;
560}
561
562static inline LONG winetest_get_failures(void)
563{
564 return winetest_failures;
565}
566
567static inline void winetest_add_failures( LONG new_failures )
568{
569 while (new_failures-- > 0) InterlockedIncrement( &winetest_failures );
570}
571
572
573/************************************************************************/
574/* Below is the implementation of the various functions, to be included
575 * directly into the generated testlist.c file.
576 * It is done that way so that the dlls can build the test routines with
577 * different includes or flags if needed.
578 */
579
580#ifdef STANDALONE
581
582#include <stdio.h>
583#include <excpt.h>
584#ifdef __REACTOS__
585#include <oleauto.h>
586#endif
587
588struct test
589{
590 const char *name;
591 void (*func)(void);
592};
593
594#ifdef __REACTOS__
595extern const struct test winetest_testlist_start[];
596const struct test* winetest_testlist = &winetest_testlist_start[1];
597#else
598extern const struct test winetest_testlist[];
599#endif
600
601/* debug level */
602int winetest_debug = 1;
603
604/* trace timing information */
605int winetest_time = 0;
607
608/* interactive mode? */
610
611/* current platform */
612const char *winetest_platform = "windows";
614
615/* report failed flaky tests as failures (BOOL) */
617
618/* report successful tests (BOOL) */
620
621/* silence todos and skips above this threshold */
623
624/* use ANSI escape codes for output coloring */
625int winetest_color = 0;
626
627static HANDLE winetest_mutex;
628
629/* passing arguments around */
630static int winetest_argc;
631static char** winetest_argv;
632
633static const struct test *current_test; /* test currently being run */
634
635LONG winetest_successes = 0; /* number of successful tests */
636LONG winetest_failures = 0; /* number of failures */
637LONG winetest_flaky_failures = 0; /* number of failures inside flaky block */
638LONG winetest_skipped = 0; /* number of skipped test chunks */
639LONG winetest_todo_successes = 0; /* number of successful tests inside todo block */
640LONG winetest_todo_failures = 0; /* number of failures inside todo block */
641LONG winetest_muted_traces = 0; /* number of silenced traces */
642LONG winetest_muted_skipped = 0; /* same as skipped but silent */
643LONG winetest_muted_todo_successes = 0; /* same as todo_successes but silent */
644
645static DWORD tls_index;
646
648{
651
653 data=(struct winetest_thread_data*)TlsGetValue(tls_index);
654 if (!data)
655 {
657 data->str_pos = data->strings;
658 TlsSetValue(tls_index,data);
659 }
661 return data;
662}
663
664static void exit_process( int code )
665{
666 fflush( stdout );
667 ExitProcess( code );
668}
669
670void winetest_print_lock(void)
671{
672 UINT ret;
673
674 if (!winetest_mutex) return;
675 ret = WaitForSingleObject( winetest_mutex, 30000 );
676 if (ret != WAIT_OBJECT_0 && ret != WAIT_ABANDONED)
677 {
678 winetest_print_location( "could not get the print lock: %u\n", ret );
679 winetest_mutex = 0;
680 }
681}
682
683void winetest_print_unlock(void)
684{
685 if (winetest_mutex) ReleaseMutex( winetest_mutex );
686}
687
688int winetest_vprintf( const char *msg, va_list args )
689{
691
692 fprintf(stdout, __winetest_file_line_prefix ": ", data->current_file, data->current_line);
693 return vfprintf(stdout, msg, args);
694}
695
696int winetest_get_time(void)
697{
698 return GetTickCount();
699}
700
701int winetest_get_mainargs( char ***pargv )
702{
703 *pargv = winetest_argv;
704 return winetest_argc;
705}
706
708{
709 DWORD exit_code = 1;
710
711 if (WaitForSingleObject( process, 30000 ))
712 fprintf( stdout, "%s: child process wait failed\n", current_test->name );
713 else
715
716 if (exit_code)
717 {
718 if (exit_code > 255)
719 {
720 fprintf( stdout, "%s: exception 0x%08x in child process\n", current_test->name, (unsigned)exit_code );
722 }
723 else
724 {
725 fprintf( stdout, "%s: %u failures in child process\n",
726 current_test->name, (unsigned)exit_code );
727 while (exit_code-- > 0)
729 }
730 }
731}
732
733/* Find a test by name */
734static const struct test *find_test( const char *name )
735{
736 const struct test *test;
737 const char *p;
738 size_t len;
739
740 if ((p = strrchr( name, '/' ))) name = p + 1;
741 if ((p = strrchr( name, '\\' ))) name = p + 1;
742 len = strlen(name);
743 if (len > 2 && !strcmp( name + len - 2, ".c" )) len -= 2;
744
745 for (test = winetest_testlist; test->name; test++)
746 {
747 if (!strncmp( test->name, name, len ) && !test->name[len]) break;
748 }
749 return test->name ? test : NULL;
750}
751
752
753/* Display list of valid tests */
754static void list_tests(void)
755{
756 const struct test *test;
757
758 fprintf( stdout, "Valid test names:\n" );
759 for (test = winetest_testlist; test->name; test++) fprintf( stdout, " %s\n", test->name );
760}
761
762/* Disable false-positive claiming "test" would be NULL-dereferenced */
763#if defined(_MSC_VER)
764#pragma warning(push)
765#pragma warning(disable:28182)
766#endif
767
768/* Run a named test, and return exit status */
769static int run_test( const char *name )
770{
771 const struct test *test;
772 int status;
773
774 if (!(test = find_test( name )))
775 {
776 fprintf( stdout, "Fatal: test '%s' does not exist.\n", name );
777 exit_process(1);
778 }
780 tls_index=TlsAlloc();
781 current_test = test;
782 test->func();
783
784 /* show test results even if traces are disabled */
785 /*if (winetest_debug)*/
786 {
787 fprintf( stdout, "\n%s: %d tests executed (%d marked as todo, %d %s), %d skipped.\n",
790 (winetest_failures + winetest_todo_failures != 1) ? "failures" : "failure",
791 (int)winetest_skipped );
792 }
794 return status;
795}
796
797#if defined(_MSC_VER)
798#pragma warning(pop)
799#endif
800
801/* Display usage and exit */
802static void usage( const char *argv0 )
803{
804 fprintf( stdout, "Usage: %s test_name\n\n", argv0 );
805 list_tests();
806 exit_process(1);
807}
808
809/* trap unhandled exceptions */
810static LONG CALLBACK exc_filter( EXCEPTION_POINTERS *ptrs )
811{
813 char elapsed[64];
814
816 if (data->current_file)
817 printf( "%s:%d: this is the last test seen before the exception\n",
818 data->current_file, data->current_line );
820 printf( "%04x:%s:%s unhandled exception %08x at %p\n",
821 (UINT)GetCurrentProcessId(), current_test->name, winetest_elapsed( elapsed ),
824 fflush( stdout );
827}
828
829/* check if we're running under wine */
830static BOOL running_under_wine(void)
831{
832 HMODULE module = GetModuleHandleA( "ntdll.dll" );
833 if (!module) return FALSE;
834 return (GetProcAddress( module, "wine_server_call" ) != NULL);
835}
836
837/* main function */
838int main( int argc, char **argv )
839{
840 char p[128];
841
842 setvbuf (stdout, NULL, _IONBF, 0);
843 winetest_mutex = CreateMutexA(NULL, FALSE, "winetest_print_mutex");
844
845 winetest_argc = argc;
846 winetest_argv = argv;
847
848 if (GetEnvironmentVariableA( "WINETEST_PLATFORM", p, sizeof(p) )) winetest_platform = _strdup(p);
849 if (GetEnvironmentVariableA( "WINETEST_DEBUG", p, sizeof(p) )) winetest_debug = atoi(p);
850 if (GetEnvironmentVariableA( "WINETEST_INTERACTIVE", p, sizeof(p) )) winetest_interactive = atoi(p);
851 if (GetEnvironmentVariableA( "WINETEST_REPORT_SUCCESS", p, sizeof(p) )) winetest_report_success = atoi(p);
852
854
855 if (!argv[1])
856 {
857 if (winetest_testlist[0].name && !winetest_testlist[1].name) /* only one test */
858 return run_test( winetest_testlist[0].name );
859 usage( argv[0] );
860 }
861 if (!strcmp( argv[1], "--list" ))
862 {
863 list_tests();
864 return 0;
865 }
866 return run_test(argv[1]);
867}
868
869#endif /* STANDALONE */
870
871#ifdef __REACTOS__
872
873// These can go away, once all winetests are synced
874#ifdef NONAMELESSUNION
875# define U(x) (x).u
876# define U1(x) (x).u1
877# define U2(x) (x).u2
878# define U3(x) (x).u3
879# define U4(x) (x).u4
880# define U5(x) (x).u5
881# define U6(x) (x).u6
882# define U7(x) (x).u7
883# define U8(x) (x).u8
884#else
885# define U(x) (x)
886# define U1(x) (x)
887# define U2(x) (x)
888# define U3(x) (x)
889# define U4(x) (x)
890# define U5(x) (x)
891# define U6(x) (x)
892# define U7(x) (x)
893# define U8(x) (x)
894#endif
895
896#ifdef NONAMELESSSTRUCT
897# define S(x) (x).s
898# define S1(x) (x).s1
899# define S2(x) (x).s2
900# define S3(x) (x).s3
901# define S4(x) (x).s4
902# define S5(x) (x).s5
903#else
904# define S(x) (x)
905# define S1(x) (x)
906# define S2(x) (x)
907# define S3(x) (x)
908# define S4(x) (x)
909# define S5(x) (x)
910#endif
911
912// FIXME: Should include wine/debug.h instead
913#ifndef __WINE_DEBUG_H
914extern const char *wine_dbgstr_wn( const WCHAR *str, intptr_t n );
915extern const char *wine_dbgstr_an( const CHAR *str, intptr_t n );
916extern const char *wine_dbgstr_guid( const GUID *guid );
917extern const char *wine_dbgstr_point( const POINT *guid );
918extern const char *wine_dbgstr_size( const SIZE *guid );
919extern const char *wine_dbgstr_rect( const RECT *rect );
920#ifdef WINETEST_USE_DBGSTR_LONGLONG
921extern const char *wine_dbgstr_longlong( ULONGLONG ll );
922#endif
923static inline const char *debugstr_a( const char *s ) { return wine_dbgstr_an( s, -1 ); }
924static inline const char *debugstr_an( const CHAR *s, intptr_t n ) { return wine_dbgstr_an( s, n ); }
925static inline const char *debugstr_w( const WCHAR *s ) { return wine_dbgstr_wn( s, -1 ); }
926static inline const char *debugstr_wn( const WCHAR *s, int n ) { return wine_dbgstr_wn( s, n ); }
927static inline const char *debugstr_guid( const struct _GUID *id ) { return wine_dbgstr_guid(id); }
928static inline const char *wine_dbgstr_a( const char *s ) { return wine_dbgstr_an( s, -1 ); }
929static inline const char *wine_dbgstr_w( const WCHAR *s ) { return wine_dbgstr_wn( s, -1 ); }
930#if defined(__oaidl_h__) && defined(V_VT)
931extern const char *wine_dbgstr_variant(const VARIANT *var);
932static inline const char *debugstr_variant( const VARIANT *v ) { return wine_dbgstr_variant( v ); }
933#endif
934#endif /* !__WINE_DEBUG_H */
935extern const char * __cdecl __wine_dbg_strdup( const char *str );
936
937/* strcmpW is available for tests compiled under Wine, but not in standalone
938 * builds under Windows, so we reimplement it under a different name. */
939static inline int winetest_strcmpW( const WCHAR *str1, const WCHAR *str2 )
940{
941 while (*str1 && (*str1 == *str2)) { str1++; str2++; }
942 return *str1 - *str2;
943}
944
945extern LONG winetest_get_successes(void);
946extern void winetest_print(const char* msg, ...) __WINE_PRINTF_ATTR( 1, 2);
947
948extern void winetest_start_nocount(unsigned int flags);
949extern int winetest_loop_nocount(void);
950extern void winetest_end_nocount(void);
951
952// hack for ntdll winetest (this is defined in excpt.h)
953#undef exception_info
954
955// Some helpful definitions
956
957#define ros_skip_flaky for (winetest_start_nocount(3); \
958 winetest_loop_nocount(); \
959 winetest_end_nocount())
960
961#define disable_success_count for (winetest_start_nocount(1); \
962 winetest_loop_nocount(); \
963 winetest_end_nocount())
964
965#define skip_2k3_crash if (_winver < 0x600) skip("Test skipped, because it crashes on win 2003\n"); else
966#define skip_2k3_fail if (_winver < 0x600) skip("Test skipped, because it fails on win 2003\n"); else
967
968#define ok_hex_(file, line, expression, result) \
969 do { \
970 int _value = (expression); \
971 int _result = (result); \
972 ok_(file, line)(_value == _result, "Wrong value for '%s', expected: " #result " (0x%x), got: 0x%x\n", \
973 #expression, _result, _value); \
974 } while (0)
975#define ok_hex(expression, result) ok_hex_(__FILE__, __LINE__, expression, result)
976
977#define ok_dec_(file, line, expression, result) \
978 do { \
979 int _value = (expression); \
980 int _result = (result); \
981 ok_(file, line)(_value == _result, "Wrong value for '%s', expected: " #result " (%d), got: %d\n", \
982 #expression, _result, _value); \
983 } while (0)
984#define ok_dec(expression, result) ok_dec_(__FILE__, __LINE__, expression, result)
985
986#define ok_ptr_(file, line, expression, result) \
987 do { \
988 const void *_value = (expression); \
989 const void *_result = (result); \
990 ok_(file, line)(_value == _result, "Wrong value for '%s', expected: " #result " (%p), got: %p\n", \
991 #expression, _result, _value); \
992 } while (0)
993#define ok_ptr(expression, result) ok_ptr_(__FILE__, __LINE__, expression, result)
994
995#define ok_size_t_(file, line, expression, result) \
996 do { \
997 size_t _value = (expression); \
998 size_t _result = (result); \
999 ok_(file, line)(_value == _result, "Wrong value for '%s', expected: " #result " (%Ix), got: %Ix\n", \
1000 #expression, _result, _value); \
1001 } while (0)
1002#define ok_size_t(expression, result) ok_size_t_(__FILE__, __LINE__, expression, result)
1003
1004#define ok_char(expression, result) ok_hex(expression, result)
1005
1006#define ok_err_(file, line, error) \
1007 ok_(file, line)(GetLastError() == (error), "Wrong last error. Expected " #error ", got 0x%lx\n", GetLastError())
1008#define ok_err(error) ok_err_(__FILE__, __LINE__, error)
1009
1010#define ok_str_(file, line, x, y) \
1011 ok_(file, line)(strcmp(x, y) == 0, "Wrong string. Expected '%s', got '%s'\n", y, x)
1012#define ok_str(x, y) ok_str_(__FILE__, __LINE__, x, y)
1013
1014#define ok_wstr_(file, line, x, y) \
1015 ok_(file, line)(wcscmp(x, y) == 0, "Wrong string. Expected '%S', got '%S'\n", y, x)
1016#define ok_wstr(x, y) ok_wstr_(__FILE__, __LINE__, x, y)
1017
1018#define ok_long(expression, result) ok_hex(expression, result)
1019#define ok_int(expression, result) ok_dec(expression, result)
1020#define ok_int_(file, line, expression, result) ok_dec_(file, line, expression, result)
1021#define ok_ntstatus(status, expected) ok_hex(status, expected)
1022#define ok_hdl ok_ptr
1023
1024#define is_reactos() \
1025 (*(unsigned*)((size_t)0x7FFE0FFC) == 0x8EAC705)
1026
1027/* ReactOS specific extensions, useful for patches */
1028#define KUSER_SHARED_DATA_UMPTR 0x7FFE0000
1029#define GetMajorNTVersion() (*(ULONG*)(KUSER_SHARED_DATA_UMPTR + 0x026C))
1030#define GetMinorNTVersion() (*(ULONG*)(KUSER_SHARED_DATA_UMPTR + 0x0270))
1031#define GetNTVersion() ((GetMajorNTVersion() << 8) | GetMinorNTVersion())
1032#define __REACTOS__WinVer_lt(Ver) ((GetNTVersion() < (Ver)))
1033
1034#ifndef STANDALONE
1035struct test
1036{
1037 const char *name;
1038 void (*func)(void);
1039};
1040#endif
1041
1042/* Section allocation helper for automatic test registration */
1043#if defined(_MSC_VER)
1044 #pragma section(".test$A",long,read)
1045 #define _TESTALLOC(x) __declspec(allocate(x))
1046 #define _PRAGMA_SECTION(x, y, z) __pragma(section(x, y, z))
1047 #define _TESTKEEP(x) const void* keep_##x = &x;
1048#elif defined(__GNUC__)
1049 #define _TESTALLOC(x) __attribute__((used, section(x)))
1050 #define _PRAGMA_SECTION(x, y, z)
1051 #define _TESTKEEP(x)
1052#else
1053 #error Your compiler is not supported.
1054#endif
1055
1056#undef START_TEST
1057#define START_TEST(name) \
1058 EXTERN_C void func_##name(void); \
1059 _PRAGMA_SECTION(_CRT_STRINGIZE(.test$B##name), long, read); \
1060 _TESTALLOC(_CRT_STRINGIZE(.test$B##name)) const struct test winetest_testentry_##name = { #name, func_##name }; \
1061 _TESTKEEP(winetest_testentry_##name) \
1062 EXTERN_C void func_##name(void)
1063
1064#ifdef STANDALONE
1065
1066_TESTALLOC(".test$A") const struct test winetest_testlist_start[] = { { "", 0 } };
1067#define winetest_testlist winetest_testlist_dummy
1068
1070{
1071 return winetest_successes;
1072}
1073
1074void winetest_print(const char* msg, ...)
1075{
1078
1079 fprintf(stdout, __winetest_file_line_prefix ": ", data->current_file, data->current_line);
1082 va_end(valist);
1083}
1084
1085void winetest_start_nocount(unsigned int flags)
1086{
1088
1089 /* The lowest 2 bits of nocount_level specify whether counting of successes
1090 and/or failures is disabled. For each nested level the bits are shifted
1091 left, the new lowest 2 bits are copied from the previous state and ored
1092 with the new mask. This allows nested handling of both states up tp a
1093 level of 16. */
1094 flags |= data->nocount_level & 3;
1095 data->nocount_level = (data->nocount_level << 2) | flags;
1096 data->todo_do_loop = 1;
1097}
1098
1099int winetest_loop_nocount(void)
1100{
1102 int do_loop = data->todo_do_loop;
1103 data->todo_do_loop = 0;
1104 return do_loop;
1105}
1106
1107void winetest_end_nocount(void)
1108{
1110 data->nocount_level >>= 2;
1111}
1112
1113/* allocate some tmp space for a string */
1114static char *get_temp_buffer( size_t n )
1115{
1117 char *res = data->str_pos;
1118
1119 if (res + n >= &data->strings[sizeof(data->strings)]) res = data->strings;
1120 data->str_pos = res + n;
1121 return res;
1122}
1123
1124/* release extra space that we requested in gimme1() */
1125static void release_temp_buffer( char *ptr, size_t size )
1126{
1128 data->str_pos = ptr + size;
1129}
1130
1131const char *wine_dbgstr_an( const CHAR *str, intptr_t n )
1132{
1133 char *dst, *res;
1134 size_t size;
1135
1136 if (!((ULONG_PTR)str >> 16))
1137 {
1138 if (!str) return "(null)";
1139 res = get_temp_buffer( 6 );
1140 sprintf( res, "#%04x", LOWORD(str) );
1141 return res;
1142 }
1143 if (n == -1)
1144 {
1145 const CHAR *end = str;
1146 while (*end) end++;
1147 n = end - str;
1148 }
1149 if (n < 0) n = 0;
1150 size = 12 + min( 300, n * 5 );
1151 dst = res = get_temp_buffer( size );
1152 *dst++ = '"';
1153 while (n-- > 0 && dst <= res + size - 10)
1154 {
1155 CHAR c = *str++;
1156 switch (c)
1157 {
1158 case '\n': *dst++ = '\\'; *dst++ = 'n'; break;
1159 case '\r': *dst++ = '\\'; *dst++ = 'r'; break;
1160 case '\t': *dst++ = '\\'; *dst++ = 't'; break;
1161 case '"': *dst++ = '\\'; *dst++ = '"'; break;
1162 case '\\': *dst++ = '\\'; *dst++ = '\\'; break;
1163 default:
1164 if (c >= ' ' && c <= 126)
1165 *dst++ = (char)c;
1166 else
1167 {
1168 *dst++ = '\\';
1169 sprintf(dst,"%04x",c);
1170 dst+=4;
1171 }
1172 }
1173 }
1174 *dst++ = '"';
1175 if (n > 0)
1176 {
1177 *dst++ = '.';
1178 *dst++ = '.';
1179 *dst++ = '.';
1180 }
1181 *dst++ = 0;
1183 return res;
1184}
1185
1186const char *wine_dbgstr_wn( const WCHAR *str, intptr_t n )
1187{
1188 char *res;
1189 static const char hex[16] = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
1190 char buffer[300], *dst = buffer;
1191
1192 if (!str) return "(null)";
1193 if (!((ULONG_PTR)str >> 16))
1194 {
1195 res = get_temp_buffer( 6 );
1196 sprintf( res, "#%04x", LOWORD(str) );
1197 return res;
1198 }
1199 if (IsBadStringPtrW(str,n)) return "(invalid)";
1200 if (n == -1) for (n = 0; str[n]; n++) ;
1201 *dst++ = 'L';
1202 *dst++ = '"';
1203 while (n-- > 0 && dst <= buffer + sizeof(buffer) - 10)
1204 {
1205 WCHAR c = *str++;
1206 switch (c)
1207 {
1208 case '\n': *dst++ = '\\'; *dst++ = 'n'; break;
1209 case '\r': *dst++ = '\\'; *dst++ = 'r'; break;
1210 case '\t': *dst++ = '\\'; *dst++ = 't'; break;
1211 case '"': *dst++ = '\\'; *dst++ = '"'; break;
1212 case '\\': *dst++ = '\\'; *dst++ = '\\'; break;
1213 default:
1214 if (c < ' ' || c >= 127)
1215 {
1216 *dst++ = '\\';
1217 *dst++ = hex[(c >> 12) & 0x0f];
1218 *dst++ = hex[(c >> 8) & 0x0f];
1219 *dst++ = hex[(c >> 4) & 0x0f];
1220 *dst++ = hex[c & 0x0f];
1221 }
1222 else *dst++ = (char)c;
1223 }
1224 }
1225 *dst++ = '"';
1226 if (n > 0)
1227 {
1228 *dst++ = '.';
1229 *dst++ = '.';
1230 *dst++ = '.';
1231 }
1232 *dst = 0;
1233
1235 strcpy(res, buffer);
1236 return res;
1237}
1238
1239const char *wine_dbgstr_guid( const GUID *guid )
1240{
1241 char *res;
1242
1243 if (!guid) return "(null)";
1244 res = get_temp_buffer( 39 ); /* CHARS_IN_GUID */
1245 sprintf( res, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
1246 (unsigned int)guid->Data1, guid->Data2, guid->Data3, guid->Data4[0],
1247 guid->Data4[1], guid->Data4[2], guid->Data4[3], guid->Data4[4],
1248 guid->Data4[5], guid->Data4[6], guid->Data4[7] );
1249 return res;
1250}
1251
1252const char *wine_dbgstr_point( const POINT *point )
1253{
1254 char *res;
1255
1256 if (!point) return "(null)";
1257 res = get_temp_buffer( 60 );
1258#ifdef __ROS_LONG64__
1259 sprintf( res, "(%d,%d)", point->x, point->y );
1260#else
1261 sprintf( res, "(%ld,%ld)", point->x, point->y );
1262#endif
1264 return res;
1265}
1266
1267const char *wine_dbgstr_size( const SIZE *size )
1268{
1269 char *res;
1270
1271 if (!size) return "(null)";
1272 res = get_temp_buffer( 60 );
1273#ifdef __ROS_LONG64__
1274 sprintf( res, "(%d,%d)", size->cx, size->cy );
1275#else
1276 sprintf( res, "(%ld,%ld)", size->cx, size->cy );
1277#endif
1279 return res;
1280}
1281
1282const char *wine_dbgstr_rect( const RECT *rect )
1283{
1284 char *res;
1285
1286 if (!rect) return "(null)";
1287 res = get_temp_buffer( 60 );
1288#ifdef __ROS_LONG64__
1289 sprintf( res, "(%d,%d)-(%d,%d)", rect->left, rect->top, rect->right, rect->bottom );
1290#else
1291 sprintf( res, "(%ld,%ld)-(%ld,%ld)", rect->left, rect->top, rect->right, rect->bottom );
1292#endif
1294 return res;
1295}
1296
1297#ifdef WINETEST_WINE_DBG_STUBS
1298/* A test that links a Wine helper library (strmbase, for instance) drags in
1299 * that library's TRACE/ERR calls, which land in the libwine debug backend.
1300 * Linking libwine itself is not an option here: its debug.c defines
1301 * wine_dbgstr_an/wn as well and would collide with the versions above. Supply
1302 * the handful of backend entry points instead; tracing stays off in tests.
1303 * The types are spelled out rather than taken from wine/debug.h because this
1304 * block is compiled in testlist.c, which does not include it. Only tests that
1305 * need the backend define WINETEST_WINE_DBG_STUBS: elsewhere these would clash
1306 * with a test's own wine_dbg_sprintf() or with a linked-in sdk/lib/rtl. */
1308
1310{
1311 return 0;
1312}
1313
1314int __cdecl ros_dbg_log( int cls, struct __wine_debug_channel *ch, const char *file,
1315 const char *func, const int line, const char *format, ... )
1316{
1317 return 0;
1318}
1319
1320/* Tests that reach wine/debug.h through wine/strmbase.h need this for
1321 * debugstr_time(). Implement it on the winetest string buffer rather than
1322 * pulling in libwine, whose debug.c would clash with the wine_dbgstr_*
1323 * definitions above. */
1324const char * __cdecl wine_dbg_sprintf( const char *format, ... )
1325{
1326 static const int max_size = 200;
1327 char *res;
1329 int len;
1330
1331 res = get_temp_buffer( max_size + 1 );
1334 va_end( valist );
1335 if (len == -1 || len >= max_size) res[max_size] = 0;
1336 else release_temp_buffer( res, len + 1 );
1337 return res;
1338}
1339#endif /* WINETEST_WINE_DBG_STUBS */
1340
1341#ifdef WINETEST_USE_DBGSTR_LONGLONG
1342const char *wine_dbgstr_longlong( ULONGLONG ll )
1343{
1344 char *res;
1345
1346 res = get_temp_buffer( 20 );
1347 if (/*sizeof(ll) > sizeof(unsigned long) &&*/ ll >> 32) /* ULONGLONG is always > long in ReactOS */
1348 sprintf( res, "%lx%08lx", (unsigned long)(ll >> 32), (unsigned long)ll );
1349 else
1350 sprintf( res, "%lx", (unsigned long)ll );
1352 return res;
1353}
1354#endif
1355
1356#if defined(__oaidl_h__) && defined(V_VT)
1357const char *wine_dbgstr_variant(const VARIANT *var)
1358{
1359 static char buf[400];
1360
1361 if (!var)
1362 return "(null)";
1363
1364 switch (V_VT(var))
1365 {
1366 case VT_EMPTY:
1367 return "{VT_EMPTY}";
1368 case VT_BSTR:
1369 sprintf(buf, "{VT_BSTR: %s}", wine_dbgstr_w(V_BSTR(var)));
1370 break;
1371 case VT_BOOL:
1372 sprintf(buf, "{VT_BOOL: %x}", V_BOOL(var));
1373 break;
1374 case VT_UI4:
1375 sprintf(buf, "{VT_UI4: %u}", V_UI4(var));
1376 break;
1377 default:
1378 sprintf(buf, "{vt %d}", V_VT(var));
1379 break;
1380 }
1381
1382 return buf;
1383}
1384#endif
1385
1386/* FIXME: this is not 100% thread-safe */
1387const char * __cdecl __wine_dbg_strdup( const char *str )
1388{
1389 static char *list[32];
1390 static LONG pos;
1391 char *ret = _strdup( str );
1392 int idx;
1393
1395 free( InterlockedExchangePointer( (void **)&list[idx], ret ));
1396 return ret;
1397}
1398
1399#endif
1400
1401#ifdef __cplusplus
1402} /* extern "C" */
1403#endif
1404
1405#ifdef __GNUC__
1406#pragma GCC diagnostic pop
1407#endif
1408
1409#endif // __REACTOS__
1410
1411#endif /* __WINE_WINE_TEST_H */
ios_base &_STLP_CALL hex(ios_base &__s)
Definition: _ios_base.h:324
#define vsnprintf
Definition: acwin.h:108
#define InterlockedIncrement
Definition: armddk.h:53
static const char * wine_dbgstr_point(const POINT *ppt)
Definition: atltest.h:138
static const char * wine_dbgstr_size(const SIZE *psize)
Definition: atltest.h:155
#define broken(x)
Definition: atltest.h:178
static const char * wine_dbgstr_rect(const RECT *prc)
Definition: atltest.h:160
#define msg(x)
Definition: auth_time.c:54
#define index(s, c)
Definition: various.h:29
static INT max_size
Definition: history.c:51
w ll
Definition: byte_order.h:167
Definition: list.h:39
RECT rect
Definition: combotst.c:67
#define free
Definition: debug_ros.c:5
#define _strdup
Definition: debug_ros.c:7
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
unsigned int idx
Definition: utils.c:40
static INT do_loop(const PropSheetInfo *psInfo)
Definition: propsheet.c:2834
const char * wine_dbg_sprintf(const char *format,...)
Definition: compat.c:296
const char * wine_dbgstr_an(const char *str, int n)
Definition: compat.c:313
#define GetProcessHeap()
Definition: compat.h:736
#define SetLastError(x)
Definition: compat.h:752
#define GetProcAddress(x, y)
Definition: compat.h:753
#define HeapAlloc
Definition: compat.h:733
static __inline const char * debugstr_an(const char *s, int n)
Definition: compat.h:55
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49
#define CALLBACK
Definition: compat.h:35
#define GetEnvironmentVariableA(x, y, z)
Definition: compat.h:754
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
@ VT_BSTR
Definition: compat.h:2303
@ VT_BOOL
Definition: compat.h:2306
@ VT_UI4
Definition: compat.h:2313
@ VT_EMPTY
Definition: compat.h:2295
UINT WINAPI SetErrorMode(IN UINT uMode)
Definition: except.c:751
BOOL NTAPI IsBadStringPtrW(IN LPCWSTR lpsz, IN UINT_PTR ucchMax)
Definition: except.c:950
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
BOOL WINAPI GetExitCodeProcess(IN HANDLE hProcess, IN LPDWORD lpExitCode)
Definition: proc.c:1215
VOID WINAPI ExitProcess(IN UINT uExitCode)
Definition: proc.c:1380
LPVOID WINAPI TlsGetValue(IN DWORD Index)
Definition: thread.c:1298
BOOL WINAPI TlsSetValue(IN DWORD Index, IN LPVOID Value)
Definition: thread.c:1334
ULONG WINAPI DECLSPEC_HOTPATCH GetTickCount(void)
Definition: sync.c:182
DWORD WINAPI DECLSPEC_HOTPATCH TlsAlloc(void)
Definition: thread.c:657
GUID guid
Definition: version.c:147
MonoAssembly int argc
Definition: metahost.c:107
unsigned char ch[4][2]
Definition: console.c:118
int WINAPIV fprintf(FILE *file, const char *format,...)
Definition: file.c:5549
int CDECL vfprintf(FILE *file, const char *format, va_list valist)
Definition: file.c:5349
int CDECL fflush(FILE *file)
Definition: file.c:1182
int CDECL setvbuf(FILE *file, char *buf, int mode, size_t size)
Definition: file.c:5006
int intptr_t
Definition: corecrt.h:176
#define __cdecl
Definition: corecrt.h:121
#define stdout
#define va_end(v)
Definition: stdarg.h:28
#define va_start(v, l)
Definition: stdarg.h:26
#define _IONBF
Definition: stdio.h:30
_ACRTIMP int __cdecl atoi(const char *)
Definition: string.c:1720
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1597
_ACRTIMP int __cdecl strcmp(const char *, const char *)
Definition: string.c:3324
_ACRTIMP int __cdecl strncmp(const char *, const char *, size_t)
Definition: string.c:3335
_ACRTIMP char *__cdecl strrchr(const char *, int)
Definition: string.c:3303
char * va_list
Definition: vadefs.h:50
unsigned char
Definition: typeof.h:29
static const char * debugstr_variant(const VARIANT *var)
Definition: dom.c:505
static LPSTR get_temp_buffer(void)
Definition: dplayx.c:114
return ret
Definition: mutex.c:147
int main()
Definition: test.c:6
#define InterlockedExchangePointer(Target, Value)
Definition: dshow.h:45
POINTL point
Definition: edittest.c:50
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
time_t now
Definition: finger.c:65
#define printf
Definition: freeldr.h:103
const GLdouble * v
Definition: gl.h:2040
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLdouble s
Definition: gl.h:2039
GLuint GLuint end
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLenum func
Definition: glext.h:6028
GLdouble n
Definition: glext.h:7729
GLuint res
Definition: glext.h:9613
GLsizei const GLchar *const * strings
Definition: glext.h:7622
GLuint buffer
Definition: glext.h:5915
GLsizeiptr size
Definition: glext.h:5919
GLenum condition
Definition: glext.h:9255
const GLubyte * c
Definition: glext.h:8905
GLuint index
Definition: glext.h:6031
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLenum GLenum dst
Definition: glext.h:6340
GLbitfield flags
Definition: glext.h:7161
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLsizei len
Definition: glext.h:6722
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT
Definition: sysinfo.c:13
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
#define debugstr_guid
Definition: kernel32.h:35
#define debugstr_a
Definition: kernel32.h:31
#define debugstr_wn
Definition: kernel32.h:33
#define debugstr_w
Definition: kernel32.h:32
#define wine_dbgstr_w
Definition: kernel32.h:34
LONG winetest_get_successes(void)
void winetest_end_nocount(void)
void winetest_start_nocount(unsigned int flags)
int winetest_loop_nocount(void)
static PVOID ptr
Definition: dispmode.c:27
#define sprintf
Definition: sprintf.c:45
const char * var
Definition: shader.c:5879
static UINT exit_code
Definition: process.c:80
static va_list valist
Definition: printf.c:46
static int running_under_wine(void)
Definition: main.c:99
#define min(a, b)
Definition: monoChain.cc:55
#define argv
Definition: mplay32.c:18
#define run_test(test)
Definition: ms_seh.c:71
#define SEM_FAILCRITICALERRORS
Definition: rtltypes.h:69
#define SEM_NOGPFAULTERRORBOX
Definition: rtltypes.h:70
#define V_BOOL(A)
Definition: oleauto.h:224
#define V_VT(A)
Definition: oleauto.h:211
#define V_BSTR(A)
Definition: oleauto.h:226
#define V_UI4(A)
Definition: oleauto.h:270
#define LOWORD(l)
Definition: pedump.c:82
short WCHAR
Definition: pedump.c:58
long LONG
Definition: pedump.c:60
char CHAR
Definition: pedump.c:57
#define test
Definition: rosglue.h:37
const struct test winetest_testlist[]
Definition: testlist.c:25
#define wine_dbgstr_wn
Definition: testlist.c:2
const WCHAR * str
#define inline
Definition: compat.h:23
strcpy
Definition: string.h:131
int int ros_dbg_log(enum __wine_debug_class cls, struct __wine_debug_channel *ch, const char *file, const char *func, const int line, const char *format,...) __WINE_PRINTF_ATTR(6
int int static __inline const char * wine_dbgstr_a(const char *s)
Definition: debug.h:160
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:181
static const char winetest_color_dark_purple[]
Definition: test.h:214
static void winetest_end_todo(void)
Definition: test.h:507
void void winetest_trace(const char *msg,...) __WINE_PRINTF_ATTR(1
#define __winetest_file_line_prefix
Definition: test.h:226
const char * winetest_platform
LONG winetest_flaky_failures
static void winetest_start_todo(int is_todo)
Definition: test.h:492
static void winetest_subtest(const char *name)
Definition: test.h:276
static void winetest_print_location(const char *msg,...) __WINE_PRINTF_ATTR(1
Definition: test.h:255
static LONG winetest_get_failures(void)
Definition: test.h:562
int winetest_debug
static const char winetest_color_reset[]
Definition: test.h:212
static void winetest_push_context(const char *fmt,...) __WINE_PRINTF_ATTR(1
Definition: test.h:539
static void winetest_print_context(const char *msgtype)
Definition: test.h:266
void winetest_print_lock(void)
LONG winetest_failures
static int winetest_vok(int condition, const char *msg, va_list args)
Definition: test.h:332
static void winetest_pop_context(void)
Definition: test.h:554
LONG winetest_todo_failures
LONG winetest_muted_todo_successes
int winetest_vprintf(const char *msg, va_list args)
static void winetest_add_failures(LONG new_failures)
Definition: test.h:567
static int winetest_loop_flaky(void)
Definition: test.h:471
static const char winetest_color_blue[]
Definition: test.h:217
#define ARRAY_SIZE(x)
Definition: test.h:185
void winetest_skip(const char *msg,...) __WINE_PRINTF_ATTR(1
static const char winetest_color_green[]
Definition: test.h:215
static int winetest_printf(const char *msg,...) __WINE_PRINTF_ATTR(1
Definition: test.h:230
static const char * winetest_elapsed(char *buffer)
Definition: test.h:244
void winetest_ok(int condition, const char *msg,...) __WINE_PRINTF_ATTR(2
LONG winetest_successes
static LONG winetest_add_line(void)
Definition: test.h:297
static void winetest_start_flaky(int is_flaky)
Definition: test.h:464
static int winetest_loop_todo(void)
Definition: test.h:499
void static void winetest_win_skip(const char *msg,...) __WINE_PRINTF_ATTR(1
Definition: test.h:437
int winetest_interactive
#define __WINE_PRINTF_ATTR(fmt, args)
Definition: test.h:52
LONG winetest_todo_successes
int winetest_last_time
Definition: test.h:72
void winetest_print_unlock(void)
void void static void winetest_vskip(const char *msg, va_list args)
Definition: test.h:410
int winetest_color
static const char winetest_color_dark_red[]
Definition: test.h:213
int winetest_get_mainargs(char ***pargv)
LONG winetest_skipped
void winetest_wait_child_process(HANDLE process)
LONG winetest_muted_traces
int winetest_mute_threshold
int winetest_platform_is_wine
static const char winetest_color_bright_purple[]
Definition: test.h:219
LONG winetest_muted_skipped
static void winetest_ignore_exceptions(BOOL ignore)
Definition: test.h:283
int winetest_time
int winetest_start_time
static const char winetest_color_bright_red[]
Definition: test.h:218
int winetest_report_success
static void winetest_end_flaky(void)
Definition: test.h:479
static void winetest_set_location(const char *file, int line)
Definition: test.h:195
int winetest_report_flaky
static const char winetest_color_yellow[]
Definition: test.h:216
struct winetest_thread_data * winetest_get_thread_data(void)
int winetest_get_time(void)
static void release_temp_buffer(char *buffer, size_t size)
Definition: debug.c:344
XML_HIDDEN void xmlParserErrors const char const xmlChar const xmlChar * str2
Definition: parser.h:35
XML_HIDDEN void xmlParserErrors const char const xmlChar * str1
Definition: parser.h:35
static char argv0[MAX_PATH]
Definition: shlexec.c:49
Definition: dcommon.idl:28
long bottom
Definition: dcommon.idl:29
long right
Definition: dcommon.idl:29
long left
Definition: dcommon.idl:29
long top
Definition: dcommon.idl:29
PEXCEPTION_RECORD ExceptionRecord
Definition: rtltypes.h:200
DWORD ExceptionCode
Definition: compat.h:208
PVOID ExceptionAddress
Definition: compat.h:211
Definition: scsiwmi.h:51
LONG y
Definition: windef.h:130
LONG x
Definition: windef.h:129
Definition: match.c:390
Definition: inflate.c:139
Definition: http.c:7252
char * name
Definition: wpp.c:52
Definition: fci.c:123
Definition: dsound.c:943
Definition: parser.c:49
Definition: name.c:39
Definition: ps.c:97
unsigned int context_count
Definition: test.h:116
unsigned int nocount_level
Definition: test.h:111
char * str_pos
Definition: test.h:113
const char * current_file
Definition: test.h:106
unsigned int todo_level
Definition: test.h:110
unsigned int flaky_level
Definition: test.h:108
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseMutex(IN HANDLE hMutex)
Definition: synch.c:554
HANDLE WINAPI DECLSPEC_HOTPATCH CreateMutexA(IN LPSECURITY_ATTRIBUTES lpMutexAttributes OPTIONAL, IN BOOL bInitialOwner, IN LPCSTR lpName OPTIONAL)
Definition: synch.c:512
uint64_t ULONGLONG
Definition: typedefs.h:67
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define WAIT_ABANDONED
Definition: winbase.h:389
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
DWORD WINAPI GetCurrentProcessId(void)
Definition: proc.c:1205
#define WAIT_OBJECT_0
Definition: winbase.h:383
#define __wine_dbg_get_channel_flags(channel)
Definition: wine_debug.c:172
#define const
Definition: zconf.h:233