Software Metrics Testing MINIX 3. Introduction What is Metrics Analysis? Metrics Analysis is a field of Static Analysis. Show us structural attributes.

Slides:



Advertisements
Similar presentations
Symbol Table.
Advertisements

Code Correctness, Readability, Maintainability Svetlin Nakov Telerik Corporation
By Rohen Shah – rxs07u.  Introduction  Different methodologies used  Different types of testing tools  Most commonly used testing tools  Summary.
SOFTWARE TESTING. INTRODUCTION  Software Testing is the process of executing a program or system with the intent of finding errors.  It involves any.
Describing Process Specifications and Structured Decisions Systems Analysis and Design, 7e Kendall & Kendall 9 © 2008 Pearson Prentice Hall.
Chapter 2 - Problem Solving
Adding scalability to legacy PHP web applications Overview Mario A. Valdez-Ramirez.
Automated creation of verification models for C-programs Yury Yusupov Saint-Petersburg State Polytechnic University The Second Spring Young Researchers.
API Design CPSC 315 – Programming Studio Fall 2008 Follows Kernighan and Pike, The Practice of Programming and Joshua Bloch’s Library-Centric Software.
Introduction To System Analysis and Design
CS 290C: Formal Models for Web Software Lecture 10: Language Based Modeling and Analysis of Navigation Errors Instructor: Tevfik Bultan.
Chapter 2: Algorithm Discovery and Design
Creating Shareable Models By: Eric Hutton CSDMS - Community Surface Dynamics Modeling System (pronounced ˈ s ɪ stəms) Image by Flickr user Let There Be.
Software Metrics Analysis Group 2. Description of the program used for the analysis Understand 2.0 is the tool we have chosen for the analysis.
Chapter 2: Algorithm Discovery and Design
School of Computer ScienceG53FSP Formal Specification1 Dr. Rong Qu Introduction to Formal Specification
1 ES 314 Advanced Programming Lec 2 Sept 3 Goals: Complete the discussion of problem Review of C++ Object-oriented design Arrays and pointers.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
Chapter 2: Algorithm Discovery and Design
Chapter 2: Algorithm Discovery and Design
Examining the Code [Reading assignment: Chapter 6, pp ]
Software Testing Verification and validation planning Software inspections Software Inspection vs. Testing Automated static analysis Cleanroom software.
Introduction To System Analysis and design
JS Arrays, Functions, Events Week 5 INFM 603. Agenda Arrays Functions Event-Driven Programming.
LAYING OUT THE FOUNDATIONS. OUTLINE Analyze the project from a technical point of view Analyze and choose the architecture for your application Decide.
1 CSC 427: Data Structures and Algorithm Analysis Fall 2011 See online syllabus (also available through BlueLine): Course goals:
Reliability Andy Jensen Sandy Cabadas.  Understanding Reliability and its issues can help one solve them in relatable areas of computing Thesis.
Eng. Mohammed Timraz Electronics & Communication Engineer University of Palestine Faculty of Engineering and Urban planning Software Engineering Department.
Chapter 2: Algorithm Discovery and Design Invitation to Computer Science, C++ Version, Third Edition.
Invitation to Computer Science, Java Version, Second Edition.
Drag and Drop Display and Builder. Timofei B. Bolshakov, Andrey D. Petrov FermiLab.
Introduction To System Analysis and Design
Describing Process Specifications and Structured Decisions Systems Analysis and Design, 7e Kendall & Kendall 9 © 2008 Pearson Prentice Hall.
1 CSC 427: Data Structures and Algorithm Analysis Fall 2010 See online syllabus (also available through BlueLine): Course goals:
Chapter 18 Object Database Management Systems. McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Outline Motivation for object.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 22 Slide 1 Software Verification, Validation and Testing.
Introduction to Problem Solving. Steps in Programming A Very Simplified Picture –Problem Definition & Analysis – High Level Strategy for a solution –Arriving.
Software Engineering Principles. SE Principles Principles are statements describing desirable properties of the product and process.
CS 151: Object-Oriented Design September 5 Class Meeting Department of Computer Science San Jose State University Spring 2013 Instructor: Ron Mak
The Software Development Process
1 CSCD 326 Data Structures I Software Design. 2 The Software Life Cycle 1. Specification 2. Design 3. Risk Analysis 4. Verification 5. Coding 6. Testing.
Presenting and Analysing your Data CSCI 6620 Spring 2014 Thesis Projects: Chapter 10 CSCI 6620 Spring 2014 Thesis Projects: Chapter 10.
EPICS Release 3.15 Bob Dalesio May 19, Features for 3.15 Support for large arrays - done for rsrv in 3.14 Channel access priorities - planned to.
Software Maintenance Speaker: Jerry Gao Ph.D. San Jose State University URL: Sept., 2001.
1 CSC 427: Data Structures and Algorithm Analysis Fall 2006 See online syllabus (also available through Blackboard): Course goals:
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
Software Engineering1  Verification: The software should conform to its specification  Validation: The software should do what the user really requires.
M1G Introduction to Programming 2 3. Creating Classes: Room and Item.
Lecture 4 Mechanisms & Kernel for NOSs. Mechanisms for Network Operating Systems  Network operating systems provide three basic mechanisms that support.
Chapter 2 - VB 2005 by Schneider- modified by S. Jane '081 Chapter 2 - Problem Solving 2.1 Program Development Cycle 2.2 Programming Tools.
Chapter 18 Object Database Management Systems. Outline Motivation for object database management Object-oriented principles Architectures for object database.
Requirement engineering & Requirement tasks/Management. 1Prepared By:Jay A.Dave.
Chapter 2: Algorithm Discovery and Design Invitation to Computer Science.
Tool Support for Testing Classify different types of test tools according to their purpose Explain the benefits of using test tools.
Structure Based Test Design
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
CSC 427: Data Structures and Algorithm Analysis
Software Testing.
Metrics of Software Quality
Software Testing.
CSC 221: Computer Programming I Fall 2005
Switch, Rounding Errors, Libraries
Un</br>able’s MySecretSecrets
Software testing strategies 2
CodePeer Update Arnaud Charlet CodePeer Update Arnaud Charlet
CodePeer Update Arnaud Charlet CodePeer Update Arnaud Charlet
Coding Concepts (Basics)
What Is Good Software(Program)?
Last Class: Communication in Distributed Systems
Presentation transcript:

