Commit graph

66 commits

Author SHA1 Message Date
Ian Abbott
c45f319171 comedi_test: deal with INSN_GTOD values more carefully
Try and avoid arithmetic overflow when converting the difference between
two INSN_GTOD timestamps to a signed number of microseconds.
2016-06-20 11:29:14 +01:00
Ian Abbott
67a364cf93 comedi_test: attempt to change read and write subdevice during test
When testing streaming input (or streaming output) command functionality
for a subdevice, attempt to make it the current 'read' (or 'write')
subdevice by calling the new 'comedi_set_read_subdevice()' (or
'comedi_set_write_subdevice()') function.

That is currently only supported by the Linux "in-tree" version of
Comedi, since kernel version 3.19.  If the attempt fails, and the
subdevice is not the current 'read' (or 'write') subdevice, the test
will report "not applicable" as before.
2016-05-13 11:48:31 +01:00
Ian Abbott
9683559f51 comedi_test: fix test_cmd_write_fast_1chan() for big buffer
If the comedi data buffer is larger than the total size of the data
being written to the buffer in first test_cmd_write_fast_1chan(), the
first loop iterates endlessly writing 0 bytes to the buffer.  Break out
of the first loop once the required amount of data has been written.
2014-04-10 20:19:43 +01:00
Ian Abbott
82ee0c80e2 testing: remove unused variables in comedi_test program
Remove the global variable 'capabilities' which is set to 0 by the
get_capabilities() function but not used anywhere else.  Remove the
'type' and 'flags' local variables from get_capabilities() which are set
to the return values of comedi_get_subdevice_type() and
comedi_get_subdevice_flags() but never used.  Remove the 'tmp' local
variable from test_segfault(); it was involved in a volatile memory
access to test for segmentation faults.  Still do the volatile memory
access but don't use the variable.
2013-05-07 13:15:54 +01:00
Ian Abbott
23e8eb609e comedi_test: Remove unnecessary assignment of 'go' when checking data
The 'go' variable is only used by the 'while' loop that reads the data.
We don't need to set it in the 'for' loop that checks the data
afterwards.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
2011-06-27 13:08:08 +01:00
Ian Abbott
261d3e1029 comedi_test: Fix buffer overrun in test_mmap()
If the command does not stop immediately after the last sample, there
can be more data to read than we have room for.  Make sure the 'while'
loop 'read()' does not overrun the end of the malloc'ed 'buf'.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
2011-06-27 13:03:03 +01:00
Ian Abbott
0038ed1467 Handle COMEDI_SUBD_PWM and check for future unknown subdevice types. 2008-11-05 11:40:42 +00:00
Frank Mori Hess
b3873b7c79 Replaced a perror with comedi_perror 2008-03-28 15:55:03 +00:00
Frank Mori Hess
46bd0a16ba comedi_internal_trigger is provided by comedilib now. 2008-01-28 20:38:47 +00:00
Frank Mori Hess
242aa6405f Fixed another problem with mmap test on subdevice using lsampl_t. 2008-01-28 20:35:14 +00:00
Frank Mori Hess
115b6a66c1 Fixed bug in mmap test when run on subdevice with SDF_LSAMPL. 2008-01-28 20:27:19 +00:00
Ian Abbott
0145624108 Don't use SDF_WRITEABLE flag to check if read (or write) command is
applicable.  Instead, check that the specified subdevice matches the
read (or write) subdevice.
2008-01-28 16:10:11 +00:00
Ian Abbott
605fd55655 Fix use of INSN_GTOD so it works on 64-bit platforms.
A struct timeval is not the same size as a pair of lsampl_t's for 64-bit,
so can't point 'data' in a comedi_insn to a struct timeval and expect it
to work!
2007-11-07 13:01:50 +00:00
Frank Mori Hess
c1082cee65 Fixed comedi_get_cmd_generic_timed() by adding a chanlist_len
parameter.  Old version is still available in library, thanks to the
magic of the version_script.
2007-08-02 19:46:44 +00:00
Frank Mori Hess
933be9aae4 use SDF_RUNNING flag to test for completion of ao command 2005-03-16 19:05:34 +00:00
Frank Mori Hess
8fdb92784a patch from Ian Abbott <abbotti@mev.co.uk>:
I was running "comedi_test -v" on my new analog output driver and
noticed that it was getting stuck in a loop during the
"cmd_write_fast_1_chan" test.

