SlideShare a Scribd company logo
1 of 33
11
Roman Chobik
23 May 2018
Automated Testing for Embedded Systems
2
Agenda
1. About our project, team and customer
2. Why we decided to create ATS?
3. The process of creation
4. HW components, connections
5. ATS current state
6. SW: scripts, repo, Jenkins, pipelines
7. Demo?
33
Our project, team and customer
4
Evaluation Board
55
Why we decided to create ATS
6
Evaluation Board connected to a laptop
77
The process of creation
8
Photo of the first setup
to USB-Hub
to USB-HubRaspberry Pi
Power supply
for relays
Relay Module EVK PL2
Ethernet
(connected
to switch)
Ethernet
(connected
to switch)
9
Relay Module which we use
Here is description of Relay Module:
https://www.sunfounder.com/4-channel-5v-relay-
shield-module.html
Features
1. 5V 4-Channel Relay interface board, and each one needs 15-20mA Driver Current.
2. Equipped with high-current relay, AC250V 10A ; DC30V 10A.
3. Standard interface that can be controlled directly by microcontroller (Arduino , 8051, AVR, PIC, DSP, ARM, TTL logic).
4. Indication LED's for Relay output status.
Actually we don’t need relays which are able
to commutate 250V. I think we could find
more suitable for our purposes relay module.
It was the best what I found in our internet
shop which sells RPi related accessories.
10
How relays are connected to switches
Relay 1
turns on/off power
Relay 2 & 3
switch flash/boot
mode
R1 R2 R3
11
General diagram
Ethernet switch
USB-Hub USB-Hub
RPi
R
R
R
R
GPIO
Server
UUC
EVK PL2
R
R
R
R
UUC
EVK
SQI
EVK
NAND
UUC
R
R
R
R
XXX
UUC
Power
Internet
Static IP
192.168.1.1
Static IP
192.168.1.2
ETH
USB
USB-UART
Converter
Relay
Module
12
Raspberry Pi usage
For now the only purpose of Raspberry Pi is to control relays.
We use simple script written on Python. It based on RPi.GPIO module designed to control Raspberry
Pi GPIO channels:
https://pypi.python.org/pypi/RPi.GPIO
Example of script usage:
● ./board.py EVK1 power on <-- turn on power of board
● ./board.py EVK1 power off <-- turn off power of board
● ./board.py EVK2 mode flash <-- set flash mode
● ./board.py EVK2 mode boot <-- set boot mode
Server runs script through SSH:
$ ssh pi@192.168.1.2 "board.py EVK1 power on"
+5V
RPi
GPIO1
+5V
Relay module
Power
supply for
relays
PL2
board
optocoupler
relay
13
How to deal with many USB-UART converters
In our setup we have several USB-UART converters, e.g: ttyUSB0, ttyUSB1, ttyUSB2 ...
We need to define what the boards are connected to these ports: after reconnection or server rebooting the
converters can be attached to different ports.
1. Check for the variables of the device by running:
udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB3)
2. Find next variables: idVendor, idProduct, serial or devpath
3. Add next line to file /etc/udev/rules.d/10-local.rules:
ACTION=="add", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="AI051JIV", SYMLINK+="EVK-PL2"
ACTION=="add", ATTRS{devpath}=="1.4.2", SYMLINK+="EVK-NAND"
4. Now to access the device you can use the link “/dev/EVK-PL2 -> ttyUSB3”:
sudo minicom -D /dev/EVK-PL2
/dev/EVK-PL2 -> ttyUSB3
/dev/EVK-NAND -> ttyUSB2
/dev/EVK-SQI -> ttyUSB0
1414
What we have currently
15
16
1717
Software
18
Deal with multiple git repos
repois a tool built on top of Git. Repo helps manage many Git repositories, does the uploads to
revision control systems, and automates parts of the development workflow. Repo is not meant to
replace Git, only to make it easier to work with Git. The repo command is an executable Python script
that you can put anywhere in your path.
<manifest>
...
<project remote="yocto" revision="dade0e68c6" name="poky" path="poky"/>
<project remote="oe" revision="cb7e68f2a3" name="meta-openembedded" path="meta-
openembedded"/>
<project name="xxx-yocto.git" path="." revision="master"/>
<project name="m3-loader.git" path="sources/m3-loaders" revision="master"/>
<project name="u-boot.git" path="sources/u-boot" revision="master"/>
<project name="linux.git" path="sources/linux" revision="master"/>
<project name="meta-carproc.git" path="meta-xx/meta-carproc" revision="master"/>
<project name="meta-toolchain-bare-metal.git" path="meta-toolchain-bare-metal"
revision="master"/>
<project name="tools.git" path="tools" revision="master"/>
</manifest>
19
Jenkins responsibilities in our system
1. Check repos and pull latest changes (using git, repo, some script)
2. Build images for all boards and for all configurations (using Yocto)
3. Flash boards (using external script)
4. Test boards (using external scripts)
5. Do the above jobs sequentially and continuously as one job (using Pipeline plugin)
6. Prepare beautiful reports and keep statistics
Jenkins is an open source automation server written in Java.
Jenkins helps to automate the non-human part of the software
development process, with continuous integration and facilitating
technical aspects of continuous delivery (Wikipedia).
20
ssh pi@192.168.1.2 board.py EVK-PL2-HYB2 mode boot nand
ssh pi@192.168.1.2 board.py EVK-PL2-HYB2 mode boot nor
ssh pi@192.168.1.2 board.py EVK-PL2-HYB2 mode flash nand
ssh pi@192.168.1.2 board.py EVK-PL2-HYB2 mode flash nor
ssh pi@192.168.1.2 board.py EVK-PL2-HYB2 power off
ssh pi@192.168.1.2 board.py EVK-PL2-HYB2 power on
Boards control using Jenkins
21
Pull and Build using Jenkins
22
Automation of Flashing process
$ ./flashLoader-sqi.pl -f "USB DFU" -p "USB Fastboot" -l 0,1,2,3,4,5,6,7,8 $CONFIG_FILE
[-f] comport : first stage communication port name see list below
[-p] comport : flashing communication port name see list below
[-e] : Erase all before flashing
[-l] list: comma separated partition list numbers eg: 0,1,2,3,4
<file> : STA Config file (partitioning + other parameters)
board_ctl "EVK1 power off"
sleep 1
board_ctl "EVK1 mode flash nand"
sleep 1
board_ctl "EVK1 power on"
cd $FLASHER_DIR
./$FLASHER_NAME -e -f "USB DFU" -p "USB Fastboot" $CONFIG_FILE
RES="$?"
board_ctl "EVK1 power off"
if [ $RES -ne 0 ]; then echo "Flashing failed!"; exit -1; fi
echo "Flashing completed successfully!"
sleep 1
board_ctl "EVK1 mode boot nand"
sleep 1
board_ctl "EVK1 power on"
board_ctl - function which runs relay
control script on RPi through SSH
STA_Flashloader erases whole memory
(option -e) and flashes all partitions (-l
not specified), uses info from config file
Booting board after flashing
Fragment of script which is run on the Server
23
Jenkins Flash page
24
Jenkins Flash Log
2525
Testing
26
Board testing from Server
We write python scripts which use module “pexpect”, designed to automate interactive applications
#!/usr/bin/python
import pexpect
child = pexpect.spawn('minicom -D /dev/EVK-PL1') # open minicom
child.sendline('') # send empty line "Enter"
child.expect('root@board:.*# ') # wait for prompt
child.sendline('mount | grep ubi') # send command
child.expect('rn') # wait for Enter (scip our command)
child.expect('root@board:.*# ') # wait for prompt
ubis = child.before[:-2] # save output between our command and
prompt
child.sendline('echo $LD_LIBRARY_PATH') # send command
child.expect('rn') # wait for Enter (scip our command)
child.expect('root@board:.*# ') # wait for prompt
libp = child.before[:-2] # save output between our command and
prompt
print "LIB: %snUBI: %s" % (libp, ubis)
server:~$ sudo ./test_expect.py
LIB: /lib:/usr/lib:/home/root/ext-fs/lib:/home/root/ext-fs/usr/lib
UBI: ubi0_0 on /home/root/ext-fs type ubifs (rw,relatime)
Result of script execution:
Using this approach we can run any application on the board and
check its output.
The “expect” function can wait for some specific words which
denote that application runs successfully, otherwise the timeout
exception will be raised and script completed with failure.
Also in this way we can check exit status of applications.
27
import pytest
import pexpect
@pytest.fixture(scope="module")
def minicom():
# Opening minicom
minicom = pexpect.spawn('minicom -D /dev/EVK-PL1')
minicom.sendline('')
minicom.expect('root@board:.*# ')
yield minicom
# Terminating minicom
minicom.terminate(force=True)
def test_ubi_mount(minicom):
minicom.sendline('mount | grep ubi')
minicom.expect('rn')
minicom.expect('root@board:.*# ')
ubi = minicom.before[:-2]
assert ubi == "ubi0_0 on /home/root/ext-fs type ubifs (rw,relatime)"
def test_ld_library_path(minicom):
minicom.sendline('echo $LD_LIBRARY_PATH')
minicom.expect('rn')
minicom.expect('root@board:.*# ')
libp = minicom.before[:-2]
assert libp == "/lib:/usr/lib:/home/root/ext-fs/lib:/home/root/ext-
server:~$ pytest -v -s test_evk_pl2.py
=================== test session starts ====================
platform linux2 -- Python 2.7.12, pytest-3.2.2, py-1.4.34,
pluggy-0.4.0 -- /usr/bin/python
cachedir: .cache
rootdir: /home/host_station/dev/misc/evkctl/tests, inifile:
collected 2 items
test_evk_pl2.py::test_ubi_mount PASSED
test_evk_pl2.py::test_ld_library_path PASSED
================ 2 passed in 1.57 seconds ==================
Result of executing the test:
Board testing with Pytest
With pytest framework we can easily write automated
tests and verify specific functionality.
2828
Jenkins Pipeline
29
Jenkins Pipeline syntax
Jenkinsfile (Declarative Pipeline)
pipeline {
agent any
stages {
stage('Build') {
steps {
sh 'make'
}
}
stage('Test'){
steps {
sh 'make check'
junit 'reports/**/*.xml'
}
}
stage('Deploy') {
steps {
sh 'make publish'
}
}
}
}
Jenkinsfile (Scripted Pipeline)
node {
stage('Build') {
sh 'make'
}
stage('Test') {
sh 'make check'
junit 'reports/**/*.xml'
}
stage('Deploy') {
sh 'make publish'
}
}
30
Piece of real groovy script
31
Jenkins Pipeline
32
Jenkins Pipeline
33
Thank you

