+ All Categories
Home > Business > AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions

AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions

Date post: 29-Jan-2018
Category:
Upload: jamieayre
View: 89 times
Download: 5 times
Share this document with a friend
53
Eric Perlade Verification Solutions Technical Account Manager
Transcript
Page 1: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions

Eric Perlade

Verification Solutions

Technical Account Manager

Page 2: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions

C/C++ C#/Java Ada

RobustnessAchieved

DeveloperResponsibility

ToolResponsibility

LanguageResponsibility

Assembly

Page 3: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions

Software that matters

Leverage the increase in tool responsibility offered by Ada and SPARK

Find software bugs and vulnerabilities earlier in the development process

Ideally we’d like the developers to do this as part of their every day workflow

Verification can be made easyAda

Page 4: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions

Verification

Assure that software fully satisfies all the expected requirements

Non-FunctionalRequirements

FunctionalRequirements

Page 5: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions

Functional Requirements

A refinement from System Requirements -> Software Requirements

”The software shall…”

High Level and Low Level – DO-178

Require verification

FunctionalRequirements

Page 6: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions

Non-Functional Requirements

Can be from outside the SRD refinement path

Coding Standards

Complexity Requirements

Coverage Requirements

Target resource usage Requirements

Non-FunctionalRequirements

Page 7: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions

SoftwareRequirementsSpecification

SoftwareArchitecture

SoftwareDetailedDesign

Code

UnitTest

IntegrationTest

SystemTest

GNATmetricGNATcheckSPARKProCodePeer

GNATtestGNATemulatorGNATcoverage

GNATstackGNATcoverage(TargetTrace)

Page 8: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions

Know Your Code

• Embrace Programming by Contract• Continuous Unit Testing• Measure your software• Keep your subprograms at a sensible length and level of

complexity• Ensure your software is readable and understandable by all the

developers

Page 9: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions

Static Verification

Page 10: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions

GNATmetric

Variety of different metrics are available

• Complexity• Syntax Elements• Line Metrics• Coupling Metrics

Output into an XML file which can be post-processed

Page 11: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions
Page 12: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions
Page 13: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions

GNAT Front End

Objective is to leverage the increased formality of the language to allow tools to be more responsible.

Compiler switches for the GNAT front end can do a great job of catching coding problems early in the development process

Many customers turn on ALL warnings and ensure warnings are treated as ERRORS which will halt compilation

Produces better developers ??

Page 14: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions
Page 15: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions

Style Checking

The key word here is consistency

Developers can unintentionally introduce code constructs that are considered un-helpful in reducing defects

General guidelines for good Ada can accompany company coding standards

GNATcheck and the GNAT front end itself are available to help

Page 16: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions
Page 17: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions

GNATcheck

A set of implemented rules from which a subset can be selected as a coding standard

Specified in a file read by GNATcheck and the output can be written to a textual report file or an XML file for post-processing

GNAT Programming Studio has a fantastic GUI helper for rule selection

Page 18: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions
Page 19: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions
Page 20: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions
Page 21: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions

Static Stack Analysis

Generation of the basic stack consumption and call-graph information.

Performed during compilation-fcallgraph-info=su,daGenerates a .ci file per object file

Analysis and report generation

Page 22: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions
Page 23: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions
Page 24: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions

Pitfalls

Cycles, unbounded frames, external calls, dynamic variables or indirect calls

Use “-Wa” and “-v” to get additional information

Encourage developers to run GNATstack and try to rework the code to enable full stack analysis

Page 25: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions

Build your own tools !

libadalang

Page 26: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions

Dynamic Verification

Page 27: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions

SoftwareRequirementsSpecification

SoftwareArchitecture

SoftwareDetailedDesign

Code

GNATtestGNATemulatorGNATcoverage

SystemTest

Integration Test

Page 28: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions

Desktop Dynamic Verification

TARGETEMULATIONGNATemulator COVERAGEANALYSISGNATcoverage

UNITTESTGENERATIONGNATtest

Page 29: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions

HARNESS

TESTCASES

UUT

package Simple is

procedure SubP(Loop_Count : in Integer;Even_Count : out Integer;Odd_Count : out Integer

) withPre => (Loop_Count > 0),Post => ((Even_Count >= 0) and (Odd_Count >= 0));

end Simple;

Page 30: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions

GNATtest

Unit Test Harness Generation

Included in GNAT Pro

Based on the Open Source AUnit Framework

Available for Native and Cross Compilers

Code Generation = Lower Costs

Page 31: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions

GNATtest Work Flow

gnattest -v --RTS=ravenscar-full-prep -Pex4.gpr

Generates Test Case Skeletons and a Harness

Very Flexible and allows for CM of generated code

Aware of User Defined Test Case Code

Clearly identifies what will NOT survive a re-generation

Page 32: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions

GNATtest –Test Case Generationpackage Simple.Test_Data is

-- begin read onlytype Test is new AUnit.Test_Fixtures.Test_Fixture

-- end read onlywith null record;

procedure Set_Up (Gnattest_T : in out Test);procedure Tear_Down (Gnattest_T : in out Test);

end Simple.Test_Data;

-- This package has been generated automatically by GNATtest.-- Do not edit any part of it, see GNATtest documentation for more details.

-- begin read onlywith Gnattest_Generated;

package Simple.Test_Data.Tests is

type Test is new GNATtest_Generated.GNATtest_Standard.Simple.Test_Data.Testwith null record;

procedure Test_SubP_75ecda (Gnattest_T : in out Test);-- simple.ads:3:4:SubP

end Simple.Test_Data.Tests;-- end read only

Page 33: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions

GNATtest –Test Case Generation

