tracking iv&v analysis through multiple fsw builds
DESCRIPTION
Tracking IV&V Analysis Through Multiple FSW Builds. Jacob T Cox [email protected]. Agenda. An algorithm to remap lines in text file versions Several problems this may help solve Flexelint efficiencies Code assessment tracking Questions. - PowerPoint PPT PresentationTRANSCRIPT
Agenda
• An algorithm to remap lines in text file versions
• Several problems this may help solve– Flexelint efficiencies– Code assessment tracking
• Questions
2
Algorithm to Map Source Files in Consecutive Builds of Code
Using the Unix ‘diff‘ utility it is possible to map lines in text files from one version to another version of the same file.
• Shipped with version 5 of Unix in 1970• Uses the Hunt–McIlroy algorithm• Produces a format that ‘ed’ can use to
recreate the original from the current file version
3
Diff Utility Output20,21c20,2151d5054,59c53,5562,63c58,59556d551560a556562c558,569570,574c577,578577,579c581581c583,584589,592d591596,607d594682d668796,798d781814c797845c828
20,21c20,21< * \version $Revision: 180847 $< * \date $Date: 2011-07-15 15:10:34 -0700 (Fri, 15 Jul 2011) $---> * \version $Revision: 204123 $> * \date $Date: 2012-01-10 22:13:26 -0800 (Tue, 10 Jan 2012) $50a51> I32 j ;53,55c54,59< for (i=0 ; i<DMS_PDP_NUM_PENDING ; i++) {< if (dms_state->hinfo[i].cix == cix) {< break ;---> > for (i=0 ; i<DMS_PDP_NUM_RTYPE ; i++) {> for (j=0 ; j<DMS_PDP_NUM_PENDING ; j++) {> if (dms_state->hinfo[i][j].cix == cix) {> return &dms_state->hinfo[i][j] ;> }58,59c62,63< FSW_ASSERT_1(i < DMS_PDP_NUM_PENDING, cix) ;< return &dms_state->hinfo[i] ;---> FSW_ASSERT_1(FALSE, cix) ;> return NULL ;551a556> I32 rt ;556d560< phi = NULL ;
Diff Output Useful Diff Output
4
Explicit Changespluto:experiment> ../bin/codeFragment prev/dms/dms_pdp.c 48 65 48: 49: STATIC DmsPdpHandle * dms_pdp_get_handle(DmsCatIndex cix) { 50: I32 i ; 51: 52: FSW_ASSERT_1(cix < DMS_CAPACITY, cix) ; 53: for (i=0 ; i<DMS_PDP_NUM_PENDING ; i++) { 54: if (dms_state->hinfo[i].cix == cix) { 55: break ; 56: } 57: } 58: FSW_ASSERT_1(i < DMS_PDP_NUM_PENDING, cix) ; 59: return &dms_state->hinfo[i] ; 60: } 61: 62: DmsPdpInfo const * dms_pdp_get_info(DmsCatIndex cix) { 63: DmsPdpHandle const * phi ; 64: 65: phi = dms_pdp_get_handle(cix) ;
pluto:experiment> ../bin/codeFragment curr/dms/dms_pdp.c 48 65 48: 49: STATIC DmsPdpHandle * dms_pdp_get_handle(DmsCatIndex cix) { 50: I32 i ; 51: I32 j ; 52: 53: FSW_ASSERT_1(cix < DMS_CAPACITY, cix) ; 54: 55: for (i=0 ; i<DMS_PDP_NUM_RTYPE ; i++) { 56: for (j=0 ; j<DMS_PDP_NUM_PENDING ; j++) { 57: if (dms_state->hinfo[i][j].cix == cix) { 58: return &dms_state->hinfo[i][j] ; 59: } 60: } 61: } 62: FSW_ASSERT_1(FALSE, cix) ; 63: return NULL ; 64: } 65: 66: DmsPdpInfo const * dms_pdp_get_info(DmsCatIndex cix) { 67: DmsPdpHandle const * phi ; 68: 69: phi = dms_pdp_get_handle(cix) ;
Red text is changed text5
The Algorithm• Parse the diff file lines and store on a list
• convert Line Number( target line) {• for each parsed line in the diff file {• determine a trigger line in the current files to update line counts
• set skips based on whether the diff line is add, change or delete • if target occurs prior to next change, return calculated value• move to trigger line• if at target then return• perform skips• if past target then it is in a deleted section and does not map• }• The target is past the last diff line so calculate and return• }
6
Assumptions
• Lines do not move from file to file• Lines do not change relative order within a file• Internal changes do not make a previous false
positive a true positive• Noise from randomly matching lines will be
inconsequential
7
Aids in Solutions to
• Identify repeated Static Code Analysis warnings through consecutive builds
• Identifying fixed issues in a new build• Identify where changes in software source
have invalidated prior implementation verification analysis
• Identify source elements that have no reference in project documentation
8
Common component
Mapping lines of source code to their equivalent in successive builds of code.
• Given a line of code in a {new, previous} build, what line is it in the {previous, new} build.
File.c…202 int I;203204 if (I = j( a, b)) {…214 }
File.c…213 int I;214215 if (I = j( a, b)) {…225 }9.4.3
9.4.4
9
Some Possible Uses
10
Repeated Static Code Analysis Warnings
• Klocwork can show new warnings on consecutive builds
• Klocwork can show when an issue was fixed• It is difficult to show new warnings for
consecutive Flexelint builds
11
Finding if a Warning was in the Previous Build
File.c…202 int I;203204 if (I = j( a, b)) {…214 }
File.c…213 int I;214215 if (I = j( a, b)) {…225 }9.4.3
9.4.5
Error 313
fexelint finds error 313 on line 215.
12
Finding if a Warning was in the Previous Build Ctd.
File.c…202 int I;203204 if (I = j( a, b)) {…214 }
File.c…213 int I;214215 if (I = j( a, b)) {…225 }9.4.3
9.4.5
Error 313
Use the algorithm to see what the equivalent to line 215 was in the previous build
13
Finding if a Warning was in the Previous Build Ctd.
File.c…202 int I;203204 if (I = j( a, b)) {…214 }
File.c…213 int I;214215 if (I = j( a, b)) {…225 }9.4.3
9.4.5
Error 313
fexelint has the same error on line 204 of the previous Build which is equivalent to line 215.
Error 313
14
Identifying a Fixed Warnings
File.c…202 int I;203204 if (I = j( a, b)) {…214 }
File.c…213 float I;214215 if (I = j( a, b)) {…225 }9.4.3
9.4.5
The error on line 204 of the previous Build no longer exists. If an issue had been written it may be closed.
Error 313
15
Fexelint Warningscurr\dms\dms_pdp.c 274 Warning 570 "Loss of sign (arg. no. 2) (int to unsigned int)"curr\dms\dms_pdp.c 289 Info 737 "Loss of sign in promotion from int to unsigned int"curr\dms\dms_pdp.c 289 Info 737 "Loss of sign in promotion from int to unsigned int"curr\dms\dms_pdp.c 289 Info 713 "Loss of precision (assignment) (unsigned int to int)"curr\dms\dms_pdp.c 297 Warning 570 "Loss of sign (arg. no. 2) (int to unsigned int)"curr\dms\dms_pdp.c 305 Warning 570 "Loss of sign (arg. no. 2) (int to unsigned int)"curr\dms\dms_pdp.c 346 Warning 570 "Loss of sign (arg. no. 2) (int to unsigned int)"curr\dms\dms_pdp.c 360 Warning 570 "Loss of sign (arg. no. 2) (int to unsigned int)"curr\dms\dms_pdp.c 375 Warning 570 "Loss of sign (arg. no. 2) (int to unsigned int)"curr\dms\dms_pdp.c 377 Info 713 "Loss of precision (assignment) (unsigned int to int)"curr\dms\dms_pdp.c 377 Warning 613 "Possible use of null pointer 'p_dpo_id' in argument to operator 'unary *' …"curr\dms\dms_pdp.c 327 Info 831 "Reference cited in prior message"curr\dms\dms_pdp.c 378 Warning 613 "Possible use of null pointer 'p_dpo_length' in argument to operator 'unary *' …"curr\dms\dms_pdp.c 328 Info 831 "Reference cited in prior message"curr\dms\dms_pdp.c 379 Warning 613 "Possible use of null pointer 'p_dp_offset' in argument to operator 'unary …"curr\dms\dms_pdp.c 329 Info 831 "Reference cited in prior message"curr\dms\dms_pdp.c 406 Warning 570 "Loss of sign (arg. no. 2) (int to unsigned int)"curr\dms\dms_pdp.c 417 Warning 570 "Loss of sign (arg. no. 2) (int to unsigned int)"curr\dms\dms_pdp.c 417 Info 717 "do ... while(0);"curr\dms\dms_pdp.c 430 Warning 570 "Loss of sign (arg. no. 2) (int to unsigned int)"curr\dms\dms_pdp.c 430 Info 717 "do ... while(0);"
16
Fexelint Warnings
Flex FilterAlgorithm
Previous Warnings
Diff File
Current Warnings
New Warnings
17
Results
• A test on the DMS module for MSL version 9.4.2 and 9.4.3 gave 69 warnings from an initial 5,846.
• With 44,864 C lines of code• Warning with equivalent line numbers and the
same error code were removed. {I’m sure some folks can come up with improved heuristics but it seems to work well right now.}
18
New Topic:Assessment Tracking
19
Code Assessments in MSL
• The project had a schedule relating requirements to the build in which they were to be implemented
• The IV&V project verified that the requirements were implemented in the build
• This assessment including the location was captured in clear text
• The locations could not be kept current as new builds were delivered
20
Tracking Code Assessments
File.c…202 int I;203204 if (I = j( a, b)) {…214 }
File.c…213 int I;214215 if (I = j( a, b)) {…225 }9.4.3
9.4.5
Assessment
Semantic assessment that a requirement is implemented on line 204.
21
Tracking Code Assessments Ctd.
File.c…202 int I;203204 if (I = j( a, b)) {…214 }
File.c…213 int I;214215 if (I = j( a, b)) {…225 }9.4.3
9.4.5
Assessment
Use algorithm to find line 204 in the next build.
22
Tracking Code Assessments Ctd
File.c…202 int I;203204 if (I = j( a, b)) {…214 }
File.c…213 int I;214215 if (I = j( a, b)) {…225 }9.4.3
9.4.5
Assessment
Assessment now maps to line 215 in the new build.
23
Identifying an Assessment has been Invalidated
File.c…202 int I;203204 if (I = j( a, b)) {…214 }
File.c…213 int I;214215 if (I = k( a, b)) {…225 }9.4.3
9.4.5
Assessment
Changes in software invalidates the assessment.
24
Moving Assessments ForwardBuild 1
A new build is delivered
Moving Assessments Forward
Assessment
Build 1
Assessment
Assessment
Assessments are made
Moving Assessments Forward
Assessment
AssessmentAssessment
Assessment
Assessment
Assessment
AssessmentAssessment
AssessmentAssessment
Build 1Build 2
27A new build arrives
Moving Assessments Forward
Assessment
AssessmentAssessment
Assessment
Assessment
Assessment
AssessmentAssessment
AssessmentAssessment
Assessment
Assessment
Assessment
Build 1Build 2
28Use algorithm to bring assessments forward
Moving Assessments Forward
Assessment
AssessmentAssessment
Assessment
Assessment
Assessment
AssessmentAssessment
AssessmentAssessment
Assessment
Assessment
Assessment Assessment
Assessment
Assessment
AssessmentAssessment
Build 1Build 2
29Make more assessments
Moving Assessments Forward
Assessment
AssessmentAssessment
Assessment
Assessment
Assessment
AssessmentAssessment
AssessmentAssessment
Assessment
Assessment
AssessmentAssessment
Assessment
Assessment
Assessment
AssessmentAssessment
AssessmentAssessment
Build 1Build 2
Build 3
30
Moving Assessments Forward
Assessment
AssessmentAssessment
Assessment
Assessment
Assessment
AssessmentAssessment
AssessmentAssessment
Assessment
Assessment
AssessmentAssessment
Assessment
Assessment
Assessment
AssessmentAssessment
AssessmentAssessment
Assessment
Assessment
Assessment Assessment
Assessment
Assessment
AssessmentAssessment
Build 1Build 2
Build 3
31
Moving Assessments Forward
Assessment
AssessmentAssessment
Assessment
Assessment
Assessment
AssessmentAssessment
AssessmentAssessment
Assessment
Assessment
AssessmentAssessment
Assessment
Assessment
Assessment
AssessmentAssessment
AssessmentAssessment
Assessment
Assessment
AssessmentAssessment
Assessment
Assessment
Assessment
AssessmentAssessment
AssessmentAssessment
Build 1Build 2
Build 3
32
Identifying Un-Assessed Software
Final BuildAssessment
Assessment
AssessmentAssessment
Assessment
Assessment
Assessment
AssessmentAssessment
AssessmentAssessment
Un-assessed Software
33
To Make This Work
• A standard way to store assessments• A way to associate assessments with source
code• A process to move the assessments forward
34
Finale
• The ability to remap assessments or warnings to consecutive builds could be useful.
35
Questions?
36