All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v2 5/5] support/testing: add toolchain tests
Date: Sun, 5 Mar 2017 22:36:50 +0100	[thread overview]
Message-ID: <20170305223650.296c7225@free-electrons.com> (raw)
In-Reply-To: <58bc8359882ea_6832a0cfd06544b@ultri3.mail>

Hello,

On Sun, 05 Mar 2017 18:30:01 -0300, Ricardo Martincoski wrote:

> and it tries to run it when --all is used:
> ======================================================================
> ERROR: test_run (tests.toolchain.test_external.TestExternalToolchain)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "/tmp/testing-v2/support/testing/infra/basetest.py", line 56, in setUp
>     self.b.build()
>   File "/tmp/testing-v2/support/testing/infra/builder.py", line 23, in build
>     cf.write(self.config)
> TypeError: expected a string or other character buffer object
> 
> > +    def test_run(self):  
> 
> I think you could avoid this by renaming this method ...
> 
> https://nose2.readthedocs.io/en/latest/usage.html#naming-tests
> 'Within test modules, nose2 will load tests from unittest.TestCase subclasses,
> and from test functions (functions whose names begin with "test").'
> 
> ... to something like this:
>     def common_check(self):
> ...

Ah, yes, indeed.

Speaking of this, there is one thing I am not entirely happy with: it
would be much nicer if we could split some test cases in multiple
test_<foo>() methods, especially the external toolchain tests.

However, the setUp() and tearDown() methods are called before and after
running *each* test_<foo>() method of the current unit test class. This
is clearly not what we want, as we don't want to rebuild/clean up the
whole Buildroot build for each test_<foo>() method.

I saw we have setUpClass() and tearDownClass(), but these being class
methods, I guess you don't have access to members of the object
instance that will be used. And we access a lot of these through
"self." in setUp() and tearDown().

Do you have an idea?

In addition to this, we will at some point need to allow a test case to
do something special before the build is started, i.e in the middle of
the setUp() logic. Should the specific test case override setUp() in
this case, do its own stuff, and call the parent class setUp() method?

Thanks,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

  reply	other threads:[~2017-03-05 21:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-05 15:03 [Buildroot] [PATCH v2 0/5] Runtime testing infrastructure Thomas Petazzoni
2017-03-05 15:03 ` [Buildroot] [PATCH v2 1/5] support/testing: core " Thomas Petazzoni
2017-03-05 15:03 ` [Buildroot] [PATCH v2 2/5] support/testing: add core tests Thomas Petazzoni
2017-03-05 16:00   ` Yann E. MORIN
2017-03-05 17:54     ` Thomas Petazzoni
2017-03-05 15:03 ` [Buildroot] [PATCH v2 3/5] support/testing: add fs tests Thomas Petazzoni
2017-03-05 15:03 ` [Buildroot] [PATCH v2 4/5] support/testing: add package tests Thomas Petazzoni
2017-03-05 16:27   ` Yann E. MORIN
2017-03-05 17:55     ` Thomas Petazzoni
2017-03-05 15:03 ` [Buildroot] [PATCH v2 5/5] support/testing: add toolchain tests Thomas Petazzoni
2017-03-05 21:30   ` Ricardo Martincoski
2017-03-05 21:36     ` Thomas Petazzoni [this message]
2017-03-06  0:41       ` Ricardo Martincoski

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=20170305223650.296c7225@free-electrons.com \
    --to=thomas.petazzoni@free-electrons.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.