public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] A unit-testing prototype
@ 2008-05-26  9:47 Donnie Berkholz
  2008-06-12  7:48 ` Donnie Berkholz
  0 siblings, 1 reply; 4+ messages in thread
From: Donnie Berkholz @ 2008-05-26  9:47 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 1273 bytes --]

Hi everyone,

A while back, vapier added some tests for the toolchain-funcs eclass to 
/usr/portage/eclass/tests/. I really like the idea, and I recently 
discovered an xUnit-style unit-testing framework for shell scripts 
called ShUnit2. I played with it a little and made a couple of 
prototypes. Take a look and see what you think.

To get started:

layman -f -o http://gechi-overlay.sf.net/layman.xml -a gechi
emerge shunit2
sed -i -e "/^__SHUNIT_SHELL_FLAGS/s:u::g" /usr/share/shunit2/shunit2

Download the attached files to /usr/portage/eclass/tests, make 'em 
executable and run 'em. The output looks something like this:

donnie@comet $ ./toolchain-funcs-shunit.sh 
#
# Performing tests
#
test-tc-arch-kernel
test-tc-arch

#
# Test report
#
tests passed:    71 100%
tests failed:     0   0%
tests skipped:    0   0%
tests total:     71 100%

donnie@comet $ ./x-modular-shunit.sh 
#
# Performing tests
#
test-x-modular_specs_check
test-x-modular_dri_check
ASSERT:DRIVER='yes' IUSE='dri' USE='dri' BUILT_WITH='yes'
test-x-modular_server_supports_drivers_check
ASSERT:DRIVER='yes' HAS_VER='yes' BUILT_WITH='yes'

#
# Test report
#
tests passed:    28  93%
tests failed:     2   7%
tests skipped:    0   0%
tests total:     30 100%


What do you think?

Thanks,
Donnie

[-- Attachment #2: toolchain-funcs-shunit.sh --]
[-- Type: application/x-sh, Size: 1733 bytes --]

[-- Attachment #3: x-modular-shunit.sh --]
[-- Type: application/x-sh, Size: 5696 bytes --]

[-- Attachment #4: tests-common.sh --]
[-- Type: application/x-sh, Size: 850 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-dev] A unit-testing prototype
  2008-05-26  9:47 [gentoo-dev] A unit-testing prototype Donnie Berkholz
@ 2008-06-12  7:48 ` Donnie Berkholz
  2008-06-12  8:42   ` Alexis Ballier
  2008-06-12  9:59   ` Rémi Cardona
  0 siblings, 2 replies; 4+ messages in thread
From: Donnie Berkholz @ 2008-06-12  7:48 UTC (permalink / raw
  To: gentoo-dev

On 02:47 Mon 26 May     , Donnie Berkholz wrote:
> A while back, vapier added some tests for the toolchain-funcs eclass to 
> /usr/portage/eclass/tests/. I really like the idea, and I recently 
> discovered an xUnit-style unit-testing framework for shell scripts 
> called ShUnit2. I played with it a little and made a couple of 
> prototypes. Take a look and see what you think.

I've heard two positive comments on IRC and nothing else, so I'm 
proceeding with this. I'll be adding these to the existing 
/usr/portage/eclass/tests/, adding shunit2 to the tree, and beginning 
some work looking into unit tests for portage's bash code.

Probably some for app-shells/bash would also be useful, since we seem to 
pretty consistently run into weird breakage on new versions.

Thanks,
Donnie
-- 
gentoo-dev@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-dev] A unit-testing prototype
  2008-06-12  7:48 ` Donnie Berkholz
@ 2008-06-12  8:42   ` Alexis Ballier
  2008-06-12  9:59   ` Rémi Cardona
  1 sibling, 0 replies; 4+ messages in thread
From: Alexis Ballier @ 2008-06-12  8:42 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 1028 bytes --]

On Thu, 12 Jun 2008 00:48:01 -0700
Donnie Berkholz <dberkholz@gentoo.org> wrote:

> On 02:47 Mon 26 May     , Donnie Berkholz wrote:
> > A while back, vapier added some tests for the toolchain-funcs
> > eclass to /usr/portage/eclass/tests/. I really like the idea, and I
> > recently discovered an xUnit-style unit-testing framework for shell
> > scripts called ShUnit2. I played with it a little and made a couple
> > of prototypes. Take a look and see what you think.
> 
> I've heard two positive comments on IRC and nothing else, so I'm 
> proceeding with this. I'll be adding these to the existing 
> /usr/portage/eclass/tests/, adding shunit2 to the tree, and beginning 
> some work looking into unit tests for portage's bash code.

Great! Thanks. I didn't try it because I was too lazy to put shunit2 in
an overlay but had a look at the code. Tests cannot hurt, esp. for such
widely used code that eclasses are.
I'll probably use this to write tests for the couple of eclasses I
maintain.


Alexis.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-dev] A unit-testing prototype
  2008-06-12  7:48 ` Donnie Berkholz
  2008-06-12  8:42   ` Alexis Ballier
@ 2008-06-12  9:59   ` Rémi Cardona
  1 sibling, 0 replies; 4+ messages in thread
From: Rémi Cardona @ 2008-06-12  9:59 UTC (permalink / raw
  To: gentoo-dev

Donnie Berkholz a écrit :
> I've heard two positive comments on IRC and nothing else, so I'm 
> proceeding with this. I'll be adding these to the existing 
> /usr/portage/eclass/tests/, adding shunit2 to the tree, and beginning 
> some work looking into unit tests for portage's bash code.

Could you let us know of your progress here or on your blog? I'm 
interested in maybe writing a couple tests for the gnome2* eclasses.

Thanks for your work on this :)

Cheers

-- 
Rémi Cardona
LRI, INRIA
remi.cardona@lri.fr
remi@gentoo.org
-- 
gentoo-dev@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-06-12  9:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-26  9:47 [gentoo-dev] A unit-testing prototype Donnie Berkholz
2008-06-12  7:48 ` Donnie Berkholz
2008-06-12  8:42   ` Alexis Ballier
2008-06-12  9:59   ` Rémi Cardona

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox