SlideShare a Scribd company logo
Using the
Power to Prove
DeNA Co., Ltd.
Kazuho Oku
Do you know prove?
Have you ever used it?
Sep 20 2013 Using the Power to Prove 2
Prove is…
command-line interface of Test::Harness
Test::Harness is the test runner
Sep 20 2013 Using the Power to Prove 3
$ make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e"
"test_harness(0, 'inc', 'blib/lib', 'blib/arch')" t/00-base.t t/01-new.t t/02-use.t
t/03-use-error.t t/04-use-defaults.t
t/00-base.t .......... ok
t/01-new.t ........... ok
…
$ prove
t/00-base.t .......... ok
t/01-new.t ........... ok
…
Test Anything Protocol (TAP)
Test::Harness runs the scripts and
aggregates the results
test scripts return the data using TAP
Sep 20 2013 Using the Power to Prove 4
$ perl t/00-base.t
1..14
ok 1 - use Class::Accessor::Lite;
ok 2 - call mk_accessors
ok 3
ok 4
…
History of Test::Harness and TAP
TAP exists since Perl 1
Test::Harness is part of Perl core
and is part of Linux Standards Base
bindings exist for many programming
languages
 http://en.wikipedia.org/wiki/Test_Anything_Protocol
Sep 20 2013 Using the Power to Prove 5
Prove has many powerful options
Sep 20 2013 Using the Power to Prove 6
$ prove -j 8 --state hot,fast,save
- runs 8 tests in parallel
- run the tests that failed first
- run the fast tests first,
and then others that takes time
- update the test stats
Can we write tests in other programming
languages, and aggregate the results
using prove?
Sep 20 2013 Using the Power to Prove 7
Prove runs scripts written in any language
but how?
Sep 20 2013 Using the Power to Prove 8
$ cat bf.t
#! /usr/local/bin/yabi
-[----->+<]>--.---..+++.>++++++++++.-[------->+<]>.----.-[++>---<]>+.[--
>+++<]>+.>++++++++++.
$ yabi bf.t
1..1
ok 1
$ prove bf.t
bf.t .. ok
All tests successful.
Files=1, Tests=1, 0 wallclock secs ( 0.02 usr + 0.00 sys = 0.02 CPU)
Result: PASS
PerlProve runs scripts written in any language
Perl understands the shebang
Sep 20 2013 Using the Power to Prove 9
$ cat bf.t
#! /usr/local/bin/yabi
-[----->+<]>--.---..+++.>++++++++++.-[------->+<]>.----.-[++>---<]>+.[--
>+++<]>+.>++++++++++.
$ perl bf.t
1..1
ok 1
PerlProve runs scripts written in any language
but not binary executables…
Sep 20 2013 Using the Power to Prove 10
$ cat bin.c
#include <stdio.h>
int main(int argc, char** argv)
{
printf("1..1n");
printf("ok 1n");
return 0;
}
$ perl bin
Unrecognized character xCF; marked by <-- HERE after <-- HERE near
column 1 at bin line 1.
prove --exec '' solves the problem
why?
Sep 20 2013 Using the Power to Prove 11
$ prove –h
…
-e, --exec Interpreter to run the tests ('' for compiled tests.)
…
$ prove --exec '' bin
bin .. open3: exec of bin failed at
/System/Library/Perl/5.12/TAP/Parser/Iterator/Process.pm line 163.
bin .. Dubious, test returned 255 (wstat 65280, 0xff00)
No subtests run
prove --exec '' solves the problem
specify the paths, or add . to $PATH
but would test scripts stop running on Windows
Sep 20 2013 Using the Power to Prove 12
$ prove --exec '' t/bin
t/bin .. ok
All tests successful.
Files=1, Tests=1, 1 wallclock secs ( 0.02 usr + 0.01 sys = 0.03 CPU)
Result: PASS
$ PATH=".:$PATH" prove --exec '' bin
bin .. ok
All tests successful.
Files=1, Tests=1, 0 wallclock secs ( 0.02 usr + 0.01 sys = 0.03 CPU)
Result: PASS
Extensions can be other than .t
use: --ext ""
Sep 20 2013 Using the Power to Prove 13
$ prove --ext '' --exec '' .
./test.bf ... ok
./test.out .. ok
./test.sh ... ok
All tests successful.
Files=3, Tests=3, 0 wallclock secs ( 0.02 usr + 0.01 sys = 0.03 CPU)
Result: PASS
.proverc
Save the prove options for the project
Sep 20 2013 Using the Power to Prove 14
$ cat .proverc
--ext '' --exec ''
$ prove .
./test.bf ... ok
./test.out .. ok
./test.sh ... ok
All tests successful.
Files=3, Tests=3, 0 wallclock secs ( 0.02 usr + 0.01 sys = 0.03 CPU)
Result: PASS
Test scripts are searched by default from t/
Sep 20 2013 Using the Power to Prove 15
$ cat .proverc
--ext '' --exec ''
$ prove
t/test.bf ... ok
t/test.out .. ok
t/test.sh ... ok
All tests successful.
Files=3, Tests=3, 0 wallclock secs ( 0.02 usr + 0.01 sys = 0.03 CPU)
Result: PASS
Prove is powerful! Can we run programs
other than test scripts?
Sep 20 2013 Using the Power to Prove 16
Running things other than test scripts
cron tasks
service monitoring
Sep 20 2013 Using the Power to Prove 17
$ ls t
http.t memcached.t mysql.t ping.t
smtp.t
$ prove
t/http.t ....... ok
t/memcached.t .. ok
t/mysql.t ...... ok
t/ping.t ....... ok
t/smtp.t ....... ok
All tests successful.
Conclusion
Sep 20 2013 Using the Power to Prove 18
Conclusion
Prove is a proven task runner
can run any kind of tasks and generate a report
preinstalled on most systems
uses TAP - an established protocol
Sep 20 2013 Using the Power to Prove 19