Software Metrics Testing MINIX 3

Introduction What is Metrics Analysis? Metrics Analysis is a field of Static Analysis. Show us structural attributes of the code: Depth nesting, cyclomatic number, comment/code ratio, comment frequency, number of line of code, etc... 20% of the code will cause 80% of the problems. Metrics Analysis helps to find this high risk, complex areas. All this areas are candidates for reviews and additional dynamic testing in the future.

Methodology The methodology followed by the Metrics Analysis group consists on the next steps: Choose a program to work with for making measurements in the source code. Select the most important and/or interesting files to analyze in relation with their properties, importance for the project or with the interest of the other teams in order to find in them unusual behaviors, excessive complexity, or other relevant properties. Create HTML reports, graphics, etc... about the listed files and the source code of the complete project that represent clearly the information.

Supports C/C++/C# and Java languages. Makes possible to quickly comprehend, measure, maintain and document source code. Handle big amounts of code. Those are some of the features of Understand 2.0: - Fast parsing - Batch and command line parsing - Combined Language Analysis - Graphical Views - Semantic change analysis - Advanced metrics - Custom architecture creation - Creation of code analysis snapshots - API support for adding customized code checks and reports -... The chosen tool: Understand 2.0

What to test? Some important MINIX3 files: servers/init/main.c: Father of all MINIX processes. servers/pm/main.c: Process manager. servers/rs/main.c: Reincarnation server. servers/cache.c, servers/cache2.c: Manage the two cache levels. kernel/main.c: Main program of MINIX and its shutdown code. kernel/proc.c: Process and message handling. kernel/system/do_trace.c: Kernel call.

Why to test? Two different approaches to test MINIX 3 files: choosing them because of their complexity, and so, more possibilities to contain bugs. o do_trace.c (kernel/system) o mii.c (drivers/fxp) choosing them for their importance for MINIX3 or the case of study of other groups. o reincarnation server files

