SlideShare a Scribd company logo
1 of 14
Download to read offline
Introduction

Overview

Static devices

Dynamic behaviour

Capture and Replay Hardware behaviour
for Regression Testing and Useful Bug Reports

Martin Pitt
<martin.pitt@ubuntu.com>

Linux Plumbers Conference, September 2013

Conclusion
Introduction

Overview

Static devices

Dynamic behaviour

Conclusion

Motivation

From: Joe User <joe@random.com>
Subject: eye phone 17 doesn’t work after Ubuntu upgrade
My eye phone 17 has worked fine in Ubuntu 12.04 LTS, but under 13.04
Rhythmbox doesn’t do anything any more when I plug it in.
From: Jack Developer <hacker@freedesktop.org>
Subject: Re: eye phone 17 doesn’t work after Ubuntu upgrade
Sorry, I don’t have this device. It works fine with my phone and media
player. Can you please attach the output of ”rhythmbox –debug”?
Introduction

Overview

Static devices

Dynamic behaviour

Conclusion

Structure

• umockdev-record /dev/ttyUSB0
• UMockdevTestbed GObject class API
• umockdev-run --device 3g-usbstick.umockdev

--script /dev/ttyUSB0=connect.script ModemManager
Introduction

Overview

Static devices

Dynamic behaviour

How does it look like?

Live demo, brace for impact!

Conclusion
Introduction

Overview

Static devices

Dynamic behaviour

Device detection only

• only sysfs, udev props, uevents
• no /dev access
• power supply devices (upower), lsusb, DMI, rfkill,

/sys/class/drm/

Conclusion
Introduction

Overview

Static devices

Dynamic behaviour

Conclusion

API usage: create device

1
2
3
4
5
6
7
8
9
10
11
12
13

UMockdevTestbed ∗ t e s t b e d = u m o c k d e v t e s t b e d n e w ( ) ;
const char ∗ sys bat = umockdev testbed add device ( testbed ,
” p o w e r s u p p l y ” , ” fakeBAT0 ” , NULL ,
/∗ a t t r i b u t e s ∗/
” type ” , ” Battery ” ,
” status ” , ” Discharging ” ,
” e n e r g y f u l l ” , ” 60000000 ” ,
” e n e r g y n o w ” , ” 48000000 ” ,
NULL ,
/∗ p r o p e r t i e s ∗/
”POWER SUPPLY ONLINE” , ” 1 ” ,
NULL ) ;
);

14
15
16

/∗ s t a r t GTestDBus and upowerd ∗/
/∗ c a l l upower −−dump o r q u e r y o v e r D−BUS ∗/
Introduction

Overview

Static devices

Dynamic behaviour

API usage: load device

umockdev-record /sys/class/power supply/BAT0 >
bat0.umockdev
Load with:
1
2
3

from g i . r e p o s i t o r y i m p o r t UMockdev
t e s t b e d = UMockdev . T e s t b e d . new ( )
t e s t b e d . a d d f r o m f i l e ( t e s t b e d , ’ b a t 0 . umockdev ’ )

Conclusion
Introduction

Overview

Static devices

Dynamic behaviour

API usage: change device

1
2
3
4
5

/∗ c h a n g e b a t t e r y c h a r g e ∗/
umockdev testbed set attribute ( testbed , sys bat ,
” e n e r g y n o w ” , ” 1500000 ” ) ;
/∗ s e n d u e v e n t t o n o t i f y upowerd ∗/
u m o c k d e v t e s t b e d u e v e n t ( t e s t b e d , s y s b a t , ” change ” ) ;

6
7

/∗ c a l l upower −−dump o r q u e r y o v e r D−BUS ∗/

Conclusion
Introduction

Overview

Static devices

Dynamic behaviour

Implementation: preload library

$ umockdev-wrapper ./my-test-suite
or
$ LD PRELOAD=libumockdev-preload.so ./my-test-suite

Conclusion
Introduction

Overview

Static devices

Dynamic behaviour

/dev emulation