More Related Content

What's hot

Red Hat Global File System (GFS)
Red Hat Global File System (GFS)Red Hat Global File System (GFS)
Red Hat Global File System (GFS)
Schubert Zhang
 

What's hot (20)

Reconnaissance of Virtio: What’s new and how it’s all connected?
Reconnaissance of Virtio: What’s new and how it’s all connected?Reconnaissance of Virtio: What’s new and how it’s all connected?
Reconnaissance of Virtio: What’s new and how it’s all connected?
 
Capturing NIC and Kernel TX and RX Timestamps for Packets in Go
Capturing NIC and Kernel TX and RX Timestamps for Packets in GoCapturing NIC and Kernel TX and RX Timestamps for Packets in Go
Capturing NIC and Kernel TX and RX Timestamps for Packets in Go
 
Open vSwitch 패킷 처리 구조
Open vSwitch 패킷 처리 구조Open vSwitch 패킷 처리 구조
Open vSwitch 패킷 처리 구조
 
Understanding a kernel oops and a kernel panic
Understanding a kernel oops and a kernel panicUnderstanding a kernel oops and a kernel panic
Understanding a kernel oops and a kernel panic
 
XPDDS17: PVH Dom0: The Road so Far - Roger Pau Monné, Citrix
XPDDS17: PVH Dom0: The Road so Far - Roger Pau Monné, CitrixXPDDS17: PVH Dom0: The Road so Far - Roger Pau Monné, Citrix
XPDDS17: PVH Dom0: The Road so Far - Roger Pau Monné, Citrix
 