More Related Content

PPT
Unix Programming with Perl
PPT
Unix Programming with Perl 2
PPT
Unix Shell Scripting Basics
ODP
Отладка в GDB
PDF
Put on Your Asynchronous Hat and Node
PPT
Shell Scripting
PPT
Unix And Shell Scripting
ODP
Perl one-liners
Unix Programming with Perl
Unix Programming with Perl 2
Unix Shell Scripting Basics
Отладка в GDB
Put on Your Asynchronous Hat and Node
Shell Scripting
Unix And Shell Scripting
Perl one-liners

What's hot (20)

PPT
Chap06
PDF
Devinsampa nginx-scripting
PDF
various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)
PDF
Quick start bash script
PPTX
Penetration testing using python
ODP
Clojure: Practical functional approach on JVM
PDF
Shell scripting
PDF
Shell Script
PDF
Shell scripting
KEY
Yapcasia2011 - Hello Embed Perl
PDF
Redis & ZeroMQ: How to scale your application
PPT
Unix 5 en
PDF
Groovy on the Shell
DOCX
Quize on scripting shell
PDF
Augeas
ODP
Programming Under Linux In Python
PDF
PHP Internals and Virtual Machine
DOCX
32 shell-programming
PDF
How to stand on the shoulders of giants
PPTX
Unix shell scripts
Chap06
Devinsampa nginx-scripting
various tricks for remote linux exploits  by Seok-Ha Lee (wh1ant)
Quick start bash script
Penetration testing using python
Clojure: Practical functional approach on JVM
Shell scripting
Shell Script
Shell scripting
Yapcasia2011 - Hello Embed Perl
Redis & ZeroMQ: How to scale your application
Unix 5 en
Groovy on the Shell
Quize on scripting shell
Augeas
Programming Under Linux In Python
PHP Internals and Virtual Machine
32 shell-programming
How to stand on the shoulders of giants
Unix shell scripts
Ad

Viewers also liked (20)

