Changeset f9a4b2c in rtems-tools
- Timestamp:
- 08/26/17 08:15:58 (6 years ago)
- Branches:
- 5, master
- Children:
- cb0677b
- Parents:
- 4600903
- git-author:
- Cillian O'Donnell <cpodonnell8@…> (08/26/17 08:15:58)
- git-committer:
- Chris Johns <chrisj@…> (08/29/17 08:06:24)
- Location:
- tester/covoar
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
tester/covoar/covoar.cc
r4600903 rf9a4b2c 81 81 82 82 #define PrintableString(_s) \ 83 ((!(_s)) ? "NOT SET" : (_s)) 84 85 /* 86 * Configuration File Support 87 */ 88 #include "ConfigFile.h" 89 Configuration::FileReader *CoverageConfiguration; 90 Configuration::Options_t Options[] = { 91 { "explanations", NULL }, 92 { "format", NULL }, 93 { "symbolsFile", NULL }, 94 { "outputDirectory", NULL }, 95 { "executableExtension", NULL }, 96 { "coverageExtension", NULL }, 97 { "gcnosFile", NULL }, 98 { "target", NULL }, 99 { "verbose", NULL }, 100 { "projectName", NULL }, 101 { NULL, NULL } 102 }; 103 104 bool isTrue(const char *value) 105 { 106 if ( !value ) return false; 107 if ( !strcmp(value, "true") ) return true; 108 if ( !strcmp(value, "TRUE") ) return true; 109 if ( !strcmp(value, "yes") ) return true; 110 if ( !strcmp(value, "YES") ) return true; 111 return false; 112 } 113 114 #define GET_BOOL(_opt, _val) \ 115 if (isTrue(CoverageConfiguration->getOption(_opt))) \ 116 _val = true; 117 118 #define GET_STRING(_opt, _val) \ 119 do { \ 120 const char *_t; \ 121 _t = CoverageConfiguration->getOption(_opt); \ 122 if ( _t ) _val = _t; \ 123 } while(0) 124 125 126 void check_configuration(void) 127 { 128 GET_BOOL( "verbose", Verbose ); 129 130 GET_STRING( "format", format ); 131 GET_STRING( "target", target ); 132 GET_STRING( "explanations", explanations ); 133 GET_STRING( "symbolsFile", symbolsFile ); 134 GET_STRING( "outputDirectory", outputDirectory ); 135 GET_STRING( "executableExtension", executableExtension ); 136 GET_STRING( "coverageExtension", coverageFileExtension ); 137 GET_STRING( "gcnosFile", gcnosFileName ); 138 GET_STRING( "projectName", projectName ); 139 140 // Now calculate some values 141 if ( coverageFileExtension ) 142 coverageExtensionLength = strlen( coverageFileExtension ); 143 144 if ( executableExtension ) 145 executableExtensionLength = strlen( executableExtension ); 146 147 if ( format ) 148 coverageFormat = Coverage::CoverageFormatToEnum( format ); 149 } 83 ((!(_s)) ? "NOT SET" : (_s)) 150 84 151 85 static void … … 198 132 rld::process::tempfile err( ".err" ); 199 133 bool debug = false; 134 std::string option; 200 135 201 136 setup_signals(); 202 137 203 CoverageConfiguration = new Configuration::FileReader(Options);204 205 138 // 206 139 // Process command line options. … … 208 141 progname = argv[0]; 209 142 210 while ((opt = getopt(argc, argv, " C:1:L:e:c:g:E:f:s:T:O:p:v:d")) != -1) {143 while ((opt = getopt(argc, argv, "1:L:e:c:g:E:f:s:T:O:p:v:d")) != -1) { 211 144 switch (opt) { 212 case 'C': CoverageConfiguration->processFile( optarg ); break;213 145 case '1': singleExecutable = optarg; break; 214 146 case 'L': dynamicLibrary = optarg; break; … … 229 161 } 230 162 } 231 232 // Do not trust any arguments until after this point. 233 check_configuration(); 234 235 // XXX We need to verify that all of the needed arguments are non-NULL. 163 try 164 { 165 /* 166 * Validate inputs. 167 */ 168 169 /* 170 * Target name must be set. 171 */ 172 if ( !target ) { 173 option = "target -T"; 174 throw option; 175 } 176 177 /* 178 * Validate simulator format. 179 */ 180 if ( !format ) { 181 option = "format -f"; 182 throw option; 183 } 184 185 /* 186 * Has path to explanations.txt been specified. 187 */ 188 if ( !explanations ) { 189 option = "explanations -E"; 190 throw option; 191 } 192 193 /* 194 * Has coverage file extension been specified. 195 */ 196 if ( !coverageFileExtension ) { 197 option = "coverage extension -c"; 198 throw option; 199 } 200 201 /* 202 * Has executable extension been specified. 203 */ 204 if ( !executableExtension ) { 205 option = "executable extension -e"; 206 throw option; 207 } 208 209 /* 210 * Check for project name. 211 */ 212 if ( !projectName ) { 213 option = "project name -p"; 214 throw option; 215 } 216 } 217 catch( std::string option ) 218 { 219 std::cout << "error missing option: " + option << std::endl; 220 usage(); 221 throw; 222 } 236 223 237 224 // If a single executable was specified, process the remaining … … 362 349 363 350 // 364 // Validate inputs.365 //366 367 // Target name must be set.368 if (!target) {369 fprintf( stderr, "ERROR: target not specified\n" );370 usage();371 exit(-1);372 }373 374 // Validate format.375 if (!format) {376 fprintf( stderr, "ERROR: coverage format report not specified\n" );377 usage();378 exit(-1);379 }380 381 // Validate that we have a symbols of interest file.382 if (!symbolsFile) {383 fprintf( stderr, "ERROR: symbols of interest file not specified\n" );384 usage();385 exit(-1);386 }387 388 //389 351 // Create data to support analysis. 390 352 // -
tester/covoar/wscript
r4600903 rf9a4b2c 69 69 bld.stlib(target = 'ccovoar', 70 70 source = ['app_common.cc', 71 'ConfigFile.cc',72 71 'CoverageFactory.cc', 73 72 'CoverageMap.cc',
Note: See TracChangeset
for help on using the changeset viewer.