Project ACRN hypervisor introduction
Project ACRN hypervisor introduction Project ACRN hypervisor introduction
Project ACRN hypervisor introduction
 
Android Virtualization: Opportunity and Organization
Android Virtualization: Opportunity and OrganizationAndroid Virtualization: Opportunity and Organization
Android Virtualization: Opportunity and Organization
 
System Device Tree and Lopper: Concrete Examples - ELC NA 2022
System Device Tree and Lopper: Concrete Examples - ELC NA 2022System Device Tree and Lopper: Concrete Examples - ELC NA 2022
System Device Tree and Lopper: Concrete Examples - ELC NA 2022
 
Course 102: Lecture 16: Process Management (Part 2)
Course 102: Lecture 16: Process Management (Part 2) Course 102: Lecture 16: Process Management (Part 2)
Course 102: Lecture 16: Process Management (Part 2)
 
Dpdk applications
Dpdk applicationsDpdk applications
Dpdk applications
 
Basic Linux Internals
Basic Linux InternalsBasic Linux Internals
Basic Linux Internals
 
containerD
containerDcontainerD
containerD
 
Achieving the ultimate performance with KVM
Achieving the ultimate performance with KVM Achieving the ultimate performance with KVM
Achieving the ultimate performance with KVM
 
Installing and Configuring Domino 10 on CentOS 7
Installing and Configuring Domino 10 on CentOS 7Installing and Configuring Domino 10 on CentOS 7
Installing and Configuring Domino 10 on CentOS 7
 
Securing your cloud with Xen's advanced security features
Securing your cloud with Xen's advanced security featuresSecuring your cloud with Xen's advanced security features
Securing your cloud with Xen's advanced security features
 
Tutorial WiFi driver code - Opening Nuts and Bolts of Linux WiFi Subsystem
Tutorial WiFi driver code - Opening Nuts and Bolts of Linux WiFi SubsystemTutorial WiFi driver code - Opening Nuts and Bolts of Linux WiFi Subsystem
Tutorial WiFi driver code - Opening Nuts and Bolts of Linux WiFi Subsystem
 
