Current-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
atf for libcurses
Folks,
I have been working on a method of testing the curses library for some
time and I think I finally have something that is functional enough
for others to look at. I have put the code in a tarball at
ftp.netbsd.org:/pub/NetBSD/misc/blymn/libcurses.tar.gz. This is
intended to be unpacked in the src/tests/lib directory and will
install an atf test in /usr/tests/lib/libcurses with 3 functional
tests.
In the tests subdirectory in the source tree there are some extra
tests that do not have any output check files written for them but
they do serve to demonstrate more of the testframe capabilities.
There is also a file named testframe.txt which explains a bit of how
the testing is done. For the impatient, I use two cooperating
processes connected together via a pty and a couple of pipes. One
process, the director, reads the test file for instructions on what to
do. The director passes commands to the other processor, the slave,
which executes the commands and passes back return values via another
pipe. Commands that cause a screen refresh have a parameter that is
the name of a file that conatins the sequence of characters that
should be emitted via the pty by the slave, the director compares the
contents of the file with the slave data and if they match then the
test passed. When I say commands here, most of the commands map
directly on to libcurses calls which the slave executes, return values
from the commands can be saved in variables and then used in
subsequent calls, for example:
call win1 newwin 6 6 2 5
check win1 NON_NULL
call OK wmove $win1 1 1
call OK wprintw $win1 "%s" "xxxx"
This sequence creates a new window 6 lines by 6 columns at row 2
column 5 and assinges the returned window pointer to the variable
"win1". The value of win1 is validated to ensure it is not a null
(check would fail the test if win1 was NULL). We then move the cursor
to row 1 column 1 within win1 - we expect an OK response from this
call. Finally we use printw to print a string into win1, again
expecting an OK return.
I have tried to make an atf(1) style test using what I have done, that
is what is in the tar file. I am looking for feedback/suggestions for
what I have done. I would like to commit the code into the tree at
some stage so I want to make sure that I have the building and test
frameworks correct.
--
Brett Lymn
"Warning:
The information contained in this email and any attached files is
confidential to BAE Systems Australia. If you are not the intended
recipient, any use, disclosure or copying of this email or any
attachments is expressly prohibited. If you have received this email
in error, please notify us immediately. VIRUS: Every care has been
taken to ensure this email and its attachments are virus free,
however, any loss or damage incurred in using this email is not the
sender's responsibility. It is your responsibility to ensure virus
checks are completed before installing any data sent in this email to
your computer."
Home |
Main Index |
Thread Index |
Old Index