summaryrefslogtreecommitdiff
path: root/tests/auto/qserialport/tst_qserialport.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Skip the constructByInfo() test if no serial ports are found on *nixDenis Shienkov2015-01-161-1/+15
| | | | | | | | | | | In unix-like systems it is possible to use socat to creation of the virtual serial ports. But these devices are symlinks on the /dev/pts devices, that is not a serial ports. Thus QSPI can not find it and will construct a null object. In this case this is not an error and we need just to skip test. Change-Id: I59bbb3c4653555be39ea6fff903c386065c10d0a Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
* Share the clearReceiver() function and for the *nix testsDenis Shienkov2015-01-151-6/+2
| | | | | | | | | | | | | The waitForReadyReadWithTimeout() test is failed when using the socat utility. The reason is that the receiver's side receive data from the previous waitForBytesWritten() test, even the receiver was closed and re-opened again in the new test. We need suppress this behavior using the clearReceiver() function when starting of waitForReadyReadWithTimeout() test. Change-Id: I6735aa9c9744ec1732f9bd4f701068a540ae2316 Reviewed-by: Laszlo Papp <lpapp@kde.org> Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
* Autotest misconfiguration error message is more verboseSergey Belyashov2014-12-011-2/+16
| | | | | | | | Error message about missing environment variables generates list of required variables. Change-Id: Icbb680abbd9fc5d0549907b7399757d943c6d535 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Merge remote-tracking branch 'origin/5.3' into 5.4Frederik Gladhorn2014-10-141-7/+84
|\ | | | | | | Change-Id: Id7e66059233e8d07ba44cad19048d9cddc68e250
| * Restart of async reading when a QSP::clear() is calledDenis Shienkov2014-10-031-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The method QSP::clear() can stall reading in case of following situations: - at the moment when PurgeComm abort of previously started asynchronous reading operation - when a serial port is in hardware flow control mode - when a serial port has a limited read buffer size Therefore is necessary restart of asynchronous reading to enable of the read sequence. Change-Id: I7a722a1ee20ecba0dd631da96ca81d2937d7ca6b Reviewed-by: Robert Kurjata <rkurjata@gmail.com> Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
| * Fix reading on Windows at limited read buffer sizeDenis Shienkov2014-10-021-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In case the read buffer has a limited size then are impossible to read remainder which is still can be in driver's queue, since no readyRead signal emmitted and reading are stalled. Problem is that Windows does not fire the EV_RXCHAR event in case a driver's queue has ready to read remainder; this event will be triggered only when a new data are received. The solution is to start of asynchronous read operation for reading of possible remainder from the queue after doing QSP::read() from the user. Besides is necessary to meet conditions: - do not start reading in case a reading already is started - do not start reading in case is not in limited buffer size - do not start reading in case is a previous reading returns a less data than read buffer size or are not in the hardware flow control mode Tested on Windows 8 with virtual com0com serial ports using Qt5 and then Qt4. Task-number: QTBUG-41295 Change-Id: I01797e6f8d6006751244144fead3616b1de1b811 Reviewed-by: Robert Kurjata <rkurjata@gmail.com> Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
| * Fix typo in twoStageSynchronousLoopback testDenis Shienkov2014-09-281-2/+2
| | | | | | | | | | | | | | | | | | Commit f1761c1236edce428278f7a9e8aa1091097eaa57 introduce a typo for receiverPort and senderPort variables, that lead to failure of test. Change-Id: I18ecad78bb11d7bb218a674c3c3bf9c863a2b33c Reviewed-by: Samuel Gaist <samuel.gaist@edeltech.ch> Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
| * Fix order of passed parameters into QCOMPAREDenis Shienkov2014-09-281-7/+7
| | | | | | | | | | | | | | | | According to documentation the QCOMPARE should accept to the first parameter an actual value, and to the second parameter an expected value. Change-Id: I64e762e779fa6a61401f358c4dd6097dacf7a33a Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
* | Merge remote-tracking branch 'origin/5.3' into 5.4Frederik Gladhorn2014-09-161-4/+160
|\ \ | |/ | | | | | | | | | | Conflicts: .qmake.conf Change-Id: I5887622f233275703cca8cc2a5db4aaaccc72d97
| * Make tst_qtserialport build with Qt 4Samuel Gaist2014-09-121-4/+5
| | | | | | | | | | | | | | | | | | The newly moved twoStageSynchronousLoopback fails to compile since there's no qCompare available for int and long long with Qt 4. This patch allows to build it again with Qt 4 Change-Id: Ib3764b125f371ae70864bd578c7ccda39d08ae22 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
| * Fix a race condition at writing on Windowsv5.3.25.3.2Denis Shienkov2014-08-281-0/+155
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. The writeStarted flag shall be reset to false after bytesWritten() signal is emitted, but not before it. 2. In case of start of writing from the startAsyncWriteTimer it is necessary to call the startAsyncWrite() method but not the completeAsyncWrite() method. It give guarantees to exclude of race condition to multiple call of the WriteFile twice until the write operation is not completed. For example, a race condition is watched in case of writing data from the slots which are connected to the bytesWritten() signal from a device; or to the timeout() signal from a timer with zero interval. To checking of these scenarios are added additional autotests. Tested on Windows 8 with the on-board and USB serial ports, using Qt5. Task-number: QTBUG-40769 Change-Id: Iedabbf38847debeee795a10fd7a4c54c65d2a338 Reviewed-by: Patrick Noffke <patrick.noffke@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* | Update license headers and add new license filesAntti Kokko2014-09-091-18/+10
|/ | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 & LICENSE.GPLv2 - Removed LICENSE.GPL Change-Id: I08685205169cdd4b49a651ed98f36ba1e6c1bb29 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
* Move the synchronous loopback test from benchmarks to auto testsDenis Shienkov2014-08-031-0/+28
| | | | | | | | | | | | | | | Previous commit 76f293bfb0fd7bab391f96ac822eacc40e4c5176 with adding of this test to the benchmarks were hasty. After all it makes sense to place it to auto tests to have opportunity to run with others together. Besides, this test is renamed since it is not a loopback, it is an I/O test with the synchronous approach. Change-Id: I043a6e0075561167bb29a59a384554ef98dbbd4a Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Fix events handling in waitForBytesWritten() method on WindowsDenis Shienkov2014-07-301-3/+48
| | | | | | | | | | | | | | | | | | | | | In case of communication event is triggered in the waitForBytesWritten() method then necessary to process it with the _q_completeAsyncCommunication() method, but not with the _q_completeAsyncRead() method. Otherwise it leads to false filling of the readBuffer with the data that were read earlier (or with garbage) which remained in readChunkBuffer. The synchronous loopback autotest reproduces a bug without of this patch. Tested on Windows 7/8 with the on-board and USB serial ports, using Qt5. Task-number: QTBUG-40344 Change-Id: I679109b60f4058c4c6f7e5f02c1f70ba6039d8d8 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
* Fix waitForReadyRead() on windowsDenis Shienkov2014-06-031-0/+103
| | | | | | | | | | | | | | | | | | | | | | | | The commit 2360c401ae2012ed1b5a2b470a088cbbdb0d7f27 introduced an regression into waitForReadyRead(). Before this commit each read transaction was started again until the zero number of bytes will returns from FIFO. When FIFO is empty, all data has been read, and only then the waitForReadyRead() return true. I.e. condition "qint64(readBuffer.size()) != currentReadBufferSize" does not mean that reading is finished. But after that commit this condition is incorrect, because now each read operation started once and can not return zero bytes (in case the number of read bytes less than ReadChunkSize). Thus it led to returning of TimeoutError error. Now, this issue has been fixed. Also is added the set of auto-tests to testing of the waitForReadyRead() method. Tested on Windows 7/8 using Qt5 and then Qt4. Task-number: QTBUG-39314 Change-Id: I8abbf986c2a1cc77af634ddbc1747fb46f416a39 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Add test for the waitForBytesWritten() methodDenis Shienkov2014-05-261-0/+16
| | | | | | Change-Id: I4a6767196d205cf1f0715edfb9ea117a2d7fa5c9 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Fix compilation of qserialport auto-test with Qt4Denis Shienkov2014-05-261-0/+8
| | | | | | | | | | | | | 1. The QCOMPARE macro can not make type cast between "int" and "qint64", though on qt5 there are no problems. 2. The QSKIP macro should accept two input parameters. Tested build on Lixux 64bit and Windows with Qt4 and then Qt5. Change-Id: I1f8497201e8d704098faea789bc61829f0d2f9e4 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Fix compilation of qserialport auto-test with Qt4Denis Shienkov2014-05-231-4/+4
| | | | | | | | | | | In qt4 the macro QCOMPARE can not make type cast between "int" and "qint64", though on qt5 there are no problems. Tested build on Lixux 64bit with Qt4 and then Qt5. Change-Id: I258f8ee4d26b65cc81720d66714ef69df23e7266 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Add a unit test to verify flush()Denis Shienkov2014-05-131-0/+96
| | | | | | | | On Windows a test will be skipped since flush() does not work there Change-Id: Ibda38401aff5f1c50644c6d61f9802217146a4fb Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
* Fix the default constructor test caseDenis Shienkov2014-05-031-3/+4
| | | | | | | | | Commit 7c737e0edcb93585856c65890ef34e5c5a28ee6b introduced this regression by changing the default baud rate from 0 to 9600. Change-Id: If20315eb53c3416646541dda82add0f4fc12d4a3 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Laszlo Papp <lpapp@kde.org>
* Obsolete the "settings restore on close" APILaszlo Papp2014-03-071-1/+0
| | | | | | | | | Now that the settings detection is removed, it would be better to make this API deprecate because it does not make much sense anymore. It was a bad idea to add this, but we cannot remove it for now, hence the obsoletion. Change-Id: I5e02959cb54281995b911ff0f64bd2fa36b80060 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
* Add the minimal set of the base auto testsv5.3.0-alpha1Denis Shienkov2014-02-221-0/+219
Added two types of tests: the constructing tests and the opening tests. The construction tests are checking of the getters to return of default values. Also are checking a correctness work of the constructor of class with different types of a port name. The opening tests are checking the open() method with the valid/invalid open modes and with the valid/invalid port names. The results are compared with the expected behavior (with the error codes and the return values). Change-Id: I503adf629cf613844bf9b96d8704ff017ea5fcdb Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>