Francois Gouget : tests: Add support for subtests.

Alexandre Julliard julliard at winehq.org
Tue Sep 3 16:34:07 CDT 2019


Module: wine
Branch: master
Commit: 033196641b0c33c1047234cdb278f6630f226681
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=033196641b0c33c1047234cdb278f6630f226681

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Tue Aug 27 04:14:29 2019 +0200

tests: Add support for subtests.

Some Wine tests run code compiled from another C file, resulting in
traces and errors that look like they come from a different test.
subtest() allows such tests to declare their subtests so they are
recognized by scripts parsing the results such as the TestBot and
WineTest website.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 include/wine/test.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/include/wine/test.h b/include/wine/test.h
index b5aa9c1..bfd893e 100644
--- a/include/wine/test.h
+++ b/include/wine/test.h
@@ -68,6 +68,7 @@ extern int winetest_report_success;
 extern const char *winetest_platform;
 
 extern void winetest_set_location( const char* file, int line );
+extern void winetest_subtest( const char* name );
 extern void winetest_start_todo( int is_todo );
 extern int winetest_loop_todo(void);
 extern void winetest_end_todo(void);
@@ -123,17 +124,20 @@ extern void __winetest_cdecl winetest_win_skip( const char *msg, ... ) WINETEST_
 extern void __winetest_cdecl winetest_trace( const char *msg, ... ) WINETEST_PRINTF_ATTR(1,2);
 
 #ifdef WINETEST_NO_LINE_NUMBERS
+# define subtest_(file, line)  (winetest_set_location(file, 0), 0) ? (void)0 : winetest_subtest
 # define ok_(file, line)       (winetest_set_location(file, 0), 0) ? (void)0 : winetest_ok
 # define skip_(file, line)     (winetest_set_location(file, 0), 0) ? (void)0 : winetest_skip
 # define win_skip_(file, line) (winetest_set_location(file, 0), 0) ? (void)0 : winetest_win_skip
 # define trace_(file, line)    (winetest_set_location(file, 0), 0) ? (void)0 : winetest_trace
 #else
+# define subtest_(file, line)  (winetest_set_location(file, line), 0) ? (void)0 : winetest_subtest
 # define ok_(file, line)       (winetest_set_location(file, line), 0) ? (void)0 : winetest_ok
 # define skip_(file, line)     (winetest_set_location(file, line), 0) ? (void)0 : winetest_skip
 # define win_skip_(file, line) (winetest_set_location(file, line), 0) ? (void)0 : winetest_win_skip
 # define trace_(file, line)    (winetest_set_location(file, line), 0) ? (void)0 : winetest_trace
 #endif
 
+#define subtest  subtest_(__FILE__, __LINE__)
 #define ok       ok_(__FILE__, __LINE__)
 #define skip     skip_(__FILE__, __LINE__)
 #define win_skip win_skip_(__FILE__, __LINE__)
@@ -308,6 +312,13 @@ void winetest_set_location( const char* file, int line )
     data->current_line=line;
 }
 
+void winetest_subtest( const char* name )
+{
+    struct tls_data *data = get_tls_data();
+    printf( "%s:%d: Subtest %s\n",
+            data->current_file, data->current_line, name);
+}
+
 int broken( int condition )
 {
     return (strcmp(winetest_platform, "windows") == 0) && condition;




More information about the wine-cvs mailing list