$UMOCKDEV DIR/dev/*
Common cases:
• char device (tty, ModemManager, evdev events): read(),

write()
• socket (Android rild): send(), recv()
• ioctl (usbdevfs, evdev properties)
• block device

Conclusion
Introduction

Overview

Static devices

Dynamic behaviour

read/write scripts

w 0 ATZ^J
r 200 OK^J
w 350 ATI0^J
r 10 Huawei X1234^Jcaps:^I2G 3G 4G^J
[...]
f 5 w 50 ^@jf9j#2j(*J^@^@^@

1
2
3

G E r r o r ∗ e r r o r = NULL ;
u m o c k d e v t e s t b e d l o a d s c r i p t ( t e s t b e d , ” / d e v / ttyUSB0 ” ,
” h u a w e i . s c r i p t ” , &e r r o r ) ;

Conclusion
Introduction

Overview

Static devices

Dynamic behaviour

Conclusion

ioctl emulation

USBDEVFS_CONNECTINFO 0 0B00000000000000
USBDEVFS_REAPURB 0 1 2 0 0 8 8 0 0001020304050607
USBDEVFS_REAPURB 0 1 129 0 0 15 6 0 DEADBEEF0042
USBDEVFS_REAPURB 0 1 129 0 0 15 7 0 10090807060504
USBDEVFS_REAPURB 0 1 129 -5 0 15 5 0 1010101010
EVIOCGBIT(3) 8 0300001100806002

1
2
3

G E r r o r ∗ e r r o r = NULL ;
u m o c k d e v t e s t b e d l o a d i o c t l ( t e s t b e d , ” / d e v / b u s / u s b /001/013 ” ,
”cam−i m p o r t . i o c t l ” , &e r r o r ) ;
Introduction

Overview

Static devices

Dynamic behaviour

Conclusion

Summary

• successful for several packages
• limited to recorded use cases, without much deviation
• use case driven, especially ioctls
• specific to /sys and /dev
• other kinds of devices: scsi debug, veth, mac80211 hwsim
• testing against D-BUS services: python-dbusmock, Bendy Bus
Introduction

Overview

Static devices

Dynamic behaviour

EOF

Q & A, other use cases, discussion

https://github.com/martinpitt/umockdev/
pitti on Freenode, martin.pitt@ubuntu.com

Slides license: CC-BY-SA 3.0

Conclusion

More Related Content

What's hot

Rich and Snappy Apps (No Scaling Required)
Rich and Snappy Apps (No Scaling Required)Rich and Snappy Apps (No Scaling Required)
Rich and Snappy Apps (No Scaling Required)Thomas Fuchs
 
Star bed 2018.07.19
Star bed 2018.07.19Star bed 2018.07.19
Star bed 2018.07.19Ruo Ando
 
The Ring programming language version 1.8 book - Part 61 of 202
The Ring programming language version 1.8 book - Part 61 of 202The Ring programming language version 1.8 book - Part 61 of 202
The Ring programming language version 1.8 book - Part 61 of 202Mahmoud Samir Fayed
 
Javascript Basics for Advertisers
Javascript Basics for AdvertisersJavascript Basics for Advertisers
Javascript Basics for AdvertisersTom Crinson
 
সোলার প্যানেল [ বিস্তারিত ]
সোলার প্যানেল [ বিস্তারিত ]সোলার প্যানেল [ বিস্তারিত ]
সোলার প্যানেল [ বিস্তারিত ]Mostafizur Rahman
 
Interactive Music II ProcessingとSuperColliderの連携 -2
Interactive Music II ProcessingとSuperColliderの連携 -2Interactive Music II ProcessingとSuperColliderの連携 -2
Interactive Music II ProcessingとSuperColliderの連携 -2Atsushi Tadokoro
 
A little systemtap
A little systemtapA little systemtap
A little systemtapyang bingwu
 
Javascript Common Mistakes
Javascript Common MistakesJavascript Common Mistakes
Javascript Common Mistakes동수 장
 
Default bootloader DFU + UART
Default bootloader DFU + UARTDefault bootloader DFU + UART
Default bootloader DFU + UARTAndrew Shelestov
 
Programação completa e perfeira
Programação completa e perfeiraProgramação completa e perfeira
Programação completa e perfeiraMagno Rodrigues
 
[D2 COMMUNITY] ECMAScript 2015 S67 seminar - 3. generator
[D2 COMMUNITY] ECMAScript 2015 S67 seminar - 3. generator[D2 COMMUNITY] ECMAScript 2015 S67 seminar - 3. generator
[D2 COMMUNITY] ECMAScript 2015 S67 seminar - 3. generatorNAVER D2
 
The Death of a Mouse
The Death of a MouseThe Death of a Mouse
The Death of a MouseGeert Bevin
 
Azure Durable Funkiness - .NET Oxford June 2018
Azure Durable Funkiness - .NET Oxford June 2018Azure Durable Funkiness - .NET Oxford June 2018
Azure Durable Funkiness - .NET Oxford June 2018Stuart Leeks
 
Memory error-talk
Memory error-talkMemory error-talk
Memory error-talkJay Thakkar
 

What's hot (18)

Rich and Snappy Apps (No Scaling Required)
Rich and Snappy Apps (No Scaling Required)Rich and Snappy Apps (No Scaling Required)
Rich and Snappy Apps (No Scaling Required)
 
Star bed 2018.07.19
Star bed 2018.07.19Star bed 2018.07.19
Star bed 2018.07.19
 
The Ring programming language version 1.8 book - Part 61 of 202
The Ring programming language version 1.8 book - Part 61 of 202The Ring programming language version 1.8 book - Part 61 of 202
The Ring programming language version 1.8 book - Part 61 of 202
 
Javascript Basics for Advertisers
Javascript Basics for AdvertisersJavascript Basics for Advertisers
Javascript Basics for Advertisers
 
সোলার প্যানেল [ বিস্তারিত ]
সোলার প্যানেল [ বিস্তারিত ]সোলার প্যানেল [ বিস্তারিত ]
সোলার প্যানেল [ বিস্তারিত ]
 
Interactive Music II ProcessingとSuperColliderの連携 -2
Interactive Music II ProcessingとSuperColliderの連携 -2Interactive Music II ProcessingとSuperColliderの連携 -2
Interactive Music II ProcessingとSuperColliderの連携 -2
 
A little systemtap
A little systemtapA little systemtap
A little systemtap
 
Javascript Common Mistakes
Javascript Common MistakesJavascript Common Mistakes
Javascript Common Mistakes
 
Default bootloader DFU + UART
Default bootloader DFU + UARTDefault bootloader DFU + UART
Default bootloader DFU + UART
 
Programação completa e perfeira
Programação completa e perfeiraProgramação completa e perfeira
Programação completa e perfeira
 
[D2 COMMUNITY] ECMAScript 2015 S67 seminar - 3. generator
[D2 COMMUNITY] ECMAScript 2015 S67 seminar - 3. generator[D2 COMMUNITY] ECMAScript 2015 S67 seminar - 3. generator
[D2 COMMUNITY] ECMAScript 2015 S67 seminar - 3. generator
 
3
33
3
 
The Death of a Mouse
The Death of a MouseThe Death of a Mouse
The Death of a Mouse
 
Of tutorials v1806
Of tutorials v1806Of tutorials v1806
Of tutorials v1806
 
Azure Durable Funkiness - .NET Oxford June 2018
Azure Durable Funkiness - .NET Oxford June 2018Azure Durable Funkiness - .NET Oxford June 2018
Azure Durable Funkiness - .NET Oxford June 2018
 
Verifikation - Metoder og Libraries
Verifikation - Metoder og LibrariesVerifikation - Metoder og Libraries
Verifikation - Metoder og Libraries
 
Of tutorials v1612+
Of tutorials v1612+Of tutorials v1612+
Of tutorials v1612+
 
Memory error-talk
Memory error-talkMemory error-talk
Memory error-talk
 

Similar to Capture and replay hardware behaviour for regression testing and bug reporting

Android Things Linux Day 2017
Android Things Linux Day 2017 Android Things Linux Day 2017
Android Things Linux Day 2017 Stefano Sanna
 
Android Things in action
Android Things in actionAndroid Things in action
Android Things in actionStefano Sanna
 
[DefCon 2016] I got 99 Problems, but 
Little Snitch ain’t one!
[DefCon 2016] I got 99 Problems, but 
Little Snitch ain’t one![DefCon 2016] I got 99 Problems, but 
Little Snitch ain’t one!
[DefCon 2016] I got 99 Problems, but 
Little Snitch ain’t one!Synack
 
jQuery Mobile & PhoneGap
jQuery Mobile & PhoneGapjQuery Mobile & PhoneGap
jQuery Mobile & PhoneGapSwiip
 
Introduction to Java Profiling
Introduction to Java ProfilingIntroduction to Java Profiling
Introduction to Java ProfilingJerry Yoakum
 
Mango64 u boot 업데이트 하기
Mango64 u boot 업데이트 하기Mango64 u boot 업데이트 하기
Mango64 u boot 업데이트 하기종인 전
 
QEMU - Binary Translation
QEMU - Binary Translation QEMU - Binary Translation
QEMU - Binary Translation Jiann-Fuh Liaw
 
Accelerometer and Open GL
Accelerometer and Open GLAccelerometer and Open GL
Accelerometer and Open GLJohn Wilker
 
Accelerometer and OpenGL
Accelerometer and OpenGLAccelerometer and OpenGL
Accelerometer and OpenGLJohn Wilker
 
Kernel Recipes 2016 - Why you need a test strategy for your kernel development
Kernel Recipes 2016 - Why you need a test strategy for your kernel developmentKernel Recipes 2016 - Why you need a test strategy for your kernel development
Kernel Recipes 2016 - Why you need a test strategy for your kernel developmentAnne Nicolas
 
iOS Bluetooth Low Energy (BLE) Remote Robot Interface
iOS Bluetooth Low Energy (BLE) Remote Robot InterfaceiOS Bluetooth Low Energy (BLE) Remote Robot Interface
iOS Bluetooth Low Energy (BLE) Remote Robot InterfaceSteve Knodl
 
What will be quantization step size in numbers and in voltage for th.pdf
What will be quantization step size in numbers and in voltage for th.pdfWhat will be quantization step size in numbers and in voltage for th.pdf
What will be quantization step size in numbers and in voltage for th.pdfSIGMATAX1
 
DEP/ASLR bypass without ROP/JIT
DEP/ASLR bypass without ROP/JITDEP/ASLR bypass without ROP/JIT
DEP/ASLR bypass without ROP/JITArtem I. Baranov
 
Secrets of building a debuggable runtime: Learn how language implementors sol...
Secrets of building a debuggable runtime: Learn how language implementors sol...Secrets of building a debuggable runtime: Learn how language implementors sol...
Secrets of building a debuggable runtime: Learn how language implementors sol...Dev_Events
 
Testing CAN network with help of CANToolz
Testing CAN network with help of CANToolzTesting CAN network with help of CANToolz
Testing CAN network with help of CANToolzAlexey Sintsov
 
OpenGL L02-Transformations
OpenGL L02-TransformationsOpenGL L02-Transformations
OpenGL L02-TransformationsMohammad Shaker
 
Introduction to Debuggers
Introduction to DebuggersIntroduction to Debuggers
Introduction to DebuggersSaumil Shah
 
NetApp ontap simulator
NetApp ontap simulatorNetApp ontap simulator
NetApp ontap simulatorAshwin Pawar
 
Bsides
BsidesBsides
Bsidesm j
 

Similar to Capture and replay hardware behaviour for regression testing and bug reporting (20)

Android Things Linux Day 2017
Android Things Linux Day 2017 Android Things Linux Day 2017
Android Things Linux Day 2017
 
Android Things in action
Android Things in actionAndroid Things in action
Android Things in action
 
[DefCon 2016] I got 99 Problems, but 
Little Snitch ain’t one!
[DefCon 2016] I got 99 Problems, but 
Little Snitch ain’t one![DefCon 2016] I got 99 Problems, but 
Little Snitch ain’t one!
[DefCon 2016] I got 99 Problems, but 
Little Snitch ain’t one!
 
Lampiran 1.programdocx
Lampiran 1.programdocxLampiran 1.programdocx
Lampiran 1.programdocx
 
jQuery Mobile & PhoneGap
jQuery Mobile & PhoneGapjQuery Mobile & PhoneGap
jQuery Mobile & PhoneGap
 
Introduction to Java Profiling
Introduction to Java ProfilingIntroduction to Java Profiling
Introduction to Java Profiling
 
Mango64 u boot 업데이트 하기
Mango64 u boot 업데이트 하기Mango64 u boot 업데이트 하기
Mango64 u boot 업데이트 하기
 
QEMU - Binary Translation
QEMU - Binary Translation QEMU - Binary Translation
QEMU - Binary Translation
 
Accelerometer and Open GL
Accelerometer and Open GLAccelerometer and Open GL
Accelerometer and Open GL
 
Accelerometer and OpenGL
Accelerometer and OpenGLAccelerometer and OpenGL
Accelerometer and OpenGL
 
Kernel Recipes 2016 - Why you need a test strategy for your kernel development
Kernel Recipes 2016 - Why you need a test strategy for your kernel developmentKernel Recipes 2016 - Why you need a test strategy for your kernel development
Kernel Recipes 2016 - Why you need a test strategy for your kernel development
 
iOS Bluetooth Low Energy (BLE) Remote Robot Interface
iOS Bluetooth Low Energy (BLE) Remote Robot InterfaceiOS Bluetooth Low Energy (BLE) Remote Robot Interface
iOS Bluetooth Low Energy (BLE) Remote Robot Interface
 
What will be quantization step size in numbers and in voltage for th.pdf
What will be quantization step size in numbers and in voltage for th.pdfWhat will be quantization step size in numbers and in voltage for th.pdf
What will be quantization step size in numbers and in voltage for th.pdf
 
DEP/ASLR bypass without ROP/JIT
DEP/ASLR bypass without ROP/JITDEP/ASLR bypass without ROP/JIT
DEP/ASLR bypass without ROP/JIT
 
Secrets of building a debuggable runtime: Learn how language implementors sol...
Secrets of building a debuggable runtime: Learn how language implementors sol...Secrets of building a debuggable runtime: Learn how language implementors sol...
Secrets of building a debuggable runtime: Learn how language implementors sol...
 
Testing CAN network with help of CANToolz
Testing CAN network with help of CANToolzTesting CAN network with help of CANToolz
Testing CAN network with help of CANToolz
 
OpenGL L02-Transformations
OpenGL L02-TransformationsOpenGL L02-Transformations
OpenGL L02-Transformations
 
Introduction to Debuggers
Introduction to DebuggersIntroduction to Debuggers
Introduction to Debuggers
 
NetApp ontap simulator
NetApp ontap simulatorNetApp ontap simulator
NetApp ontap simulator
 
Bsides
BsidesBsides
Bsides
 

Recently uploaded

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 

Recently uploaded (20)

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 

Capture and replay hardware behaviour for regression testing and bug reporting

  • 1. Introduction Overview Static devices Dynamic behaviour Capture and Replay Hardware behaviour for Regression Testing and Useful Bug Reports Martin Pitt <martin.pitt@ubuntu.com> Linux Plumbers Conference, September 2013 Conclusion
  • 2. Introduction Overview Static devices Dynamic behaviour Conclusion Motivation From: Joe User <joe@random.com> Subject: eye phone 17 doesn’t work after Ubuntu upgrade My eye phone 17 has worked fine in Ubuntu 12.04 LTS, but under 13.04 Rhythmbox doesn’t do anything any more when I plug it in. From: Jack Developer <hacker@freedesktop.org> Subject: Re: eye phone 17 doesn’t work after Ubuntu upgrade Sorry, I don’t have this device. It works fine with my phone and media player. Can you please attach the output of ”rhythmbox –debug”?
  • 3. Introduction Overview Static devices Dynamic behaviour Conclusion Structure • umockdev-record /dev/ttyUSB0 • UMockdevTestbed GObject class API • umockdev-run --device 3g-usbstick.umockdev --script /dev/ttyUSB0=connect.script ModemManager
  • 4. Introduction Overview Static devices Dynamic behaviour How does it look like? Live demo, brace for impact! Conclusion
  • 5. Introduction Overview Static devices Dynamic behaviour Device detection only • only sysfs, udev props, uevents • no /dev access • power supply devices (upower), lsusb, DMI, rfkill, /sys/class/drm/ Conclusion
  • 6. Introduction Overview Static devices Dynamic behaviour Conclusion API usage: create device 1 2 3 4 5 6 7 8 9 10 11 12 13 UMockdevTestbed ∗ t e s t b e d = u m o c k d e v t e s t b e d n e w ( ) ; const char ∗ sys bat = umockdev testbed add device ( testbed , ” p o w e r s u p p l y ” , ” fakeBAT0 ” , NULL , /∗ a t t r i b u t e s ∗/ ” type ” , ” Battery ” , ” status ” , ” Discharging ” , ” e n e r g y f u l l ” , ” 60000000 ” , ” e n e r g y n o w ” , ” 48000000 ” , NULL , /∗ p r o p e r t i e s ∗/ ”POWER SUPPLY ONLINE” , ” 1 ” , NULL ) ; ); 14 15 16 /∗ s t a r t GTestDBus and upowerd ∗/ /∗ c a l l upower −−dump o r q u e r y o v e r D−BUS ∗/
  • 7. Introduction Overview Static devices Dynamic behaviour API usage: load device umockdev-record /sys/class/power supply/BAT0 > bat0.umockdev Load with: 1 2 3 from g i . r e p o s i t o r y i m p o r t UMockdev t e s t b e d = UMockdev . T e s t b e d . new ( ) t e s t b e d . a d d f r o m f i l e ( t e s t b e d , ’ b a t 0 . umockdev ’ ) Conclusion
  • 8. Introduction Overview Static devices Dynamic behaviour API usage: change device 1 2 3 4 5 /∗ c h a n g e b a t t e r y c h a r g e ∗/ umockdev testbed set attribute ( testbed , sys bat , ” e n e r g y n o w ” , ” 1500000 ” ) ; /∗ s e n d u e v e n t t o n o t i f y upowerd ∗/ u m o c k d e v t e s t b e d u e v e n t ( t e s t b e d , s y s b a t , ” change ” ) ; 6 7 /∗ c a l l upower −−dump o r q u e r y o v e r D−BUS ∗/ Conclusion
  • 9. Introduction Overview Static devices Dynamic behaviour Implementation: preload library $ umockdev-wrapper ./my-test-suite or $ LD PRELOAD=libumockdev-preload.so ./my-test-suite Conclusion
  • 10. Introduction Overview Static devices Dynamic behaviour /dev emulation $UMOCKDEV DIR/dev/* Common cases: • char device (tty, ModemManager, evdev events): read(), write() • socket (Android rild): send(), recv() • ioctl (usbdevfs, evdev properties) • block device Conclusion
  • 11. Introduction Overview Static devices Dynamic behaviour read/write scripts w 0 ATZ^J r 200 OK^J w 350 ATI0^J r 10 Huawei X1234^Jcaps:^I2G 3G 4G^J [...] f 5 w 50 ^@jf9j#2j(*J^@^@^@ 1 2 3 G E r r o r ∗ e r r o r = NULL ; u m o c k d e v t e s t b e d l o a d s c r i p t ( t e s t b e d , ” / d e v / ttyUSB0 ” , ” h u a w e i . s c r i p t ” , &e r r o r ) ; Conclusion
  • 12. Introduction Overview Static devices Dynamic behaviour Conclusion ioctl emulation USBDEVFS_CONNECTINFO 0 0B00000000000000 USBDEVFS_REAPURB 0 1 2 0 0 8 8 0 0001020304050607 USBDEVFS_REAPURB 0 1 129 0 0 15 6 0 DEADBEEF0042 USBDEVFS_REAPURB 0 1 129 0 0 15 7 0 10090807060504 USBDEVFS_REAPURB 0 1 129 -5 0 15 5 0 1010101010 EVIOCGBIT(3) 8 0300001100806002 1 2 3 G E r r o r ∗ e r r o r = NULL ; u m o c k d e v t e s t b e d l o a d i o c t l ( t e s t b e d , ” / d e v / b u s / u s b /001/013 ” , ”cam−i m p o r t . i o c t l ” , &e r r o r ) ;
  • 13. Introduction Overview Static devices Dynamic behaviour Conclusion Summary • successful for several packages • limited to recorded use cases, without much deviation • use case driven, especially ioctls • specific to /sys and /dev • other kinds of devices: scsi debug, veth, mac80211 hwsim • testing against D-BUS services: python-dbusmock, Bendy Bus
  • 14. Introduction Overview Static devices Dynamic behaviour EOF Q & A, other use cases, discussion https://github.com/martinpitt/umockdev/ pitti on Freenode, martin.pitt@ubuntu.com Slides license: CC-BY-SA 3.0 Conclusion