It turned out that the test had written more data to the buffer than was
required to complete the acquisition (it was using cmd->stop_src =
TRIG_COUNT) and then got stuck in a loop waiting for the buffer to empty.

The attached patch stops the test_cmd_write_fast_1chan function writing
more data than is required to complete the acquisition.
2005-02-27 22:45:14 +00:00
Frank Mori Hess
766795510a add "serial" to subdevice_types 2004-08-14 20:33:46 +00:00
Frank Mori Hess
2afaa069bd insert usleep() in loop 2004-07-25 00:39:39 +00:00
Frank Mori Hess
c673de7c79 fix internal trigger when testing write command, and fix test when
write command uses stop_src==TRIG_NONE instead of TRIG_COUNT
2004-07-24 16:09:01 +00:00
Frank Mori Hess
e66997b981 fix test_segfault() so it works with 2.6 kernel signal handling behaviour 2004-07-24 15:47:30 +00:00
Frank Mori Hess
67319a9e99 fix for compiler warning about strict aliasing rules 2004-06-19 19:55:26 +00:00
David Schleef
9350128a51 new files 2003-11-20 18:40:30 +00:00
David Schleef
8ab858452b autoconfiscate 2003-05-02 07:53:44 +00:00
David Schleef
079a3235de need headers 2003-05-02 07:53:02 +00:00
David Schleef
b28c52a42f autoconfiscation 2003-05-02 07:19:00 +00:00
Frank Mori Hess
ea64ba8daa fixing includes for exit(), memset() for gcc 2.96 compiler warnings 2003-01-01 23:07:02 +00:00
David Schleef
847fb8c86c Fix for cases where the command doesn't allow source choices 2002-11-22 07:15:09 +00:00
David Schleef
087e6042d4 fix mmap testing 2002-11-22 06:48:39 +00:00
Frank Mori Hess
079da8bc72 new test results 2002-06-15 21:25:52 +00:00
David Schleef
c28b3ee400 *** empty log message *** 2002-06-07 00:18:48 +00:00
David Schleef
1303b4758c test reading 0 samples 2002-06-06 00:38:54 +00:00
David Schleef
09d8271d34 *** empty log message *** 2002-03-18 22:14:47 +00:00
David Schleef
b7d115eafa added output command test 2002-03-18 21:48:14 +00:00
David Schleef
52b66f2c89 Disabled streaming output on many of the command tests 2002-02-06 22:08:50 +00:00
David Schleef
d8b81aaea5 added 2001-10-04 20:17:55 +00:00
David Schleef
b76621f048 removed mode0_test from list of standard tests 2001-10-04 20:12:04 +00:00
David Schleef
8b5cd228fa Added long getopts and added help(), 'cuz I always forget how to use it 2001-07-30 20:40:26 +00:00
David Schleef
59deca7e48 Use ../Config. Fix 'make test'. 2001-07-15 23:24:00 +00:00
David Schleef
eceb3bccf8 Make stdout unbuffered, so that if stderr==stdout, lines match up. 2001-07-15 22:47:58 +00:00
David Schleef
b1aea5d077 Changed prototype of comedi_get_cmd_generic_timed 2001-07-15 22:47:14 +00:00
David Schleef
c9b062db15 Doesn't need to be static. Added test target 2001-07-15 22:46:37 +00:00
David Schleef
7973a0f2ad Change prototype of comedi_get_cmd_generic_timed 2001-07-15 22:39:54 +00:00
David Schleef
59568d2029 Moved chatter behind if(verbose) 2001-07-09 02:41:18 +00:00
David Schleef
77540a363b Uses deprecated functions, so added _COMEDILIB_DEPRECATED 2001-06-27 22:18:47 +00:00
David Schleef
a4fb3b20d9 Changed from siginfo handler to simple signal handler 2001-06-27 22:18:16 +00:00
David Schleef
e93771f219 Added realtime command line option. Fixed tests to use realtime
flag.  Added internal trigger test.
2001-06-12 10:41:09 +00:00
David Schleef
61111bfd43 Fix realtime flag. 2001-06-12 10:40:18 +00:00
David Schleef
8e530395fe Test for internal triggering. 2001-06-12 10:39:27 +00:00
David Schleef
0bd291780c fixes for cross-compilation 2001-06-12 10:36:25 +00:00
David Schleef
698938d995 additional tests, fixes, move some functions to ../lib 2001-05-28 02:39:00 +00:00