From patchwork Thu Jan 17 20:20:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 258 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3569660C99 for ; Thu, 17 Jan 2019 21:20:49 +0100 (CET) Received: from localhost.localdomain (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id BB4C5B6B; Thu, 17 Jan 2019 21:20:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1547756448; bh=mGxI1pXDUlKvzQmSElf6jIE60e9w0WyjvPGhVKWrvic=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=luO2Vua1ec2rSNVOzfUjHvd2gPj8yGW1uJifK9RpdCawXG0JmTMh+nlt88rn8QxSs mdrnKvyeOFUkjH90DaspHPoIdOrChdYMJifDawbrM5I99wOlAgFKf8ir2lQKrt07G0 mjUDIq8Iu9SD0LI5Bu+yQ/w83oU/xltbLddzgDdc= From: Kieran Bingham To: LibCamera Devel Date: Thu, 17 Jan 2019 20:20:40 +0000 Message-Id: <20190117202043.21420-3-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190117202043.21420-1-kieran.bingham@ideasonboard.com> References: <20190117202043.21420-1-kieran.bingham@ideasonboard.com> Subject: [libcamera-devel] [PATCH 2/5] test: timer: Add a 32 bit wraparound test X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Jan 2019 20:20:49 -0000 Add a test which catches a timer running longer than the nanosecond resolution of 32 bits. Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- test/timer.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/timer.cpp b/test/timer.cpp index 3d1a78ac2768..c6a6ede73486 100644 --- a/test/timer.cpp +++ b/test/timer.cpp @@ -81,6 +81,19 @@ protected: return TestFail; } + /* + * 32 bit wrap test + * Nanosecond resolution in a 32 bit value wraps at 4.294967 + * seconds (0xFFFFFFFF / 1000000) + */ + timer.start(4295); + dispatcher->processEvents(); + + if (timer.isRunning() || timer.jitter() > 50) { + cout << "Timer expiration test failed" << endl; + return TestFail; + } + /* Timer restart. */ timer.start(500);