summaryrefslogtreecommitdiffstats
path: root/src/nfc
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@digia.com>2013-06-21 18:15:34 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-06-27 08:51:32 +0200
commit8989524761ee6deb85fc3dc15cceb10cae0c82d8 (patch)
tree5673b51235fc6ff7c7e6d39b3ba5dc35f810a33d /src/nfc
parente0cbd7d94b604890765c0a4415d4178422f93fcc (diff)
Fix test error in qnearfieldtagtype2 auto test due to race condition.
This assumes the use of the nfc emulator. The block selector call in tests/auto/qnearfieldtagtype2/tst_qnearfieldtagtype2.cpp line 221 fails as the execution of the sector selection requires multiple event loop turns. First it must loop to execute the second "SECTOR SELECT" packet (Command Packet 2). This will set NfcTagType2::currentSector to the new sector. The same packet will trigger a timer event in QNearFieldTagType2::handleResponse. During the second event loop run the above timer event will set QNearFieldTagType2::d->m_currentSector to the new sector. This will set the request ID for the sector select request to processed/finished. While the above two events have to happen the tst starts waiting for the completion of the sector selection request. The waiting period is merely 1 ms which is too short for the timer event to execute. Subsequently the test returns with an incomplete sector select request. Change-Id: I980e440b3431d2fb828e1753f5ef8ea622dd6d3a Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com> Reviewed-by: Aaron McCarthy <mccarthy.aaron@gmail.com>
Diffstat (limited to 'src/nfc')
-rw-r--r--src/nfc/qnearfieldtagtype2.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nfc/qnearfieldtagtype2.cpp b/src/nfc/qnearfieldtagtype2.cpp
index 576f6dba..41b228bf 100644
--- a/src/nfc/qnearfieldtagtype2.cpp
+++ b/src/nfc/qnearfieldtagtype2.cpp
@@ -272,7 +272,7 @@ bool QNearFieldTagType2::waitForRequestCompleted(const RequestId &id, int msecs)
QCoreApplication::processEvents(QEventLoop::WaitForMoreEvents, 1);
// detect passive ack
- if (timer.elapsed() >= 1)
+ if (timer.elapsed() >= 10)
break;
}