jython for embedded software validation

26
1 Jython for Embedded Software Validation Raniero Virgilio IAG/ECG/PPD SW Pycon Quattro, 8/5/2010

Upload: vraniero

Post on 19-May-2015

1.310 views

Category:

Technology


0 download

DESCRIPTION

Presented at Pycon italy 2010

TRANSCRIPT

Page 1: Jython for Embedded Software Validation

11

Jython for Embedded Software Validation

Raniero VirgilioIAG/ECG/PPD SW

Pycon Quattro, 8/5/2010

Page 2: Jython for Embedded Software Validation

22Intel Architecture Group

Raniero VirgilioMy Job • Software Engineer in Intel Shannon, Ireland• Responsible for Test Automation infrastructure

My Team• PPD (Performance Product Division)

Embedded Software• Complete SOCs for security, communications,

storage and embedded designs• http://www.intel.com/embedded/index.htm

Page 3: Jython for Embedded Software Validation

33Intel Architecture Group

Agenda

• Validation in embedded systems• Runtime Plug-in model• Runtime Plug-in model with Jython• Jython and Eclipse• Results

Page 4: Jython for Embedded Software Validation

44Intel Architecture Group

Validation in embedded systems

• A challenging environment• Typical scenario• Requirements and solutions

Page 5: Jython for Embedded Software Validation

55Intel Architecture Group

A challenging environment

Multiple hw/sw deployments• Configuration set up needs to be fast and reliable• Support for different OS types and versions

Consistent cooperation• Several teams working on the same infrastructure• Synchronization with overseas groups

Page 6: Jython for Embedded Software Validation

66Intel Architecture Group

Test Automation scenario

Traffic Generator 1

DUT2(Linux/Windows/FreeBSD)

DUT3(Linux/Windows/FreeBSD)

Server1 (Windows)

Server2 (Windows)

Telnet session

Telnet session

XML-RPC session

Traffic Generator 2

Test Code

Test Suites

XML-RPC session

Test Driver

DUT1 (Linux/Windows/FreeBSD)

Test ExecutionReports

Telnet session

XML-RPC session

Page 7: Jython for Embedded Software Validation

77Intel Architecture Group

Test Automation requirementsProgramming language• Platform-independent• Libraries for connectivity and string manipulation

Test Framework design• OOP to maximize reusability of test code• Platform runtime extendibility

Sustainable implementation• An effective interface between test execution

(local to DUT) and test reporting (distributed)• Customizable open source solution

Page 8: Jython for Embedded Software Validation

88Intel Architecture Group

Proposed solution

Programming language• Python

– telnetlib, xmlrpclib, SimpleXMLRPCServer– re, xml.dom.minidom

Test Framework design• Runtime plug-in model

Sustainable implementation• Jython embedded in Eclipse

– Jython is a Python interpreter written in 100% pure Java

Page 9: Jython for Embedded Software Validation

99Intel Architecture Group

Runtime plug-in model

• Definition• Design Pattern

Page 10: Jython for Embedded Software Validation

1010Intel Architecture Group

Runtime Plug-in Model

• The plug-in is unknown at compile-time of the application for which the plug-in is designed.

• Plug-ins are dynamically plugged into the application they are designed for at runtime

• The key for this model is Dynamic Code Loading

The term plug-in refers to a type of program that contributes code to the

system and adds a special capability to it.

Page 11: Jython for Embedded Software Validation

1111Intel Architecture Group

Design Pattern

• Extendibility – Application capabilities are defined

by the supported Plug-in– Plug-in can be loaded and unloaded

at runtime• Plug-in development

– Each Plug-in shall implement a specified interface

– The plug-in delegates the Application for high-level services

• Parallel life-cycle– Application and Plug-ins can be

developed independently

Page 12: Jython for Embedded Software Validation

1212Intel Architecture Group

Runtime Plug-in Model with Jython

• Dynamic code loading in Java and Jython

• Multithreading

Page 13: Jython for Embedded Software Validation

1313Intel Architecture Group

Dynamic code loading in Java

• Runtime source compilation– StandardJavaFileManager handles the

source code– JavaCompiler executes the compilation

