Changeset 9736
- Timestamp:
- Oct 24, 2006, 2:16:33 PM (20 years ago)
- Location:
- trunk/psLib
- Files:
-
- 7 edited
-
src/types/parse_gcov-out.c (modified) (5 diffs)
-
src/types/psMetadata.c (modified) (3 diffs)
-
src/types/psMetadata.h (modified) (2 diffs)
-
src/types/psMetadataConfig.c (modified) (6 diffs)
-
test/types/Makefile.am (modified) (1 diff)
-
test/types/execute_tap (modified) (2 diffs)
-
test/types/tap_psMetadata_copying.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/types/parse_gcov-out.c
r9084 r9736 76 76 N++; 77 77 78 average = average / N;78 average = average / sum; 79 79 80 80 output = fopen("Coverage-Report.txt", "w"); … … 89 89 } 90 90 91 void parseINT(const char *nums )91 void parseINT(const char *nums, float percent) 92 92 { 93 93 sum += atoi(nums); 94 average += (float)((int)(percent * atoi(nums))); 94 95 } 95 96 96 voidparseDBL(const char *nums)97 float parseDBL(const char *nums) 97 98 { 98 99 char temp[7]; 99 100 int i = 0; 100 101 int j = 9; 102 float out = 0.0; 101 103 while (nums[j] != '%') { 102 104 temp[i] = nums[j]; … … 104 106 j++; 105 107 } 106 average += (float)atof(temp); 108 // average += (float)atof(temp); 109 out = (float)atof(temp); 110 return out; 107 111 } 108 112 … … 117 121 strcat(outStr, out); 118 122 int i; 123 float numLines = 0.0; 119 124 while ( fscanf(in, "%s", currentStr) != EOF) { 120 125 if ( strncmp(currentStr, searchStr, 99) == 0 ) { … … 122 127 if (i == 1) { 123 128 fscanf(in, "%s", out); 124 parseDBL(out);129 numLines = parseDBL(out); 125 130 sprintf(currentStr, "%-16s", out); 126 131 } else if ( i == 3) { 127 132 fscanf(in, "%s", out); 128 parseINT(out );133 parseINT(out, numLines); 129 134 sprintf(currentStr, "%s", out); 130 135 } else { -
trunk/psLib/src/types/psMetadata.c
r9720 r9736 12 12 * @author Ross Harman, MHPCC 13 13 * 14 * @version $Revision: 1.14 4$ $Name: not supported by cvs2svn $15 * @date $Date: 2006-10-2 4 01:15:47$14 * @version $Revision: 1.145 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2006-10-25 00:16:33 $ 16 16 * 17 17 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 425 425 return NULL; 426 426 } 427 bool errorOccurred = false; 427 428 bool outAlloced = false; 428 429 if (out == NULL) { … … 447 448 psErrorStackPrint(stderr, "Error copying %s (%s) in the metadata\n", inItem->name, 448 449 inItem->comment); 449 psFree(newItem);450 psFree(iter);451 450 if (outAlloced) { 452 451 psFree(out); 452 psFree(newItem); 453 psFree(iter); 454 return NULL; 455 } else { 456 errorOccurred = true; 453 457 } 454 return NULL;455 458 } 456 459 psFree(newItem); // Drop reference 457 460 } 458 461 psFree(iter); 462 463 if (errorOccurred) { 464 return NULL; 465 } 466 459 467 return out; 460 468 } 461 462 469 463 470 // may need to extend this to change the keyname in the copy -
trunk/psLib/src/types/psMetadata.h
r9578 r9736 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.9 1$ $Name: not supported by cvs2svn $14 * @date $Date: 2006-10- 14 03:50:28$13 * @version $Revision: 1.92 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2006-10-25 00:16:33 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 385 385 * 386 386 * Creates a new copy of all the psMetadataItems in the psMetadata collection, in, and 387 * returns them in out, or creates a new container if out is NULL. 387 * returns them in out, or creates a new container if out is NULL. If an error occurs, 388 * NULL is returned but out may still have been updated if it is non-NULL. 388 389 * 389 390 * @return psMetadata*: the copy of the psMetadata container. -
trunk/psLib/src/types/psMetadataConfig.c
r9730 r9736 10 10 * @author Eric Van Alst, MHPCC 11 11 * 12 * @version $Revision: 1.9 6$ $Name: not supported by cvs2svn $13 * @date $Date: 2006-10-2 4 22:52:56$12 * @version $Revision: 1.97 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2006-10-25 00:16:33 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 20 20 #include <ctype.h> 21 21 #include <limits.h> 22 #include <inttypes.h>23 22 #include <strings.h> 24 23 #include <sys/mman.h> 25 #include <sys/types.h>26 #include <sys/stat.h>27 24 #include <fcntl.h> 28 25 #include <unistd.h> 29 26 30 #include "psAbort.h"31 #include "psType.h"32 #include "psMemory.h"33 #include "psError.h"34 #include "psString.h"35 #include "psList.h"36 #include "psHash.h"37 #include "psVector.h"38 #include "psMetadata.h"39 27 #include "psMetadataConfig.h" 40 28 #include "psAssert.h" 29 //#include <sys/types.h> 30 //#include <sys/stat.h> 31 //#include <inttypes.h> 32 //#include "psHash.h" 33 //#include "psMetadata.h" 34 //#include "psAbort.h" 35 //#include "psType.h" 36 37 //#include "psMemory.h" 38 //#include "psError.h" 39 //#include "psString.h" 40 //#include "psList.h" 41 //#include "psVector.h" 41 42 42 43 … … 1167 1168 if (!(fd = open(filename, O_RDONLY))) { 1168 1169 // XXX really should return strerror() here 1169 psError(PS_ERR_IO, true, _("Failed to open file '%s'. Check if it exists and it has the proper permissions."), filename); 1170 psError(PS_ERR_IO, true, 1171 _("Failed to open file '%s'. Check if it exists and it has the proper " 1172 "permissions."), filename); 1170 1173 return NULL; 1171 1174 } … … 1562 1565 PS_ASSERT_PTR_NON_NULL(md, NULL); 1563 1566 PS_ASSERT_PTR_NON_NULL(filename, NULL); 1567 FILE *file; 1568 if ( !(file = fopen(filename, "w")) ) { 1569 psError(PS_ERR_IO, true, 1570 "Failed to open specified file, %s\n", filename); 1571 return false; 1572 } 1564 1573 psString fileString = NULL; 1565 1574 fileString = psMetadataConfigFormat(md); … … 1569 1578 return false; 1570 1579 } 1571 FILE *file;1572 if ( !(file = fopen(filename, "w")) ) {1573 psError(PS_ERR_IO, true,1574 "Failed to open specified file, %s\n", filename);1575 psFree(fileString);1576 return false;1577 }1578 1580 fprintf(file, "%s", fileString); 1579 1581 fclose(file); … … 1586 1588 { 1587 1589 PS_ASSERT_PTR_NON_NULL(md, false); 1590 PS_ASSERT_PTR_NON_NULL(stream, false); 1591 if (fprintf(stream, "\n") <= 0) { 1592 psError(PS_ERR_IO, false, 1593 "Unable to write to specified file."); 1594 return false; 1595 } 1588 1596 1589 1597 psString str = psMetadataConfigFormat(md); -
trunk/psLib/test/types/Makefile.am
r9143 r9736 29 29 tap_psBitSet_all \ 30 30 tap_psList_all \ 31 tap_psLookupTable_all 31 tap_psLookupTable_all \ 32 tap_psMetadataConfig_output \ 33 tap_psMetadataConfig_input 32 34 33 35 if BUILD_TESTS -
trunk/psLib/test/types/execute_tap
r9143 r9736 1 make 1 make test 2 2 ./tap_psArray_all 3 3 ./tap_psListIterator … … 18 18 ./tap_psList_all 19 19 ./tap_psLookupTable_all 20 ./tap_psMetadataConfig_output 21 ./tap_psMetadataConfig_input -
trunk/psLib/test/types/tap_psMetadata_copying.c
r9720 r9736 23 23 int main(void) 24 24 { 25 plan_tests(3 4);25 plan_tests(35); 26 26 27 27 diag("psMetadataCopy and psMetadataItemCopy tests"); … … 59 59 out = NULL; 60 60 } 61 //Return NULL for attempt to copy item of unsupported data type 61 //Return NULL for attempt to copy item of unsupported data type - NULL out metadata 62 psMetadataItem *notype = NULL; 62 63 { 63 64 in = psMetadataAlloc(); 64 65 psMetadataAddS32(in, PS_LIST_HEAD, "S32", 0, "", 1); 65 psMetadataItem *notype = psMetadataGet(in, PS_LIST_HEAD); 66 // notype->type = PS_DATA_METADATA_MULTI + 1000; 66 notype = psMetadataGet(in, PS_LIST_HEAD); 67 67 notype->type = -1; 68 psFree(outTest); 69 outTest = NULL; 68 outTest = psMetadataCopy(out, in); 69 ok( outTest == NULL, 70 "psMetadataCopy: return NULL for metadata with item of bad type."); 71 psFree(out); 72 out = NULL; 73 } 74 //Return NULL for attempt to copy item of unsupported data type - allocated out metadata 75 { 76 out = psMetadataAlloc(); 77 psMetadataAddS32(out, PS_LIST_TAIL, "S32", 0, "", 2); 70 78 outTest = psMetadataCopy(out, in); 71 79 ok( outTest == NULL, 72 80 "psMetadataCopy: return NULL for metadata with item of bad type."); 73 81 notype->type = PS_DATA_S32; 82 psFree(out); 83 out = NULL; 74 84 psFree(in); 75 85 in = NULL; 76 psFree(out);77 out = NULL;78 86 } 79 87
Note:
See TracChangeset
for help on using the changeset viewer.
