From 634ccedc1cf57f8a5b22640fa05778f65a066d51 Mon Sep 17 00:00:00 2001 From: Thomas Faber Date: Tue, 23 Jun 2015 10:06:38 +0000 Subject: [PATCH] [ROSAUTOTEST] - Flush cout after each write as already done by Colin in r66855, per ROSTESTS-158 - Use DbgPrint instead of OutputDebugStringA again because the latter only calls the former anyway Fixes test summary lines not being recognized by Testman, especially on VMware. A little summary so we don't keep going back and forth with this function: 1) Only writing complete lines is required to that the output doesn't mix with debug output from other components. See r55618 2) OutputDebugStringA splits its input into 512-byte-sized blocks with no regard for line breaks, so using it with strings larger than 512 bytes breaks (1). 3) OutputDebugStringA eventually calls DbgPrint("%s", string) anyway so using it with chunks smaller than 512 bytes is not an optimization As a result, yes this function MUST split up the lines itself, this can't be optimized or simplified away! kthxbye ROSTESTS-178 #resolve svn path=/trunk/; revision=68246 --- rostests/rosautotest/tools.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rostests/rosautotest/tools.cpp b/rostests/rosautotest/tools.cpp index c925c145ad7..b5276ba09db 100644 --- a/rostests/rosautotest/tools.cpp +++ b/rostests/rosautotest/tools.cpp @@ -2,7 +2,7 @@ * PROJECT: ReactOS Automatic Testing Utility * LICENSE: GNU GPLv2 or any later version as published by the Free Software Foundation * PURPOSE: Various helper functions - * COPYRIGHT: Copyright 2008-2009 Colin Finck + * COPYRIGHT: Copyright 2008-2015 Colin Finck */ #include "precomp.h" @@ -136,7 +136,7 @@ StringOut(const string& String, bool forcePrint) } DbgString[size] = 0; - OutputDebugStringA(DbgString); + DbgPrint("%s", DbgString); } last_newline = curr_pos; @@ -150,11 +150,11 @@ StringOut(const string& String, bool forcePrint) { /* Output the whole string */ if(Configuration.DoPrint()) - cout << NewString; + cout << NewString << flush; memcpy(DbgString, NewString.c_str() + start, size); DbgString[size] = 0; - OutputDebugStringA(DbgString); + DbgPrint("%s", DbgString); NewString.clear(); return NewString; @@ -162,7 +162,7 @@ StringOut(const string& String, bool forcePrint) /* Output full lines only */ if(Configuration.DoPrint()) - cout << NewString.substr(0, start); + cout << NewString.substr(0, start) << flush; /* Return the remaining chunk */ return NewString.substr(start, size);