diff options
author | Jennifer Averett <Jennifer.Averett@OARcorp.com> | 2010-05-21 20:14:30 +0000 |
---|---|---|
committer | Jennifer Averett <Jennifer.Averett@OARcorp.com> | 2010-05-21 20:14:30 +0000 |
commit | fc6f1cee5ea2a0dc2a45296e45d0ba3076fdf342 (patch) | |
tree | fcd39b3ee2c0a04559c991a980f95920c22e0bda /rtems-coverage | |
parent | 2010-05-21 Joel Sherrill <joel.sherrill@oarcorp.com> (diff) | |
download | rtems-testing-fc6f1cee5ea2a0dc2a45296e45d0ba3076fdf342.tar.bz2 |
2010-05-21 Jennifer.Averett@OARcorp.com
* ConfigFile.cc, Makefile, ReportsBase.cc, ReportsBase.h,
ReportsHtml.cc, ReportsHtml.h, ReportsText.cc, ReportsText.h,
TraceConverter.cc, app_common.cc, app_common.h, configFile.txt,
configfile_test.cc, covoar.cc, covoar.css, do_coverage,
rtems_config.in: Added ProjectName and timestamp to report heading.
Modified configuration to handle spaces in project name.
Diffstat (limited to 'rtems-coverage')
-rw-r--r-- | rtems-coverage/ChangeLog | 9 | ||||
-rw-r--r-- | rtems-coverage/ConfigFile.cc | 93 | ||||
-rw-r--r-- | rtems-coverage/Makefile | 6 | ||||
-rw-r--r-- | rtems-coverage/ReportsBase.cc | 14 | ||||
-rw-r--r-- | rtems-coverage/ReportsBase.h | 8 | ||||
-rw-r--r-- | rtems-coverage/ReportsHtml.cc | 143 | ||||
-rw-r--r-- | rtems-coverage/ReportsHtml.h | 2 | ||||
-rw-r--r-- | rtems-coverage/ReportsText.cc | 4 | ||||
-rw-r--r-- | rtems-coverage/ReportsText.h | 2 | ||||
-rw-r--r-- | rtems-coverage/TraceConverter.cc | 1 | ||||
-rw-r--r-- | rtems-coverage/app_common.cc | 3 | ||||
-rw-r--r-- | rtems-coverage/app_common.h | 3 | ||||
-rw-r--r-- | rtems-coverage/configFile.txt | 13 | ||||
-rw-r--r-- | rtems-coverage/configfile_test.cc | 5 | ||||
-rw-r--r-- | rtems-coverage/covoar.cc | 7 | ||||
-rw-r--r-- | rtems-coverage/covoar.css | 4 | ||||
-rwxr-xr-x | rtems-coverage/do_coverage | 4 | ||||
-rw-r--r-- | rtems-coverage/rtems_config.in | 2 |
18 files changed, 277 insertions, 46 deletions
diff --git a/rtems-coverage/ChangeLog b/rtems-coverage/ChangeLog index 00ad44b..4b9d71e 100644 --- a/rtems-coverage/ChangeLog +++ b/rtems-coverage/ChangeLog @@ -1,3 +1,12 @@ +2010-05-21 Jennifer.Averett@OARcorp.com + + * ConfigFile.cc, Makefile, ReportsBase.cc, ReportsBase.h, + ReportsHtml.cc, ReportsHtml.h, ReportsText.cc, ReportsText.h, + TraceConverter.cc, app_common.cc, app_common.h, configFile.txt, + configfile_test.cc, covoar.cc, covoar.css, do_coverage, + rtems_config.in: Added ProjectName and timestamp to report heading. + Modified configuration to handle spaces in project name. + 2010-05-21 Joel Sherrill <joel.sherrilL@OARcorp.com> * do_coverage, rtems_items.sed: Add report on size of unreferenced diff --git a/rtems-coverage/ConfigFile.cc b/rtems-coverage/ConfigFile.cc index d49198f..22b5554 100644 --- a/rtems-coverage/ConfigFile.cc +++ b/rtems-coverage/ConfigFile.cc @@ -12,6 +12,7 @@ #include "ConfigFile.h" #include <string.h> #include <stdio.h> +#include <ctype.h> namespace Configuration { @@ -31,11 +32,13 @@ namespace Configuration { ) { #define METHOD "FileReader::processFile - " - FILE *in; - char line[256]; - char option[256]; - char value[256]; - int line_no; + FILE * in; + char line[256]; + char option[256]; + char value[256]; + int line_no; + int i; + int j; if ( file == NULL ) { fprintf( stderr, METHOD "NULL filename\n" ); @@ -50,17 +53,89 @@ namespace Configuration { line_no = 0; while (fgets(line, sizeof(line), in) != NULL) { + size_t length; line_no++; - /* Ignore empty lines and comments */ - if (line[0] == '#' || line[0] == '\n') + length = strlen( line ); + if ( line[length - 1] != '\n' ) { + fprintf( + stderr, + "%s: line %d is too long", + file, + line_no + ); + continue; + } + + line[length - 1] = '\0'; + length--; + + /* + * Strip off comments at end of line + * + * LHS = RHS # comment + */ + for (i=0 ; i<length ; i++ ) { + if ( line[i] == '#' ) { + line[i] = '\0'; + length = i; + break; + } + } + + /* + * Strip off trailing white space + */ + for (i=length-1 ; i>=0 && isspace(line[i]) ; i-- ) + ; + + line[i+1] = '\0'; + length = i+1; + + /* Ignore empty lines. We have stripped + * all comments and blanks therefore, only + * an empty string needs to be checked. + */ + if (line[0] == '\0') + continue; + + if (sscanf(line, "%s", option) != 1) { + fprintf( + stderr, + "%s: line %d is invalid: %s\n", + file, + line_no, + line + ); continue; + } + + for (i=0; ((line[i] != '=') && (i<length)); i++) + ; + + if (i == length) { + fprintf( + stderr, + "%s: line %d is invalid: %s\n", + file, + line_no, + line + ); + continue; + } - if (sscanf(line, "%s = %[^ \r\n#]", option, value) != 2) { + i++; + value[0] = '\0'; + while ( isspace(line[i]) ) + i++; + for (j=0; line[i] != '\0'; i++, j++ ) + value[j] = line[i]; + value[j] = '\0'; + if (value[0] == '\0') { fprintf( stderr, - "%s: line %d is invalid: %s", + "%s: line %d is invalid: %s\n", file, line_no, line diff --git a/rtems-coverage/Makefile b/rtems-coverage/Makefile index cd1f751..17678d7 100644 --- a/rtems-coverage/Makefile +++ b/rtems-coverage/Makefile @@ -57,7 +57,8 @@ CONFIGFILE_TEST_OBJS = \ INSTALLED= \ ../bin/qemu-dump-trace \ - ../bin/trace-converter + ../bin/trace-converter \ + ../bin/covoar all: $(PROGRAMS) ${INSTALL_DIR} $(INSTALLED) @@ -71,6 +72,9 @@ ${INSTALL_DIR}: ../bin/trace-converter: trace-converter ${INSTALL_DIR} cp trace-converter ../bin +../bin/covoar: covoar ${INSTALL_DIR} + cp covoar ../bin + # EXECUTABLES qemu-dump-trace: qemu-dump-trace.c ${INSTALL_DIR} $(CXX) -o $(@) qemu-dump-trace.c diff --git a/rtems-coverage/ReportsBase.cc b/rtems-coverage/ReportsBase.cc index fc4b1a1..74e4c9b 100644 --- a/rtems-coverage/ReportsBase.cc +++ b/rtems-coverage/ReportsBase.cc @@ -20,8 +20,9 @@ namespace Coverage { -ReportsBase::ReportsBase(): - reportExtension_m("") +ReportsBase::ReportsBase( time_t timestamp ): + reportExtension_m(""), + timestamp_m( timestamp ) { } @@ -421,6 +422,7 @@ void ReportsBase::WriteSymbolSummaryReport( CloseSymbolSummaryFile( report ); } + void GenerateReports() { typedef std::list<ReportsBase *> reportList_t; @@ -430,9 +432,13 @@ void GenerateReports() std::string reportName; ReportsBase* reports; - reports = new ReportsText(); + time_t timestamp; + + + timestamp = time(NULL); /* get current cal time */ + reports = new ReportsText(timestamp); reportList.push_back(reports); - reports = new ReportsHtml(); + reports = new ReportsHtml(timestamp); reportList.push_back(reports); for (ritr = reportList.begin(); ritr != reportList.end(); ritr++ ) { diff --git a/rtems-coverage/ReportsBase.h b/rtems-coverage/ReportsBase.h index 443eed6..b159dd9 100644 --- a/rtems-coverage/ReportsBase.h +++ b/rtems-coverage/ReportsBase.h @@ -15,6 +15,7 @@ #include <stdint.h> #include <string> +#include <time.h> #include "DesiredSymbols.h" namespace Coverage { @@ -27,7 +28,7 @@ namespace Coverage { class ReportsBase { public: - ReportsBase(); + ReportsBase( time_t timestamp ); ~ReportsBase(); /*! @@ -115,6 +116,11 @@ class ReportsBase { std::string reportExtension_m; /*! + * This member variable contains the timestamp for the report. + */ + time_t timestamp_m; + + /*! * This method Opens a report file and verifies that it opened * correctly. Upon failure NULL is returned. * diff --git a/rtems-coverage/ReportsHtml.cc b/rtems-coverage/ReportsHtml.cc index afab0ad..7d369a9 100644 --- a/rtems-coverage/ReportsHtml.cc +++ b/rtems-coverage/ReportsHtml.cc @@ -33,8 +33,8 @@ namespace Coverage { - ReportsHtml::ReportsHtml(): - ReportsBase() + ReportsHtml::ReportsHtml( time_t timestamp ): + ReportsBase( timestamp ) { reportExtension_m = ".html"; } @@ -64,7 +64,26 @@ namespace Coverage { // Open the file aFile = OpenFile( fileName ); - fprintf( aFile, "<strong>Reports Available</strong>\n" ); + fprintf( + aFile, + "<title>Index</title>\n" + "<div class=\"heading-title\">" + ); + + if (projectName) + fprintf( + aFile, + "%s</br>", + projectName + ); + + fprintf( + aFile, + "Coverage Analysis Reports</div>\n" + "<div class =\"datetime\">%s</div>\n", + asctime( localtime(×tamp_m) ) + ); + fprintf( aFile, "<ul>\n" ); PRINT_ITEM( "Coverage Report", "uncovered" ); @@ -122,9 +141,23 @@ namespace Coverage { fprintf( aFile, "<title>Annotated Report</title>\n" - "<pre class=\"heading-title\">Annotated Report</pre>\n" + "<div class=\"heading-title\">" + ); + + if (projectName) + fprintf( + aFile, + "%s</br>", + projectName + ); + + fprintf( + aFile, + "Annotated Report</div>\n" + "<div class =\"datetime\">%s</div>\n" "<body>\n" - "<pre class=\"code\">\n" + "<pre class=\"code\">\n", + asctime( localtime(×tamp_m) ) ); return aFile; @@ -145,9 +178,22 @@ namespace Coverage { fprintf( aFile, "<title>Branch Report</title\n" - "<pre class=\"heading-title\">Branch Report</pre>\n" + "<div class=\"heading-title\">" + ); + + if (projectName) + fprintf( + aFile, + "%s</br>", + projectName + ); + + fprintf( + aFile, + "Branch Report</div>\n" + "<div class =\"datetime\">%s</div>\n" "<body>\n" - "<table class=\"covoar table-autosort:0 table-autofilter table-stripeclass:covoar-tr-odd" + "<table class=\"covoar table-autosort:0 table-autofilter table-stripeclass:covoar-tr-odd" TABLE_HEADER_CLASS "\">\n" "<thead>\n" "<tr>\n" @@ -159,7 +205,8 @@ namespace Coverage { "<th class=\"table-sortable:default\" align=\"left\">Explanation</th>\n" "</tr>\n" "</thead>\n" - "<tbody>\n" + "<tbody>\n", + asctime( localtime(×tamp_m) ) ); } @@ -179,9 +226,22 @@ namespace Coverage { fprintf( aFile, "<title>Coverage Report</title>\n" - "<pre class=\"heading-title\">Coverage Report</pre>\n" - "<body>\n" - "<table class=\"covoar table-autosort:0 table-autofilter table-stripeclass:covoar-tr-odd" + "<div class=\"heading-title\">" + ); + + if (projectName) + fprintf( + aFile, + "%s</br>", + projectName + ); + + fprintf( + aFile, + "Coverage Report</div>\n" + "<div class =\"datetime\">%s</div>\n" + "<body>\n" + "<table class=\"covoar table-autosort:0 table-autofilter table-stripeclass:covoar-tr-odd" TABLE_HEADER_CLASS "\">\n" "<thead>\n" "<tr>\n" @@ -193,7 +253,9 @@ namespace Coverage { "<th class=\"table-sortable:default\" align=\"left\">Explanation</th>\n" "</tr>\n" "</thead>\n" - "<tbody>\n" + "<tbody>\n", + asctime( localtime(×tamp_m) ) + ); return aFile; @@ -212,7 +274,20 @@ namespace Coverage { fprintf( aFile, "<title> Report</title>\n" - "<pre class=\"heading-title\">No Range Report</pre>\n" + "<div class=\"heading-title\">" + ); + + if (projectName) + fprintf( + aFile, + "%s</br>", + projectName + ); + + fprintf( + aFile, + "No Range Report</div>\n" + "<div class =\"datetime\">%s</div>\n" "<body>\n" "<table class=\"covoar table-autosort:0 table-autofilter table-stripeclass:covoar-tr-odd" TABLE_HEADER_CLASS "\">\n" @@ -221,7 +296,9 @@ namespace Coverage { "<th class=\"table-sortable:default\" align=\"left\">Symbol</th>\n" "</tr>\n" "</thead>\n" - "<tbody>\n" + "<tbody>\n", + asctime( localtime(×tamp_m) ) + ); return aFile; @@ -242,7 +319,20 @@ namespace Coverage { fprintf( aFile, "<title>Size Report</title>\n" - "<pre class=\"heading-title\">Size Report</pre>\n" + "<div class=\"heading-title\">" + ); + + if (projectName) + fprintf( + aFile, + "%s</br>", + projectName + ); + + fprintf( + aFile, + "Size Report</div>\n" + "<div class =\"datetime\">%s</div>\n" "<body>\n" "<table class=\"covoar table-autosort:0 table-autofilter table-stripeclass:covoar-tr-odd" TABLE_HEADER_CLASS "\">\n" @@ -253,7 +343,9 @@ namespace Coverage { "<th class=\"table-sortable:default\" align=\"left\">File</th>\n" "</tr>\n" "</thead>\n" - "<tbody>\n" + "<tbody>\n", + asctime( localtime(×tamp_m) ) + ); return aFile; } @@ -271,7 +363,20 @@ namespace Coverage { fprintf( aFile, "<title>Symbol Summary Report</title>\n" - "<pre class=\"heading-title\">Symbol Summary Report</pre>\n" + "<div class=\"heading-title\">" + ); + + if (projectName) + fprintf( + aFile, + "%s</br>", + projectName + ); + + fprintf( + aFile, + "Symbol Summary Report</div>\n" + "<div class =\"datetime\">%s</div>\n" "<body>\n" "<table class=\"covoar table-autosort:0 table-autofilter table-stripeclass:covoar-tr-odd" TABLE_HEADER_CLASS "\">\n" @@ -290,7 +395,9 @@ namespace Coverage { "<th class=\"table-sortable:numeric\" align=\"center\">Percent</br>Uncovered</br>Bytes</th>\n" "</tr>\n" "</thead>\n" - "<tbody>\n" + "<tbody>\n", + asctime( localtime(×tamp_m) ) + ); return aFile; } diff --git a/rtems-coverage/ReportsHtml.h b/rtems-coverage/ReportsHtml.h index 3951329..bf58988 100644 --- a/rtems-coverage/ReportsHtml.h +++ b/rtems-coverage/ReportsHtml.h @@ -26,7 +26,7 @@ namespace Coverage { class ReportsHtml: public ReportsBase { public: - ReportsHtml(); + ReportsHtml( time_t timestamp ); ~ReportsHtml(); /*! diff --git a/rtems-coverage/ReportsText.cc b/rtems-coverage/ReportsText.cc index efc68e9..29ee4aa 100644 --- a/rtems-coverage/ReportsText.cc +++ b/rtems-coverage/ReportsText.cc @@ -15,8 +15,8 @@ namespace Coverage { -ReportsText::ReportsText(): - ReportsBase() +ReportsText::ReportsText( time_t timestamp ): + ReportsBase( timestamp ) { reportExtension_m = ".txt"; } diff --git a/rtems-coverage/ReportsText.h b/rtems-coverage/ReportsText.h index 35d159b..3e7710d 100644 --- a/rtems-coverage/ReportsText.h +++ b/rtems-coverage/ReportsText.h @@ -25,7 +25,7 @@ namespace Coverage { class ReportsText: public ReportsBase { public: - ReportsText(); + ReportsText( time_t timestamp ); ~ReportsText(); /*! diff --git a/rtems-coverage/TraceConverter.cc b/rtems-coverage/TraceConverter.cc index c9daf4d..a1fd249 100644 --- a/rtems-coverage/TraceConverter.cc +++ b/rtems-coverage/TraceConverter.cc @@ -23,7 +23,6 @@ #include "app_common.h" #include "TargetFactory.h" -const char* dynamicLibrary = NULL; char* progname; void usage() diff --git a/rtems-coverage/app_common.cc b/rtems-coverage/app_common.cc index 0df5c6f..33dacf8 100644 --- a/rtems-coverage/app_common.cc +++ b/rtems-coverage/app_common.cc @@ -32,6 +32,9 @@ bool Verbose = false; const char* outputDirectory = "."; bool BranchInfoAvailable = false; Target::TargetBase* TargetInfo = NULL; +const char* dynamicLibrary = NULL; +const char* projectName = NULL; + bool FileIsNewer( const char *f1, diff --git a/rtems-coverage/app_common.h b/rtems-coverage/app_common.h index 97f9e4c..b90ee07 100644 --- a/rtems-coverage/app_common.h +++ b/rtems-coverage/app_common.h @@ -18,6 +18,9 @@ extern bool Verbose; extern const char* outputDirectory; extern bool BranchInfoAvailable; extern Target::TargetBase* TargetInfo; +extern const char* dynamicLibrary; +extern const char* projectName; + bool FileIsNewer( const char *f1, const char *f2 ); bool FileIsReadable( const char *f1 ); diff --git a/rtems-coverage/configFile.txt b/rtems-coverage/configFile.txt index eafa782..27832a2 100644 --- a/rtems-coverage/configFile.txt +++ b/rtems-coverage/configFile.txt @@ -3,11 +3,22 @@ # # $Id$ # + +projectName = RTEMS 4.10 + verbose = no verbose verbose yes -bad_option no +bad_option = no + +verbose = yes # comment + +verbose = no # comment + verbose = yes +# next line is filled with spaces + + # comment diff --git a/rtems-coverage/configfile_test.cc b/rtems-coverage/configfile_test.cc index f2ab3e4..e15b7d2 100644 --- a/rtems-coverage/configfile_test.cc +++ b/rtems-coverage/configfile_test.cc @@ -6,8 +6,9 @@ #include <stdio.h> Configuration::Options_t Options[] = { - { "verbose", NULL }, - { NULL, NULL } + { "projectName", NULL }, + { "verbose", NULL }, + { NULL, NULL } }; int main( diff --git a/rtems-coverage/covoar.cc b/rtems-coverage/covoar.cc index a2d2b33..5b6478f 100644 --- a/rtems-coverage/covoar.cc +++ b/rtems-coverage/covoar.cc @@ -34,7 +34,6 @@ std::list<std::string> coverageFileNames; int coverageExtensionLength = 0; Coverage::CoverageFormats_t coverageFormat; Coverage::CoverageReaderBase* coverageReader = NULL; -const char* dynamicLibrary = NULL; char* executable = NULL; const char* executableExtension = NULL; int executableExtensionLength = 0; @@ -65,6 +64,7 @@ void usage() " -1 EXECUTABLE - name of executable to get symbols from\n" " -e EXE_EXTENSION - extension of the executables to analyze\n" " -c COVERAGEFILE_EXTENSION - extension of the coverage files to analyze\n" + " -p PROJECT_NAME - name of the project\n" " -C ConfigurationFileName - name of configuration file\n" " -O Output_Directory - name of output directory (default=." "\n", @@ -91,6 +91,7 @@ Configuration::Options_t Options[] = { { "coverageExtension", NULL }, { "target", NULL }, { "verbose", NULL }, + { "projectName", NULL }, { NULL, NULL } }; @@ -127,6 +128,7 @@ void check_configuration(void) GET_STRING( "outputDirectory", outputDirectory ); GET_STRING( "executableExtension", executableExtension ); GET_STRING( "coverageExtension", coverageFileExtension ); + GET_STRING( "projectName", projectName ); // Now calculate some values if ( coverageFileExtension ) @@ -159,7 +161,7 @@ int main( // progname = argv[0]; - while ((opt = getopt(argc, argv, "C:1:L:e:c:E:f:s:T:O:v")) != -1) { + while ((opt = getopt(argc, argv, "C:1:L:e:c:E:f:s:T:O:p:v")) != -1) { switch (opt) { case 'C': CoverageConfiguration->processFile( optarg ); break; case '1': singleExecutable = optarg; break; @@ -172,6 +174,7 @@ int main( case 'T': target = optarg; break; case 'O': outputDirectory = optarg; break; case 'v': Verbose = true; break; + case 'p': projectName = optarg; break; default: /* '?' */ usage(); exit( -1 ); diff --git a/rtems-coverage/covoar.css b/rtems-coverage/covoar.css index 125e04f..e5be14e 100644 --- a/rtems-coverage/covoar.css +++ b/rtems-coverage/covoar.css @@ -233,7 +233,7 @@ table.altstripe tr.alternate2 { .heading-title { text-align: center; color: rgb(0,0,0); - font-size: 4.0em; + font-size: 3.5em; font-weight: bold; line-height: 0.9; padding-top: 5px; @@ -244,7 +244,7 @@ table.altstripe tr.alternate2 { .datetime { color: rgb(55,55,55); - font-size: 0.8em; + font-size: 1.0em; padding-top: 5px; padding-left: 0px; text-align: center; diff --git a/rtems-coverage/do_coverage b/rtems-coverage/do_coverage index bd7bbe8..4133a9d 100755 --- a/rtems-coverage/do_coverage +++ b/rtems-coverage/do_coverage @@ -42,6 +42,7 @@ usage: $progname [ -opts ] -f -- publish the results to ftp site (default=no) -t -- save the results locally (default=no) -O -- output directory (default=BSP-CONF-YYYYMMDD-HHMM) + -p -- project name (default empty) Notes: + There are currently NO checks at each step to determine if the previous steps were performed!!! @@ -347,13 +348,14 @@ generate_reports() -e "s,@OUTPUT_DIRECTORY@,${results_dir}," \ -e "s/@EXECUTABLE_EXTENSION@/exe/" \ -e "s/@COVERAGE_EXTENSION@/${RTEMSEXT}.${COVEXT}/" \ + -e "s/@PROJECT_NAME@/RTEMS ${RTEMS_VERSION}/" \ <${COVBASE}/rtems_config.in \ >${BASEDIR}/${BSP}-tests/config check_status $? "Unable to generate COVOAR config file" rm -rf ${results_dir} mkdir ${results_dir} - ${COVBASE}/covoar -C ${BASEDIR}/${BSP}-tests/config \ + covoar -C ${BASEDIR}/${BSP}-tests/config \ *.exe > ${results_dir}/summary.txt check_status $? "covoar failed" diff --git a/rtems-coverage/rtems_config.in b/rtems-coverage/rtems_config.in index d0c61f1..3a7bf18 100644 --- a/rtems-coverage/rtems_config.in +++ b/rtems-coverage/rtems_config.in @@ -25,4 +25,6 @@ coverageExtension = @COVERAGE_EXTENSION@ # This is the extension on the executable files. executableExtension = @EXECUTABLE_EXTENSION@ +# This is the project name. +projectName = @PROJECT_NAME@ |