All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas De Schampheleire <patrickdepinguin@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] Buildroot runtime test infrastructure prototype
Date: Fri, 26 Jun 2015 20:12:35 +0200	[thread overview]
Message-ID: <CAAXf6LUW3rc14Eb+3GjxCUXB8DJv2sCqC5KSdEbmf6+uFsVhBQ@mail.gmail.com> (raw)
In-Reply-To: <20150625200235.083eaf34@free-electrons.com>

Hi Thomas,

On Thu, Jun 25, 2015 at 8:02 PM, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> Hello,
>
> Our http://autobuild.buildroot.org tests are great, but they are only
> build-time tests, and they only test random configurations of packages.
> Things like bootloader packages, filesystem images, kernel build are
> never tested in an automated way, and no runtime testing is done. I
> also want to be able to build small test programs exercising specific
> features and run them on the target.
>
> Since a while, I wanted to setup a small infrastructure to be able to
> describe specific test cases: a Buildroot configuration to build, with
> the ability to boot some of those configurations automatically in Qemu.
>
> So I finally went ahead and create such a small infrastructure. It's
> very basic and minimal right now, and should be considered as an
> experiment. It's available at:
>
>    https://github.com/tpetazzoni/buildroot-runtime-test
>
> It's based on the Python unittest mechanism, and allows to describe
> test cases that consist in a Buildroot defconfig, plus a Python
> function that can do some checks on the resulting build, boot the
> system under Qemu, run some commands inside the Qemu system and check
> their results.
>
> I've written a few tests to show how it could work: simple tests for
> Dropbear and Python (on the package side) and several tests for
> filesystem images: ext2/3/4, squashfs, jffs2, ubi, iso9660, yaffs2 (all
> of them are boot tested, except yaffs2).
>
> For now, it's very crude and basic. The README file explains how it
> works, and gives a TODO listing some of the things that for sure need
> to be improved.
>
> Currently, this runtime test infrastructure is not set up to be
> executed every day on the latest Git, but it is obviously the goal.
>
> Contributions, comments and suggestions are welcome.

A while ago I learned about pyTest, an alternative test suite over unittest.
The website http://pytest.org/latest/ contains good documentation, but
some benefits:

- intelligent asserts: you can just write 'assert <expression>' where
expression can be any Python expression. For example, 'assert x == 3'
or 'assert "Login:" in output'. You don't need special 'assertEqual',
'assertNotEqual', 'assertIn', etc. Pytest will analyze these assert
statements and do the right thing. Also, the error reporting in case
the assert is not met is quite intelligent and much better than
standard output of unittest.
(http://pytest.org/latest/assert.html#assert-with-the-assert-statement)

- parametrization of tests: it is very easy to run the same test with
different parameters. Say that you want to repeat the JFFS2 test, but
with a slightly different config.
(http://pytest.org/latest/parametrize.html#parametrized-test-functions)

To convert the existing code you have to use pytest isn't much work, really.
In fact, you can already run the existing unittests through pytest
without changes. You would just call
py.test. (after installing it with 'pip install pytest'; you may like
'pip install pytest-sugar' too.

Best regards,
Thomas

  parent reply	other threads:[~2015-06-26 18:12 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-25 18:02 [Buildroot] Buildroot runtime test infrastructure prototype Thomas Petazzoni
2015-06-26 15:48 ` Andreas Naumann
2015-06-26 16:20   ` Jeremy Rosen
2015-06-28  9:50     ` Thomas Petazzoni
2015-06-30  7:06       ` Andreas Naumann
2015-06-30  7:39         ` Thomas Petazzoni
2015-06-30  8:38           ` Jeremy Rosen
2015-06-30  8:46             ` Thomas Petazzoni
2015-06-30 20:26             ` Andreas Naumann
2015-07-01  8:53               ` Jeremy Rosen
2015-06-30 16:06       ` Jeremy Rosen
2015-07-01  7:30         ` Andreas Naumann
2015-07-01  7:57           ` Jeremy Rosen
2015-07-01 10:28           ` Denis Thulin
2015-07-02 13:57             ` Andreas Naumann
2015-06-26 18:12 ` Thomas De Schampheleire [this message]
2015-06-26 18:26   ` Thomas De Schampheleire

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAAXf6LUW3rc14Eb+3GjxCUXB8DJv2sCqC5KSdEbmf6+uFsVhBQ@mail.gmail.com \
    --to=patrickdepinguin@gmail.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.