Download presentation
Presentation is loading. Please wait.
Published byAudra Lester Modified over 8 years ago
1
Tracking IV&V Analysis Through Multiple FSW Builds Jacob T Cox Jacob.t.cox@ivv.nasa.gov 1
2
Agenda An algorithm to remap lines in text file versions Several problems this may help solve – Flexelint efficiencies – Code assessment tracking Questions 2
3
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
4
Diff Utility Output 20,21c20,21 51d50 54,59c53,55 62,63c58,59 556d551 560a556 562c558,569 570,574c577,578 577,579c581 581c583,584 589,592d591 596,607d594 682d668 796,798d781 814c797 845c828 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++) { 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) ; hinfo[i] ; --- > FSW_ASSERT_1(FALSE, cix) ; > return NULL ; 551a556 > I32 rt ; 556d560 < phi = NULL ; Diff Output Useful Diff Output 4
5
Explicit Changes pluto: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 text 5
6
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
7
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
8
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
9
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; 203 204 if (I = j( a, b)) { … 214 } File.c … 213 int I; 214 215 if (I = j( a, b)) { … 225 } 9.4.3 9.4.4 9
10
Some Possible Uses 10
11
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
12
Finding if a Warning was in the Previous Build File.c … 202 int I; 203 204 if (I = j( a, b)) { … 214 } File.c … 213 int I; 214 215 if (I = j( a, b)) { … 225 } 9.4.3 9.4.5 Error 313 fexelint finds error 313 on line 215. 12
13
Finding if a Warning was in the Previous Build Ctd. File.c … 202 int I; 203 204 if (I = j( a, b)) { … 214 } File.c … 213 int I; 214 215 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
14
Finding if a Warning was in the Previous Build Ctd. File.c … 202 int I; 203 204 if (I = j( a, b)) { … 214 } File.c … 213 int I; 214 215 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
15
Identifying a Fixed Warnings File.c … 202 int I; 203 204 if (I = j( a, b)) { … 214 } File.c … 213 float I; 214 215 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
16
Fexelint Warnings curr\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 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
17
Fexelint Warnings Flex Filter Algorithm Previous Warnings Diff File Current Warnings New Warnings 17
18
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
19
New Topic: Assessment Tracking 19
20
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
21
Tracking Code Assessments File.c … 202 int I; 203 204 if (I = j( a, b)) { … 214 } File.c … 213 int I; 214 215 if (I = j( a, b)) { … 225 } 9.4.3 9.4.5 Assessment Semantic assessment that a requirement is implemented on line 204. 21
22
Tracking Code Assessments Ctd. File.c … 202 int I; 203 204 if (I = j( a, b)) { … 214 } File.c … 213 int I; 214 215 if (I = j( a, b)) { … 225 } 9.4.3 9.4.5 Assessment Use algorithm to find line 204 in the next build. 22
23
Tracking Code Assessments Ctd File.c … 202 int I; 203 204 if (I = j( a, b)) { … 214 } File.c … 213 int I; 214 215 if (I = j( a, b)) { … 225 } 9.4.3 9.4.5 Assessment Assessment now maps to line 215 in the new build. 23
24
Identifying an Assessment has been Invalidated File.c … 202 int I; 203 204 if (I = j( a, b)) { … 214 } File.c … 213 int I; 214 215 if (I = k( a, b)) { … 225 } 9.4.3 9.4.5 Assessment Changes in software invalidates the assessment. 24
25
Moving Assessments Forward Build 1 A new build is delivered
26
Moving Assessments Forward Assessment Build 1 Assessment Assessments are made
27
Moving Assessments Forward Assessment Build 1 Build 2 27 A new build arrives
28
Moving Assessments Forward Assessment Build 1 Build 2 28 Use algorithm to bring assessments forward
29
Moving Assessments Forward Assessment Build 1 Build 2 29 Make more assessments
30
Moving Assessments Forward Assessment Build 1 Build 2 Build 3 30
31
Moving Assessments Forward Assessment Build 1 Build 2 Build 3 31
32
Moving Assessments Forward Assessment Build 1 Build 2 Build 3 32
33
Identifying Un-Assessed Software Final Build Assessment Un-assessed Software 33
34
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
35
Finale The ability to remap assessments or warnings to consecutive builds could be useful. 35
36
Questions? 36
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.