Project:Perl/maint-notes/dev-perl/Device-SerialPort

From Gentoo Wiki
Jump to:navigation Jump to:search

Tests

This module needs hardware IO to /dev/ttyS1 and so testing this is left to experts.

Here's the notes from upstreams Readme:

INSTALL and TEST:

You will need suitable permissions to open the port. If the port is also
used for logins, you will need to create a lockfile (/var/lock/LCK..ttyS0)
on my Redhat 5.2 system. Just touch it, the contents are not important.
They may be someday. But not yet. You might need to be "root" for that.

Run 'perl Makefile.PL' followed by 'make'. This will create install files
and directories. Run 'make test' with nothing connected to "/dev/ttyS1".
This will run the tests and create a configuration_file. You can specify
a different port to test via 'perl Makefile.PL TESTPORT=<DEVICE>'.
Makefile.PL creates "t/DefaultPort.pm". You can also specify an alternate
port with the Shell Variable "Makefile_Test_Port".

The Benchmark routines are used to generate reports. The test suite
covers many of the module methods and sets the port for 9600 baud,
1 stop, 8 data, no parity, no handshaking, and other defaults. At
various points in the testing, it expects unconnected CTS and DTR lines.
The module should restore any port settings on exit. But this has not
been exhaustively tested yet.

Tests may also be run individually by typing:
        'perl test?.t Page_Delay [/dev/ttySx]'

With no delay, the tests execute too rapidly to follow from a command
line. Delay may be set from 0 to 5 seconds.

All tests are expected to pass - I would be very interested in hearing
about failures ("not ok"). These tests should be run from a command
prompt.  For details run "make test TEST_VERBOSE=1".

Subsequently, functional tests will not be executed unless DEVICE_SERIALPORT_PORT= is in your environment, where the value should be a value passable as TESTPORT as documented above.

One also must make sure the portage user can read and write to the serial port, and no devices are plugged into the serial port.

Also, I don't have any usable serial ports, so I look forward to feedback if anyone gets these tests working.