PPT
3rd Workshop on Social Information Retrieval for Technology-Enhanced Learnin...
PPTX
Microsite – Macro Idea
PPT
Daily Lecture And Discussions
PPT
Que no sera ni dia ni noche
PPT
'Fotografia privata' su Web: microstorie del Novecento
PPTX
Тренинг продаж: проход секретаря при холодном звонке
PPTX
Our school in winter
PPT
Marketing strategies to increase the ROI on mobile
PPTX
Improve your Web Development using Visual Studio 2010
PPTX
Writing presentation
PPTX
Collecting and utilizing assessment information
PDF
D2.2.1 Evaluation Framework
PPTX
Lyddie: Unit3 lesson5
ODP
Devops down-under
PPS
Kieeds.com
PPT
Little Ones Learning Math Using Technology
PDF
Examenopleiding energieconsulent mfl
KEY
A ToolBox for Handover practices in Europe
PPTX
Origen, filosofía
PPT
Integracija poslovnega sistema
3rd Workshop on Social Information Retrieval for Technology-Enhanced Learnin...
Microsite – Macro Idea
Daily Lecture And Discussions
Que no sera ni dia ni noche
'Fotografia privata' su Web: microstorie del Novecento
Тренинг продаж: проход секретаря при холодном звонке
Our school in winter
Marketing strategies to increase the ROI on mobile
Improve your Web Development using Visual Studio 2010
Writing presentation
Collecting and utilizing assessment information
D2.2.1 Evaluation Framework
Lyddie: Unit3 lesson5
Devops down-under
Kieeds.com
Little Ones Learning Math Using Technology
Examenopleiding energieconsulent mfl
A ToolBox for Handover practices in Europe
Origen, filosofía
Integracija poslovnega sistema
Ad

Similar to Using the Power to Prove (20)

ODP
LPW 2007 - Perl Plumbing
PDF
Testing Code and Assuring Quality
PDF
Unit Testing Lots of Perl
PDF
Hidden Gems of Ruby 1.9
PDF
The $path to knowledge: What little it take to unit-test Perl.
PDF
Perl Testing
PDF
Puppet @ Seat
PDF
Metadata-driven Testing
PDF
Tests unitaires pour PostgreSQL avec pgTap
PDF
Practical Testing of Ruby Core
ODP
Go Replicator
PPTX
PDF
Beaker: Automated, Cloud-Based Acceptance Testing - PuppetConf 2014
PDF
Performance Profiling in Rust
ODP
Intro to Testing in Zope, Plone
PDF
Drupal Camp Brighton 2015: Ansible Drupal Medicine show
PDF
Javantura v2 - Replication with MongoDB - what could go wrong... - Philipp Krenn
PDF
PostgreSQL Portland Performance Practice Project - Database Test 2 Howto
PDF
Getting testy with Perl
PDF
How to master OpenStack in 2 hours
LPW 2007 - Perl Plumbing
Testing Code and Assuring Quality
Unit Testing Lots of Perl
Hidden Gems of Ruby 1.9
The $path to knowledge: What little it take to unit-test Perl.
Perl Testing
Puppet @ Seat
Metadata-driven Testing
Tests unitaires pour PostgreSQL avec pgTap
Practical Testing of Ruby Core
Go Replicator
Beaker: Automated, Cloud-Based Acceptance Testing - PuppetConf 2014
Performance Profiling in Rust
Intro to Testing in Zope, Plone
Drupal Camp Brighton 2015: Ansible Drupal Medicine show
Javantura v2 - Replication with MongoDB - what could go wrong... - Philipp Krenn
PostgreSQL Portland Performance Practice Project - Database Test 2 Howto
Getting testy with Perl
How to master OpenStack in 2 hours

More from Kazuho Oku (20)

