grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC][PATCH] Basic unit testing support for GRUB


From: BVK
Subject: Re: [RFC][PATCH] Basic unit testing support for GRUB
Date: Mon, 23 Nov 2009 20:46:27 +0530

Hi,


I have been busy last week, so I couldn't reply :-(

But I am able to complete most of the framework.  It has support for
logging multiple testcase failures and reporting them at the end of
test execution.  Please go through the attached patch and let me know
your suggestions.

Attached framework has support for two kinds of tests.

1. Unit Tests
2. Functional Tests

Unit tests are test programs that doesn't need an active GRUB instance
for their operation. These programs target specific code of GRUB, like
grub_printf logic, etc.  These are run during the build time by "make
check" command.  Since these are normal programs, they can link with
standard C library and others.

Functional tests are for testing GRUB functionality that needs an
active instance of GRUB (for example, testing serial console code,
partition tables logic, biosdisk access, etc.).  Every functional test
is a GRUB module that registers itself when its loaded.  These are run
using special GRUB command "functional_test" in GRUB shell.

Attached patch has example tests for both. An additional grub_sprintf
unit test is also available which tests grub_sprintf function logic
and gets executed as part of "make check".

Since functional tests are grub modules, we either need to boot into
GRUB to run them or can make use of i386-qemu port of GRUB.  Below is
how I currently tested functional tests using i386-port


$ ./autogen.sh
$ ./configure --prefix=/usr --with-platform=qemu
$ make && make check
$ ./grub-mkimage -d . -o grub.bios at_keyboard normal help halt
functional_test example_functional_test
$ qemu -bios ./grub.bios -hda /dev/zero

rescue:grub> functional_test example_functional_test
...
rescue:grub> halt


As for the future framework related enhancements, I am thinking of
developing a grub-test script which would run functional tests
directly inside a qemu using serial console -- as part of the build
process.  Then we can have test scripts using grub-test as its
interpreter, which would remove the difference between functional
tests and unit tests.




thanks,
-- 
bvk.chaitanya

Attachment: testing-framework.patch
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]