The kernel call is implemented in this file. Small file (146 lines). Most complex file according to average cyclomatic complexity. Average cyclomatic complexity of 26. According to LaQuSo methodology these are high risk parts of the program because its average cyclomatic complexity is greater than 21. Analysis of do_trace.c

Some possible explanations: Only one function, function metrics = average metrics. Switch with several cases, a lot of branches, complex. Several if statements with a lot of conditions.

Independent (Ethernet) Interface functions: Second most complex file in MINIX 3. Very low comment ratio. 198 lines, 16 comment lines = 0.09 comment ratio Complexity 22 --> Risky according to LaQuSo. Crowded with nested if statements and in this case one switch statement. Candidate for bugs because of it's reduced maintainability index. Analysis of mii.c

Solutions These solutions are common to do_trace.c and mii.c: Split the function or functions in many others to see if the average cyclomatic complexity changes. Rewrite the code without using switch statement and watch the new behavior. Try to unite some if expressions to simplify the code.

Analysis of the reincarnation server Important part of MINIX3 ----> Reliability and robustness Checks health of drivers and restart them if they are dead. Composed by 3 three.c files o main.c o manager.c o service.c We checked the reincarnation server by functions 14 functions in total

Analysis of the reincarnation server For service.c: print_usage failure parse_arguments main For manager.c do_up do_down do_refresh do_rescue do_shutdown do_exit do_period start_service stop_service do_getsysinfo For main.c main init_server get_work reply Functions to test

Analysis of the reincarnation server We can see that service.c is by far the most complex file and also the average of complexity is the highest of all three.

Most of the code is quite simple, but: main from main.c complexity = 16. init_server from main.c complexity = 12. do_period in manager.c complexity = 11. do_up from manager.c complexity = 12. parse_arguments from service.c complexity = 29. Interesting results from the point of view of complexity. Analysis of the reincarnation server

main complexity = 16: This is the main routine of the reincarnation sever. The main loop consists of three major activities: getting new work, processing the work, and sending the reply. The loop never terminates, unless a panic occurs.

Analysis of the reincarnation server init_server = 12: Initialize the reincarnation server. Initialize the system process table, Initialize the table with the *processes in the system image Set alarm to periodically check driver status.

Analysis of the reincarnation server do_period = 11: Marks the period for checking the state of the services and if they are not responding, or they don’t do it on time, it kills the services and send messages to solve the problem.

Analysis of the reincarnation server do_up = 12: When a request was made to start a new system service, dismember the request message and gather all information needed to start the service See if there is a free entry in the table with system processes and try to start the system service.

Analysis of the reincarnation server parse_arguments = 29: This function is in charge of parse and verify correctness of arguments Reports problems and exits if an error is found Stores needed parameters in global variables

Analysis of the reincarnation server The most interesting function to check in future analysis like, reviews, dynamic analysis, etc.. main from main.c. It’s not the most complex function It plays an important role in MINIX 3 27 lines of comment for 47 lines of code parse_arguments from Is quite more risky Less important function Full of nested if and else statements Nine lines of comments with 105 of code

Analysis of the reincarnation server Control flow of main.c

Analysis of the reincarnation server Control flow of parse_arguments

Conclusions Our work in this project has been focused on: Search in the source code of MINIX3 pieces of source code where other groups are working to get metrics. Analyze these pieces of code with Understand 2.0, creating tables and graphics related with the collected data showing the information in a simple way to draw conclusions more easily after.

Conclusions Select real useful information for us. We rely on the importance and functionality of the piece of code we are discussing and also in the metrics obtained. Come to certain conclusions. In some cases we have proposed any solution if we have seen room for improvements somewhere, some other times we have seen that was not worth changing anything.

Conclusions We get interesting results (metrics) from parts of code where the other groups were working. We tried to provide feasible solutions to the parties that we think could be improved. We leave the parties we did not know or would not change because it was not worth looking a solution.

Conclusions In the particular case of MINIX3: We have analyzed MINIX 3 files of the reincarnation server and process manager. We have obtained interesting results especially in the reincarnation server because some unusually complex parts. We tried to provide solutions to simplify these parts as was our objective.

After our analysis we find the MINIX3 source code analyzed generally well commented. Conclusions About complexity we can also state that the code maintains its average lower than 10, and it makes the code quite reliable and maintainable.