PDF
HTTP/2で 速くなるとき ならないとき
PDF
QUIC標準化動向 〜2017/7
PDF
HTTP/2の課題と将来
PDF
TLS 1.3 と 0-RTT のこわ〜い話
PDF
Reorganizing Website Architecture for HTTP/2 and Beyond
PPTX
Recent Advances in HTTP, controlling them using ruby
PPTX
Programming TCP for responsiveness
PDF
Programming TCP for responsiveness
PDF
Developing the fastest HTTP/2 server
PPTX
TLS & LURK @ IETF 95
PPTX
HTTPとサーバ技術の最新動向
PPTX
ウェブを速くするためにDeNAがやっていること - HTTP/2と、さらにその先
PPTX
Cache aware-server-push in H2O version 1.5
PDF
HTTP/2時代のウェブサイト設計
PDF
H2O - making the Web faster
PDF
H2O - making HTTP better
PDF
H2O - the optimized HTTP server
PPTX
JSON SQL Injection and the Lessons Learned
PPTX
JSX 速さの秘密 - 高速なJavaScriptを書く方法
PPTX
JSX の現在と未来 - Oct 26 2013
HTTP/2で 速くなるとき ならないとき
QUIC標準化動向 〜2017/7
HTTP/2の課題と将来
TLS 1.3 と 0-RTT のこわ〜い話
Reorganizing Website Architecture for HTTP/2 and Beyond
Recent Advances in HTTP, controlling them using ruby
Programming TCP for responsiveness
Programming TCP for responsiveness
Developing the fastest HTTP/2 server
TLS & LURK @ IETF 95
HTTPとサーバ技術の最新動向
ウェブを速くするためにDeNAがやっていること - HTTP/2と、さらにその先
Cache aware-server-push in H2O version 1.5
HTTP/2時代のウェブサイト設計
H2O - making the Web faster
H2O - making HTTP better
H2O - the optimized HTTP server
JSON SQL Injection and the Lessons Learned
JSX 速さの秘密 - 高速なJavaScriptを書く方法
JSX の現在と未来 - Oct 26 2013

Recently uploaded (20)

PDF
Electronic commerce courselecture one. Pdf
PDF
Machine learning based COVID-19 study performance prediction
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Empathic Computing: Creating Shared Understanding
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Modernizing your data center with Dell and AMD
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Encapsulation theory and applications.pdf
Electronic commerce courselecture one. Pdf
Machine learning based COVID-19 study performance prediction
NewMind AI Weekly Chronicles - August'25 Week I
Review of recent advances in non-invasive hemoglobin estimation
NewMind AI Monthly Chronicles - July 2025
Empathic Computing: Creating Shared Understanding
Network Security Unit 5.pdf for BCA BBA.
Modernizing your data center with Dell and AMD
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Diabetes mellitus diagnosis method based random forest with bat algorithm
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
20250228 LYD VKU AI Blended-Learning.pptx
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Building Integrated photovoltaic BIPV_UPV.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
Encapsulation theory and applications.pdf