Podman rootless containers
Podman rootless containersPodman rootless containers
Podman rootless containers
 
Introduction to Linux Kernel by Quontra Solutions
Introduction to Linux Kernel by Quontra SolutionsIntroduction to Linux Kernel by Quontra Solutions
Introduction to Linux Kernel by Quontra Solutions
 
Page cache in Linux kernel
Page cache in Linux kernelPage cache in Linux kernel
Page cache in Linux kernel
 
Red Hat Global File System (GFS)
Red Hat Global File System (GFS)Red Hat Global File System (GFS)
Red Hat Global File System (GFS)
 

Similar to “Automation Testing for Embedded Systems”

[OpenStack 하반기 스터디] Interoperability with ML2: LinuxBridge, OVS and SDN
[OpenStack 하반기 스터디] Interoperability with ML2: LinuxBridge, OVS and SDN[OpenStack 하반기 스터디] Interoperability with ML2: LinuxBridge, OVS and SDN
[OpenStack 하반기 스터디] Interoperability with ML2: LinuxBridge, OVS and SDN
OpenStack Korea Community
 
20151222_Interoperability with ML2: LinuxBridge, OVS and SDN
20151222_Interoperability with ML2: LinuxBridge, OVS and SDN20151222_Interoperability with ML2: LinuxBridge, OVS and SDN
20151222_Interoperability with ML2: LinuxBridge, OVS and SDN
Sungman Jang
 

Similar to “Automation Testing for Embedded Systems” (20)

Network Automation Tools
Network Automation ToolsNetwork Automation Tools
Network Automation Tools
 
Diving into SWUpdate: adding new platform support in 30minutes with Yocto/OE !
Diving into SWUpdate: adding new platform support in 30minutes with Yocto/OE !Diving into SWUpdate: adding new platform support in 30minutes with Yocto/OE !
Diving into SWUpdate: adding new platform support in 30minutes with Yocto/OE !
 
Linux+sensor+device-tree+shell=IoT !
Linux+sensor+device-tree+shell=IoT !Linux+sensor+device-tree+shell=IoT !
Linux+sensor+device-tree+shell=IoT !
 
See what happened with real time kvm when building real time cloud pezhang@re...
See what happened with real time kvm when building real time cloud pezhang@re...See what happened with real time kvm when building real time cloud pezhang@re...
See what happened with real time kvm when building real time cloud pezhang@re...
 
Harmonia open iris_basic_v0.1
Harmonia open iris_basic_v0.1Harmonia open iris_basic_v0.1
Harmonia open iris_basic_v0.1
 
Time Series Database and Tick Stack
Time Series Database and Tick StackTime Series Database and Tick Stack
Time Series Database and Tick Stack
 
SDNDS.TW Mininet
SDNDS.TW MininetSDNDS.TW Mininet
SDNDS.TW Mininet
 
Tick Stack - Listen your infrastructure and please sleep
Tick Stack - Listen your infrastructure and please sleepTick Stack - Listen your infrastructure and please sleep
Tick Stack - Listen your infrastructure and please sleep
 
SR-IOV, KVM and Emulex OneConnect 10Gbps cards on Debian/Stable
SR-IOV, KVM and Emulex OneConnect 10Gbps cards on Debian/StableSR-IOV, KVM and Emulex OneConnect 10Gbps cards on Debian/Stable
SR-IOV, KVM and Emulex OneConnect 10Gbps cards on Debian/Stable
 
Intel DPDK Step by Step instructions
Intel DPDK Step by Step instructionsIntel DPDK Step by Step instructions
Intel DPDK Step by Step instructions
 
[OpenStack 하반기 스터디] Interoperability with ML2: LinuxBridge, OVS and SDN
[OpenStack 하반기 스터디] Interoperability with ML2: LinuxBridge, OVS and SDN[OpenStack 하반기 스터디] Interoperability with ML2: LinuxBridge, OVS and SDN
[OpenStack 하반기 스터디] Interoperability with ML2: LinuxBridge, OVS and SDN
 
20151222_Interoperability with ML2: LinuxBridge, OVS and SDN
20151222_Interoperability with ML2: LinuxBridge, OVS and SDN20151222_Interoperability with ML2: LinuxBridge, OVS and SDN
20151222_Interoperability with ML2: LinuxBridge, OVS and SDN
 
USB 4-8 Channel Relay Board
USB 4-8 Channel  Relay BoardUSB 4-8 Channel  Relay Board
USB 4-8 Channel Relay Board
 
Automated Out-of-Band management with Ansible and Redfish
Automated Out-of-Band management with Ansible and RedfishAutomated Out-of-Band management with Ansible and Redfish
Automated Out-of-Band management with Ansible and Redfish
 