-- This package is intended to set up and tear down the test environment.-- Once created by GNATtest, this package will never be overwritten-- automatically. Contents of this package can be modified in any way-- except for sections surrounded by a 'read only' marker.

package body Simple.Test_Data is

X : constant Integer := 20;

procedure Set_Up (Gnattest_T : in out Test) ispragma Unreferenced (Gnattest_T);

beginnull;

end Set_Up;

procedure Tear_Down (Gnattest_T : in out Test) ispragma Unreferenced (Gnattest_T);

beginnull;

end Tear_Down;

end Simple.Test_Data;

Page 34: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions

-- This package has been generated automatically by GNATtest.-- You are allowed to add your code to the bodies of test routines.-- Such changes will be kept during further regeneration of this file.-- All code placed outside of test routine bodies will be lost. The-- code intended to set up and tear down the test environment should be-- placed into Simple.Test_Data.

with AUnit.Assertions; use AUnit.Assertions;

package body Simple.Test_Data.Tests is-- begin read only

procedure Test_SubP (Gnattest_T : in out Test);procedure Test_SubP_75ecda (Gnattest_T : in out Test) renames Test_SubP;

-- id:2.2/75ecda11d3241da6/SubP/1/0/procedure Test_SubP (Gnattest_T : in out Test) is-- simple.ads:3:4:SubP

-- end read only

pragma Unreferenced (Gnattest_T);

begin

AUnit.Assertions.Assert(Gnattest_Generated.Default_Assert_Value,"Test not implemented.");

-- begin read onlyend Test_SubP;

-- end read only

end Simple.Test_Data.Tests;

Page 35: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions

Even_Count, Odd_Count : Integer;

begin

Simple.SubP(Loop_Count => 21,Even_Count => Even_Count,Odd_Count => Odd_Count

);

Assert(((Even_Count = 10) and (Odd_Count = 10)),"Loop_Count => 21");-- White box analysis identified that no odd numbers above 20 will be counted

Simple.SubP(Loop_Count => 22,Even_Count => Even_Count,Odd_Count => Odd_Count

);

Assert(((Even_Count = 11) and (Odd_Count = 10)),"Loop_Count => 22");

Page 36: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions

GNATtest – Coverage Analysis

Page 37: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions
Page 38: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions
Page 39: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions

GNATemulator

QEMU Open Source Processor EmulatorNot a Simulator

I/O Connections

No InstrumentationActual Target Object CodeNo expensive native re-host

PowerPC/ARM/SPARCExecutable Image

PowerPC/ARM/SPARC -> x86 Translation

x86 Host Platform

Page 40: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions

GNATemulator Platform Support

VxWorks 6VxWorks 653

PowerPC ELF Bare Metal

LEON ELF Bare Metal

ARM ELF Bare Metal

Page 41: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions

GNATemulator Debugging

Puts a verification environment on the developers desk

Rapid re-test

No target hardware

Actual object code EXE

GNATemulator

GDBSERVER

TCP

GPS/GDB

Page 42: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions

GNATcoverage

• Coverage Analysis - Multiple Modes of Operation

• Run and Capture Execution Trace Data

• Conversion of IEEE-ISTO 5001-2003 (Nexus) Trace Data

• Coverage Analysis of Execution Trace Data• Source Code Level• Object Code Level

Page 43: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions

Native Intel

PowerPC

LEON 2 and LEON 3

ARM(Target Trace Port)

GNATcoverage Platform Support

Page 44: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions

Build Considerations

-gDebug data

-fpreserve-control-flowControl Optimizers for precise SLOC info

-fdump-scosSource Coverage Obligation in *.ali files

Page 45: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions

Build Considerations

Support for Optimizations (up to -O1)

Inlining Allowed (-gnatn)

No External Libraries Needed

All can be achieved using GNAT Project file scenario variables.

Page 46: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions

GNATcoverage Analysis Levels

Source Levelgnatcov coverage --level=stmtgnatcov coverage --level=stmt+decisiongnatcov coverage --level=stmt+mcdc

Object Levelgnatcov coverage --level=insngnatcov coverage --level=branch

Page 47: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions

GNATcoverage Analysis Formats

xcov - Annotated Sources in Text Format

report - Textual Summary

HTML - Colours, Sortable Columns and Per-project indexes

Page 48: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions

Conclusion

AdaCore has verification tools that are applicable to the different phases in the classic V-model.

Developers can leverage the increase in tool responsibility to continuously verify and catch defects early.

Easy to integrate into the developers work environment through the GPS IDE but also command line driven for non-interactive use cases.

Page 49: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions

Advance through these slides for more instruction

Page 50: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions

Getting Started

This template has been setup with a variety of slide layouts to give you a solid foundation that you can build on and adapt as necessary. Get started by clicking the Insert tab and selecting the New Slide dropdown to choose from a variety of slide designs. Each design is available in Dark, Blue, and Light background themes.

Page 51: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions

Resources

A repository of AdaCore acquired Stock Photography, product screenshots, logos, and other assets can be found at dropboxat the following link : http://bit.ly/1SMRRXT

Please note that any stock photography may be used for the purposes of company PowerPoint presentations. For any other use case, please get in touch with us first at [email protected]

Page 52: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions

The following icons have been useful for illustrating various industries. Visit http://www.thenounproject.com for a good

resource beyond what’s available here.

Rail Naval Drone Medical Financial

Security Auto Space Air ATM Submarine

Grid

Page 53: AdaCore Paris Tech Day 2016: Eric Perlade - Verification Solutions

The following icons have been useful for illustrating various industries. Visit http://www.thenounproject.com for a good

resource beyond what’s available here.

Rail Naval Drone Medical Financial

Security Auto Space Air ATM Submarine

Grid


Recommended