Ejemplo n.º 1
0
void WriteSumFile(FILE *SumFile,const char* Name,const char* Section, const char* SubSection,
                  const char *Result,double timeTaken)

{
    int MaxSize;
    size_t nChars;
    char logBuffer[LINE_BUF_SIZE*2];
    char output[256];
    char *processedName;

    time_t ltime;
    struct tm *stime;
    char formattedDate[20];


    MaxSize = sizeof(logBuffer);
    sprintf(output,"%d",(int)ceil(timeTaken));

    time(&ltime);
    stime = localtime(&ltime);
    strftime(formattedDate,sizeof(formattedDate),"%Y-%m-%d",stime);

    ConvertBackSlashesToWindowsStyle((char *)SubSection);

    processedName = (char *)malloc(strlen(Name)+1);
    removeSpecialCharacters(Name,processedName);

    AppendDelimitedStringsSum(logBuffer, MaxSize, C_COMMA, C_ESCAPE,
                              processedName,Section,SubSection,PLATFORM,BUILDTYPE,BUILDNUMBER,formattedDate,Result,output,NULL);


    free(processedName);
    // to remove the trailing commas at the end of every line in the summary file
    // logBuffer[MaxSize - 1] = 0;
    logBuffer[strlen(logBuffer)-1] = 0;
    RemoveLinefeeds(logBuffer);

    nChars = fprintf(SumFile, "%s%s", logBuffer,EOLN);

    if (nChars < strlen(logBuffer)+1)
    {
        HarnessError("ERROR: Failed to write to the file to log the "
                     "results.  This is a fatal error.  errno is %d.\n",errno);
    }

}
Ejemplo n.º 2
0
 inline std::string removeStringFormat( std::string s ) {
   std::string output = s;
   output.erase( std::remove_if( output.begin(), output.end(), removeSpecialCharacters()), output.end() );
   std::transform( output.begin(), output.end(), output.begin(), ::tolower );
   return output;
 }