[Pdx-pm] hardware-related testing
Eric Wilhelm
scratchcomputing at gmail.com
Thu Jul 13 09:52:00 PDT 2006
# from Keith Lofstrom
# on Thursday 13 July 2006 07:38 am:
>the tweak/test/tweak/test iterative
>loop was inefficient because the testing prerequisites were not met.
>That is often the case during installation test, right?
To be clear, the unmet prerequisite was having *a* serial port on my
laptop. Our insertion of TODO blocks around the tests that fail with a
connected modem was really more of a demonstration of TODO than an
actual fix. The tests in question really need to skip_all() if there's
not a port or if it appears that something is connected to the port.
Kees had inherited this code and tests and had been wanting to update
them to Test::More for just that sort of reason.
Also note that we finished by running the tests on my workstation, which
has a serial port, but had a modem connected to the assumed port (which
causes the port to respond differently.)
As for missing hardware prerequisites, yes. The test should assume that
it cannot access the hardware unless either a) it can safely probe for
it or b) the administrator has specifically requested hardware testing.
While this code must be tested on-hardware to verify it, the basic rule
of CPAN is that you should assume "no human at terminal" and "no
physical access to machine" in most situations.
$ENV{PERL_MM_USE_DEFAULT} is one indicator, but in the case of
hardware, you may also have to check the user's permissions, etc.
(Aside: I believe Module::Build has an ask() method that allows you to
ask questions of the (possibly absent) user in the "proper" way.)
Yes, emulation would be good, but would have to be implemented on all of
the architectures supported by this code.
--Eric
--
"Politics is not a bad profession. If you succeed there are many
rewards, if you disgrace yourself you can always write a book."
--Ronald Reagan
---------------------------------------------------
http://scratchcomputing.com
---------------------------------------------------
More information about the Pdx-pm-list
mailing list