Gentoo Logo
Gentoo Spaceship

Installation:
Gentoo Handbook
Installation Docs

Documentation:
Home
Listing
About Gentoo
Philosophy
Social Contract

Resources:
Bug Tracker
Developer List
Discussion Forums
Gentoo BitTorrents
Gentoo Linux Enhancement Proposals
IRC Channels
Mailing Lists
Mirrors
Name and Logo Guidelines
Online Package Database
Security Announcements
Staffing Needs
Supporting Vendors
View our CVS

Graphics:
Logos and themes
Icons
ScreenShots

Miscellaneous Resources:
Gentoo Linux Store
Gentoo-hosted projects
IBM dW/Intel article archive




List Archive: gentoo-dev
Navigation:
Lists: gentoo-dev: < Prev By Thread Next > < Prev By Date Next >
Headers:
To: gentoo-dev@g.o
From: Donnie Berkholz <dberkholz@g.o>
Subject: A unit-testing prototype
Date: Mon, 26 May 2008 02:47:10 -0700
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:
toolchain-funcs-shunit.sh (Bourne shell script)
Attachment:
x-modular-shunit.sh (Bourne shell script)
Attachment:
tests-common.sh (Bourne shell script)
Replies:
Re: A unit-testing prototype
-- Donnie Berkholz
Navigation:
Lists: gentoo-dev: < Prev By Thread Next > < Prev By Date Next >
Previous by thread:
Automated Package Removal and Addition Tracker, for the week ending 2008-05-25 23h59 UTC
Next by thread:
Re: A unit-testing prototype
Previous by date:
Re: [RFC] Eclass for gnome-python* split
Next by date:
Re: Re: [RFC] Eclass for gnome-python* split


Updated Jun 17, 2009

Donate to support our development efforts.

Gentoo Centric Hosting: vr.org

VR Hosted

Tek Alchemy

Tek Alchemy

SevenL.net

SevenL.net

php|architect

php|architect

Copyright 2001-2007 Gentoo Foundation, Inc. Questions, Comments? Email www@gentoo.org.