and creates a class file– DiagnosticCollector gathers compilation

information

• Class file deployment– A new Classloader has to be defined– It need to extend the previous one with the new class file

Page 14: Jython for Embedded Software Validation

1414Intel Architecture Group

Dynamic code loading in Jython

• One step task– The PluginHandler instantiates one PythonInterpreter– The Plug-in path is added in the PythonInterpreter sys.path– The Plug-in is imported in the embedded Python environment

• Lower complexity– Implementation is much easier– Code can be modified “on-the-fly” and reloaded– First time Plug-in loading is usually quicker on Jython

Page 15: Jython for Embedded Software Validation

1515Intel Architecture Group

Multithreaded environment

• Parallel PluginHandlers– Independent Jython environments’

setups– Each PluginHandler defines an

autonomous environment

• Multiple task execution– When PluginHandler invokes a run() the execution is

encapsulated in a Java Thread– Plug-ins expand the application concurrently

Java Thread

Page 16: Jython for Embedded Software Validation

1616Intel Architecture Group

Jython and Eclipse

• XTP architecture• The Execution Engines• The JythonExchanger

Page 17: Jython for Embedded Software Validation

1717Intel Architecture Group

The eXtendible Test Platform (XTP)

TestCase Code

C FilesDUT A

Traffic Generator A

DUT B

TestCase Docs

DUT C DUT D

Java

Jyth

on

Page 18: Jython for Embedded Software Validation

1818Intel Architecture Group

The Execution Engine in XTP

28.08.09

DUT A DUT B

• XTP– provides high-level test services (logging, reporting,

multithreading) and an interface with frontend• Execution Engine

– a self-contained software package, written in Python, that implements the actual test logic and expands XTP enabling communication of the test platform with DUTs, servers and test equipments

Page 19: Jython for Embedded Software Validation

1919Intel Architecture Group

Plugging an Execution Engine

28.08.09

DUT A DUT B

– A PythonInterpreter is created by XTP– The activation sequences contained in the EE Manifest are

executed in the PythonInterpreter– An instance of the (Java) JythonInterpreter class is created

by XTP and deployed into the relevant PythonInterpreter

jythonExchangerXML-based Manifest

Page 20: Jython for Embedded Software Validation

2020Intel Architecture Group

The jythonExchanger

– The jythonExchanger is the interface between the EE and the XTP environment

– Each EE uses it to access XTP high-level features– XTP infrastructure uses it to retrieve test results from EEs and

show them in graphs and reports – The overall consistency of the system is assured by the Jython

characteristic to be a 100% pure Java implementation.

Page 21: Jython for Embedded Software Validation

2121Intel Architecture Group

Results

• Main benefits• Common risks

Page 22: Jython for Embedded Software Validation

2222Intel Architecture Group

Sustainable architecture

32

33

34

35

36

37

38

39

40

0 1 2 3 4 5

Java

Hea

p Sp

ace

EEs Number

32

33

34

35

36

37

38

39

40

5 4 3 2 1 0

Java

Hea

p Sp

ace

EEs Number

• Example: load/unload 5 plug-ins at runtime– Memory request increases without “exploding”– Memory is freed when plug-ins are deactivated

Page 23: Jython for Embedded Software Validation

2323Intel Architecture Group

Major benefits

“Calibrate your technology”

• Choose the solution that best fits your needs– Python threads or Java threads (or Eclipse Jobs)?

• Transparent Python layer on DUTs– XML-RPC Server + os.popen() have small CPU overhead

• Plug-in lifecycle– Runtime plug-ins promote validation through cooperation

• Short rump-up time– Perl users start using Python very intuitively

Page 24: Jython for Embedded Software Validation

2424Intel Architecture Group

Common risks

“Design your architecture”

• Test planning– To make the most of the Plug-in design pattern, point out

common test domains in advance• Long-term investment

– Platform stability requires a significant effort• Keep code under control

– Review carefully test code before integrating it• Right-Size your hardware

– Concurrent executions may require performing machines

Page 25: Jython for Embedded Software Validation

2525Intel Architecture Group

Q&A

Page 26: Jython for Embedded Software Validation