Exemplo n.º 1
0
void LogException( 	
	const char* inFile, 
	const char* inFunc, 
	vuint32		inLine,
	xException*	inExc,
	const char*	inMsg )
{
	++gTestFailCount;
	++gTestFailOnExceptionCount;

	I_LogFile& log 		= *GetTestsLog();

	vuint8 level = log.get_VerboseLevel();
	if( level == 0 )
		return;

	
    FBL::String logMsg;
    
	if( level >= 1 )	// show only erros:
	{
		// Visual produce __FILE__ as ful path. We want extract only file name.
		inFile = ExtractNameFromFullPath( inFile );

		logMsg << GetTestStatisticStr().GetIndentStr() << "FAIL: " << inFile << ":" << inFunc << ":" << (vuint32) inLine;
		if( inMsg )
		{
			logMsg << " " << inMsg;
		}

		logMsg << " EXCEPTION: ";

		if( inExc )
			logMsg << inExc->get_ErrorCode() << " : " << inExc->get_ErrorString().c_str();
		else
			logMsg << "UNKNOWN";

		logMsg  << "\n";
	}
    
    
    log << logMsg.c_str();
    
    // XML log:
    logMsg.addXmlEncoding();
    LogXml_Failure( logMsg.getBufferA() );

	//log.Flush();	
}
Exemplo n.º 2
0
int TestFuzzer::FindArg(const char* fmt, const fbl::String& arg) {
    fbl::StringBuffer<PATH_MAX> buffer;
    buffer.AppendPrintf(fmt, arg.c_str());
    int result = 0;
    for (const char* arg = args_.first(); arg; arg = args_.next()) {
        if (strcmp(arg, buffer.c_str()) == 0) {
            return result;
        }
        ++result;
    }
    return -1;
}