Understanding Open vSwitch
Understanding Open vSwitch Understanding Open vSwitch
Understanding Open vSwitch
 
Automação do físico ao NetSecDevOps
Automação do físico ao NetSecDevOpsAutomação do físico ao NetSecDevOps
Automação do físico ao NetSecDevOps
 
Our Puppet Story – Patterns and Learnings (sage@guug, March 2014)
Our Puppet Story – Patterns and Learnings (sage@guug, March 2014)Our Puppet Story – Patterns and Learnings (sage@guug, March 2014)
Our Puppet Story – Patterns and Learnings (sage@guug, March 2014)
 
LF_OVS_17_OVS-DPDK Installation and Gotchas
LF_OVS_17_OVS-DPDK Installation and GotchasLF_OVS_17_OVS-DPDK Installation and Gotchas
LF_OVS_17_OVS-DPDK Installation and Gotchas
 
dotCloud and go
dotCloud and godotCloud and go
dotCloud and go
 
Remote tanklevelmonitor
Remote tanklevelmonitorRemote tanklevelmonitor
Remote tanklevelmonitor
 

More from GlobalLogic Ukraine

GlobalLogic Machine Learning Webinar “Advanced Statistical Methods for Linear...
GlobalLogic Machine Learning Webinar “Advanced Statistical Methods for Linear...GlobalLogic Machine Learning Webinar “Advanced Statistical Methods for Linear...
GlobalLogic Machine Learning Webinar “Advanced Statistical Methods for Linear...
GlobalLogic Ukraine
 

More from GlobalLogic Ukraine (20)

GlobalLogic Embedded Community x ROS Ukraine Webinar "Surgical Robots"
GlobalLogic Embedded Community x ROS Ukraine Webinar "Surgical Robots"GlobalLogic Embedded Community x ROS Ukraine Webinar "Surgical Robots"
GlobalLogic Embedded Community x ROS Ukraine Webinar "Surgical Robots"
 
GlobalLogic Java Community Webinar #17 “SpringJDBC vs JDBC. Is Spring a Hero?”
GlobalLogic Java Community Webinar #17 “SpringJDBC vs JDBC. Is Spring a Hero?”GlobalLogic Java Community Webinar #17 “SpringJDBC vs JDBC. Is Spring a Hero?”
GlobalLogic Java Community Webinar #17 “SpringJDBC vs JDBC. Is Spring a Hero?”
 
GlobalLogic JavaScript Community Webinar #18 “Long Story Short: OSI Model”
GlobalLogic JavaScript Community Webinar #18 “Long Story Short: OSI Model”GlobalLogic JavaScript Community Webinar #18 “Long Story Short: OSI Model”
GlobalLogic JavaScript Community Webinar #18 “Long Story Short: OSI Model”
 
Штучний інтелект як допомога в навчанні, а не замінник.pptx
Штучний інтелект як допомога в навчанні, а не замінник.pptxШтучний інтелект як допомога в навчанні, а не замінник.pptx
Штучний інтелект як допомога в навчанні, а не замінник.pptx
 
Задачі AI-розробника як застосовується штучний інтелект.pptx
Задачі AI-розробника як застосовується штучний інтелект.pptxЗадачі AI-розробника як застосовується штучний інтелект.pptx
Задачі AI-розробника як застосовується штучний інтелект.pptx
 
Що треба вивчати, щоб стати розробником штучного інтелекту та нейромереж.pptx
Що треба вивчати, щоб стати розробником штучного інтелекту та нейромереж.pptxЩо треба вивчати, щоб стати розробником штучного інтелекту та нейромереж.pptx
Що треба вивчати, щоб стати розробником штучного інтелекту та нейромереж.pptx
 
GlobalLogic Java Community Webinar #16 “Zaloni’s Architecture for Data-Driven...
GlobalLogic Java Community Webinar #16 “Zaloni’s Architecture for Data-Driven...GlobalLogic Java Community Webinar #16 “Zaloni’s Architecture for Data-Driven...
GlobalLogic Java Community Webinar #16 “Zaloni’s Architecture for Data-Driven...
 
JavaScript Community Webinar #14 "Why Is Git Rebase?"
JavaScript Community Webinar #14 "Why Is Git Rebase?"JavaScript Community Webinar #14 "Why Is Git Rebase?"
JavaScript Community Webinar #14 "Why Is Git Rebase?"
 
GlobalLogic .NET Community Webinar #3 "Exploring Serverless with Azure Functi...
GlobalLogic .NET Community Webinar #3 "Exploring Serverless with Azure Functi...GlobalLogic .NET Community Webinar #3 "Exploring Serverless with Azure Functi...
GlobalLogic .NET Community Webinar #3 "Exploring Serverless with Azure Functi...
 