Using the Power to Prove

  • 1. Using the Power to Prove DeNA Co., Ltd. Kazuho Oku
  • 2. Do you know prove? Have you ever used it? Sep 20 2013 Using the Power to Prove 2
  • 3. Prove is… command-line interface of Test::Harness Test::Harness is the test runner Sep 20 2013 Using the Power to Prove 3 $ make test PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'inc', 'blib/lib', 'blib/arch')" t/00-base.t t/01-new.t t/02-use.t t/03-use-error.t t/04-use-defaults.t t/00-base.t .......... ok t/01-new.t ........... ok … $ prove t/00-base.t .......... ok t/01-new.t ........... ok …
  • 4. Test Anything Protocol (TAP) Test::Harness runs the scripts and aggregates the results test scripts return the data using TAP Sep 20 2013 Using the Power to Prove 4 $ perl t/00-base.t 1..14 ok 1 - use Class::Accessor::Lite; ok 2 - call mk_accessors ok 3 ok 4 …
  • 5. History of Test::Harness and TAP TAP exists since Perl 1 Test::Harness is part of Perl core and is part of Linux Standards Base bindings exist for many programming languages  http://en.wikipedia.org/wiki/Test_Anything_Protocol Sep 20 2013 Using the Power to Prove 5
  • 6. Prove has many powerful options Sep 20 2013 Using the Power to Prove 6 $ prove -j 8 --state hot,fast,save - runs 8 tests in parallel - run the tests that failed first - run the fast tests first, and then others that takes time - update the test stats
  • 7. Can we write tests in other programming languages, and aggregate the results using prove? Sep 20 2013 Using the Power to Prove 7
  • 8. Prove runs scripts written in any language but how? Sep 20 2013 Using the Power to Prove 8 $ cat bf.t #! /usr/local/bin/yabi -[----->+<]>--.---..+++.>++++++++++.-[------->+<]>.----.-[++>---<]>+.[-- >+++<]>+.>++++++++++. $ yabi bf.t 1..1 ok 1 $ prove bf.t bf.t .. ok All tests successful. Files=1, Tests=1, 0 wallclock secs ( 0.02 usr + 0.00 sys = 0.02 CPU) Result: PASS
  • 9. PerlProve runs scripts written in any language Perl understands the shebang Sep 20 2013 Using the Power to Prove 9 $ cat bf.t #! /usr/local/bin/yabi -[----->+<]>--.---..+++.>++++++++++.-[------->+<]>.----.-[++>---<]>+.[-- >+++<]>+.>++++++++++. $ perl bf.t 1..1 ok 1
  • 10. PerlProve runs scripts written in any language but not binary executables… Sep 20 2013 Using the Power to Prove 10 $ cat bin.c #include <stdio.h> int main(int argc, char** argv) { printf("1..1n"); printf("ok 1n"); return 0; } $ perl bin Unrecognized character xCF; marked by <-- HERE after <-- HERE near column 1 at bin line 1.
  • 11. prove --exec '' solves the problem why? Sep 20 2013 Using the Power to Prove 11 $ prove –h … -e, --exec Interpreter to run the tests ('' for compiled tests.) … $ prove --exec '' bin bin .. open3: exec of bin failed at /System/Library/Perl/5.12/TAP/Parser/Iterator/Process.pm line 163. bin .. Dubious, test returned 255 (wstat 65280, 0xff00) No subtests run
  • 12. prove --exec '' solves the problem specify the paths, or add . to $PATH but would test scripts stop running on Windows Sep 20 2013 Using the Power to Prove 12 $ prove --exec '' t/bin t/bin .. ok All tests successful. Files=1, Tests=1, 1 wallclock secs ( 0.02 usr + 0.01 sys = 0.03 CPU) Result: PASS $ PATH=".:$PATH" prove --exec '' bin bin .. ok All tests successful. Files=1, Tests=1, 0 wallclock secs ( 0.02 usr + 0.01 sys = 0.03 CPU) Result: PASS
  • 13. Extensions can be other than .t use: --ext "" Sep 20 2013 Using the Power to Prove 13 $ prove --ext '' --exec '' . ./test.bf ... ok ./test.out .. ok ./test.sh ... ok All tests successful. Files=3, Tests=3, 0 wallclock secs ( 0.02 usr + 0.01 sys = 0.03 CPU) Result: PASS
  • 14. .proverc Save the prove options for the project Sep 20 2013 Using the Power to Prove 14 $ cat .proverc --ext '' --exec '' $ prove . ./test.bf ... ok ./test.out .. ok ./test.sh ... ok All tests successful. Files=3, Tests=3, 0 wallclock secs ( 0.02 usr + 0.01 sys = 0.03 CPU) Result: PASS
  • 15. Test scripts are searched by default from t/ Sep 20 2013 Using the Power to Prove 15 $ cat .proverc --ext '' --exec '' $ prove t/test.bf ... ok t/test.out .. ok t/test.sh ... ok All tests successful. Files=3, Tests=3, 0 wallclock secs ( 0.02 usr + 0.01 sys = 0.03 CPU) Result: PASS
  • 16. Prove is powerful! Can we run programs other than test scripts? Sep 20 2013 Using the Power to Prove 16
  • 17. Running things other than test scripts cron tasks service monitoring Sep 20 2013 Using the Power to Prove 17 $ ls t http.t memcached.t mysql.t ping.t smtp.t $ prove t/http.t ....... ok t/memcached.t .. ok t/mysql.t ...... ok t/ping.t ....... ok t/smtp.t ....... ok All tests successful.
  • 18. Conclusion Sep 20 2013 Using the Power to Prove 18
  • 19. Conclusion Prove is a proven task runner can run any kind of tasks and generate a report preinstalled on most systems uses TAP - an established protocol Sep 20 2013 Using the Power to Prove 19