Страх і сила помилок - IT Inside від GlobalLogic Education
Страх і сила помилок - IT Inside від GlobalLogic EducationСтрах і сила помилок - IT Inside від GlobalLogic Education
Страх і сила помилок - IT Inside від GlobalLogic Education
 
GlobalLogic .NET Webinar #2 “Azure RBAC and Managed Identity”
GlobalLogic .NET Webinar #2 “Azure RBAC and Managed Identity”GlobalLogic .NET Webinar #2 “Azure RBAC and Managed Identity”
GlobalLogic .NET Webinar #2 “Azure RBAC and Managed Identity”
 
GlobalLogic QA Webinar “What does it take to become a Test Engineer”
GlobalLogic QA Webinar “What does it take to become a Test Engineer”GlobalLogic QA Webinar “What does it take to become a Test Engineer”
GlobalLogic QA Webinar “What does it take to become a Test Engineer”
 
“How to Secure Your Applications With a Keycloak?
“How to Secure Your Applications With a Keycloak?“How to Secure Your Applications With a Keycloak?
“How to Secure Your Applications With a Keycloak?
 
GlobalLogic Machine Learning Webinar “Advanced Statistical Methods for Linear...
GlobalLogic Machine Learning Webinar “Advanced Statistical Methods for Linear...GlobalLogic Machine Learning Webinar “Advanced Statistical Methods for Linear...
GlobalLogic Machine Learning Webinar “Advanced Statistical Methods for Linear...
 
GlobalLogic Machine Learning Webinar “Statistical learning of linear regressi...
GlobalLogic Machine Learning Webinar “Statistical learning of linear regressi...GlobalLogic Machine Learning Webinar “Statistical learning of linear regressi...
GlobalLogic Machine Learning Webinar “Statistical learning of linear regressi...
 
GlobalLogic C++ Webinar “The Minimum Knowledge to Become a C++ Developer”
GlobalLogic C++ Webinar “The Minimum Knowledge to Become a C++ Developer”GlobalLogic C++ Webinar “The Minimum Knowledge to Become a C++ Developer”
GlobalLogic C++ Webinar “The Minimum Knowledge to Become a C++ Developer”
 
Embedded Webinar #17 "Low-level Network Testing in Embedded Devices Development"
Embedded Webinar #17 "Low-level Network Testing in Embedded Devices Development"Embedded Webinar #17 "Low-level Network Testing in Embedded Devices Development"
Embedded Webinar #17 "Low-level Network Testing in Embedded Devices Development"
 
GlobalLogic Webinar "Introduction to Embedded QA"
GlobalLogic Webinar "Introduction to Embedded QA"GlobalLogic Webinar "Introduction to Embedded QA"
GlobalLogic Webinar "Introduction to Embedded QA"
 
C++ Webinar "Why Should You Learn C++ in 2021-22?"
C++ Webinar "Why Should You Learn C++ in 2021-22?"C++ Webinar "Why Should You Learn C++ in 2021-22?"
C++ Webinar "Why Should You Learn C++ in 2021-22?"
 
GlobalLogic Test Automation Live Testing Session “Android Behind UI — Testing...
GlobalLogic Test Automation Live Testing Session “Android Behind UI — Testing...GlobalLogic Test Automation Live Testing Session “Android Behind UI — Testing...
GlobalLogic Test Automation Live Testing Session “Android Behind UI — Testing...
 

Recently uploaded

Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
MayuraD1
 
Verification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptxVerification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptx
chumtiyababu
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Kandungan 087776558899
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
AldoGarca30
 

Recently uploaded (20)

Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
 
Wadi Rum luxhotel lodge Analysis case study.pptx
Wadi Rum luxhotel lodge Analysis case study.pptxWadi Rum luxhotel lodge Analysis case study.pptx
Wadi Rum luxhotel lodge Analysis case study.pptx
 
Engineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planesEngineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planes
 
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLE
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLEGEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLE
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLE
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdf
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Verification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptxVerification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptx
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
Moment Distribution Method For Btech Civil
Moment Distribution Method For Btech CivilMoment Distribution Method For Btech Civil
Moment Distribution Method For Btech Civil
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 

“Automation Testing for Embedded Systems”

  • 1. 11 Roman Chobik 23 May 2018 Automated Testing for Embedded Systems
  • 2. 2 Agenda 1. About our project, team and customer 2. Why we decided to create ATS? 3. The process of creation 4. HW components, connections 5. ATS current state 6. SW: scripts, repo, Jenkins, pipelines 7. Demo?
  • 3. 33 Our project, team and customer
  • 5. 55 Why we decided to create ATS
  • 7. 77 The process of creation
  • 8. 8 Photo of the first setup to USB-Hub to USB-HubRaspberry Pi Power supply for relays Relay Module EVK PL2 Ethernet (connected to switch) Ethernet (connected to switch)
  • 9. 9 Relay Module which we use Here is description of Relay Module: https://www.sunfounder.com/4-channel-5v-relay- shield-module.html Features 1. 5V 4-Channel Relay interface board, and each one needs 15-20mA Driver Current. 2. Equipped with high-current relay, AC250V 10A ; DC30V 10A. 3. Standard interface that can be controlled directly by microcontroller (Arduino , 8051, AVR, PIC, DSP, ARM, TTL logic). 4. Indication LED's for Relay output status. Actually we don’t need relays which are able to commutate 250V. I think we could find more suitable for our purposes relay module. It was the best what I found in our internet shop which sells RPi related accessories.
  • 10. 10 How relays are connected to switches Relay 1 turns on/off power Relay 2 & 3 switch flash/boot mode R1 R2 R3
  • 11. 11 General diagram Ethernet switch USB-Hub USB-Hub RPi R R R R GPIO Server UUC EVK PL2 R R R R UUC EVK SQI EVK NAND UUC R R R R XXX UUC Power Internet Static IP 192.168.1.1 Static IP 192.168.1.2 ETH USB USB-UART Converter Relay Module
  • 12. 12 Raspberry Pi usage For now the only purpose of Raspberry Pi is to control relays. We use simple script written on Python. It based on RPi.GPIO module designed to control Raspberry Pi GPIO channels: https://pypi.python.org/pypi/RPi.GPIO Example of script usage: ● ./board.py EVK1 power on <-- turn on power of board ● ./board.py EVK1 power off <-- turn off power of board ● ./board.py EVK2 mode flash <-- set flash mode ● ./board.py EVK2 mode boot <-- set boot mode Server runs script through SSH: $ ssh pi@192.168.1.2 "board.py EVK1 power on" +5V RPi GPIO1 +5V Relay module Power supply for relays PL2 board optocoupler relay
  • 13. 13 How to deal with many USB-UART converters In our setup we have several USB-UART converters, e.g: ttyUSB0, ttyUSB1, ttyUSB2 ... We need to define what the boards are connected to these ports: after reconnection or server rebooting the converters can be attached to different ports. 1. Check for the variables of the device by running: udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB3) 2. Find next variables: idVendor, idProduct, serial or devpath 3. Add next line to file /etc/udev/rules.d/10-local.rules: ACTION=="add", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="AI051JIV", SYMLINK+="EVK-PL2" ACTION=="add", ATTRS{devpath}=="1.4.2", SYMLINK+="EVK-NAND" 4. Now to access the device you can use the link “/dev/EVK-PL2 -> ttyUSB3”: sudo minicom -D /dev/EVK-PL2 /dev/EVK-PL2 -> ttyUSB3 /dev/EVK-NAND -> ttyUSB2 /dev/EVK-SQI -> ttyUSB0
  • 14. 1414 What we have currently
  • 15. 15
  • 16. 16
  • 18. 18 Deal with multiple git repos repois a tool built on top of Git. Repo helps manage many Git repositories, does the uploads to revision control systems, and automates parts of the development workflow. Repo is not meant to replace Git, only to make it easier to work with Git. The repo command is an executable Python script that you can put anywhere in your path. <manifest> ... <project remote="yocto" revision="dade0e68c6" name="poky" path="poky"/> <project remote="oe" revision="cb7e68f2a3" name="meta-openembedded" path="meta- openembedded"/> <project name="xxx-yocto.git" path="." revision="master"/> <project name="m3-loader.git" path="sources/m3-loaders" revision="master"/> <project name="u-boot.git" path="sources/u-boot" revision="master"/> <project name="linux.git" path="sources/linux" revision="master"/> <project name="meta-carproc.git" path="meta-xx/meta-carproc" revision="master"/> <project name="meta-toolchain-bare-metal.git" path="meta-toolchain-bare-metal" revision="master"/> <project name="tools.git" path="tools" revision="master"/> </manifest>
  • 19. 19 Jenkins responsibilities in our system 1. Check repos and pull latest changes (using git, repo, some script) 2. Build images for all boards and for all configurations (using Yocto) 3. Flash boards (using external script) 4. Test boards (using external scripts) 5. Do the above jobs sequentially and continuously as one job (using Pipeline plugin) 6. Prepare beautiful reports and keep statistics Jenkins is an open source automation server written in Java. Jenkins helps to automate the non-human part of the software development process, with continuous integration and facilitating technical aspects of continuous delivery (Wikipedia).
  • 20. 20 ssh pi@192.168.1.2 board.py EVK-PL2-HYB2 mode boot nand ssh pi@192.168.1.2 board.py EVK-PL2-HYB2 mode boot nor ssh pi@192.168.1.2 board.py EVK-PL2-HYB2 mode flash nand ssh pi@192.168.1.2 board.py EVK-PL2-HYB2 mode flash nor ssh pi@192.168.1.2 board.py EVK-PL2-HYB2 power off ssh pi@192.168.1.2 board.py EVK-PL2-HYB2 power on Boards control using Jenkins
  • 21. 21 Pull and Build using Jenkins
  • 22. 22 Automation of Flashing process $ ./flashLoader-sqi.pl -f "USB DFU" -p "USB Fastboot" -l 0,1,2,3,4,5,6,7,8 $CONFIG_FILE [-f] comport : first stage communication port name see list below [-p] comport : flashing communication port name see list below [-e] : Erase all before flashing [-l] list: comma separated partition list numbers eg: 0,1,2,3,4 <file> : STA Config file (partitioning + other parameters) board_ctl "EVK1 power off" sleep 1 board_ctl "EVK1 mode flash nand" sleep 1 board_ctl "EVK1 power on" cd $FLASHER_DIR ./$FLASHER_NAME -e -f "USB DFU" -p "USB Fastboot" $CONFIG_FILE RES="$?" board_ctl "EVK1 power off" if [ $RES -ne 0 ]; then echo "Flashing failed!"; exit -1; fi echo "Flashing completed successfully!" sleep 1 board_ctl "EVK1 mode boot nand" sleep 1 board_ctl "EVK1 power on" board_ctl - function which runs relay control script on RPi through SSH STA_Flashloader erases whole memory (option -e) and flashes all partitions (-l not specified), uses info from config file Booting board after flashing Fragment of script which is run on the Server
  • 26. 26 Board testing from Server We write python scripts which use module “pexpect”, designed to automate interactive applications #!/usr/bin/python import pexpect child = pexpect.spawn('minicom -D /dev/EVK-PL1') # open minicom child.sendline('') # send empty line "Enter" child.expect('root@board:.*# ') # wait for prompt child.sendline('mount | grep ubi') # send command child.expect('rn') # wait for Enter (scip our command) child.expect('root@board:.*# ') # wait for prompt ubis = child.before[:-2] # save output between our command and prompt child.sendline('echo $LD_LIBRARY_PATH') # send command child.expect('rn') # wait for Enter (scip our command) child.expect('root@board:.*# ') # wait for prompt libp = child.before[:-2] # save output between our command and prompt print "LIB: %snUBI: %s" % (libp, ubis) server:~$ sudo ./test_expect.py LIB: /lib:/usr/lib:/home/root/ext-fs/lib:/home/root/ext-fs/usr/lib UBI: ubi0_0 on /home/root/ext-fs type ubifs (rw,relatime) Result of script execution: Using this approach we can run any application on the board and check its output. The “expect” function can wait for some specific words which denote that application runs successfully, otherwise the timeout exception will be raised and script completed with failure. Also in this way we can check exit status of applications.
  • 27. 27 import pytest import pexpect @pytest.fixture(scope="module") def minicom(): # Opening minicom minicom = pexpect.spawn('minicom -D /dev/EVK-PL1') minicom.sendline('') minicom.expect('root@board:.*# ') yield minicom # Terminating minicom minicom.terminate(force=True) def test_ubi_mount(minicom): minicom.sendline('mount | grep ubi') minicom.expect('rn') minicom.expect('root@board:.*# ') ubi = minicom.before[:-2] assert ubi == "ubi0_0 on /home/root/ext-fs type ubifs (rw,relatime)" def test_ld_library_path(minicom): minicom.sendline('echo $LD_LIBRARY_PATH') minicom.expect('rn') minicom.expect('root@board:.*# ') libp = minicom.before[:-2] assert libp == "/lib:/usr/lib:/home/root/ext-fs/lib:/home/root/ext- server:~$ pytest -v -s test_evk_pl2.py =================== test session starts ==================== platform linux2 -- Python 2.7.12, pytest-3.2.2, py-1.4.34, pluggy-0.4.0 -- /usr/bin/python cachedir: .cache rootdir: /home/host_station/dev/misc/evkctl/tests, inifile: collected 2 items test_evk_pl2.py::test_ubi_mount PASSED test_evk_pl2.py::test_ld_library_path PASSED ================ 2 passed in 1.57 seconds ================== Result of executing the test: Board testing with Pytest With pytest framework we can easily write automated tests and verify specific functionality.
  • 29. 29 Jenkins Pipeline syntax Jenkinsfile (Declarative Pipeline) pipeline { agent any stages { stage('Build') { steps { sh 'make' } } stage('Test'){ steps { sh 'make check' junit 'reports/**/*.xml' } } stage('Deploy') { steps { sh 'make publish' } } } } Jenkinsfile (Scripted Pipeline) node { stage('Build') { sh 'make' } stage('Test') { sh 'make check' junit 'reports/**/*.xml' } stage('Deploy') { sh 'make publish' } }
  • 30. 30 Piece of real groovy script