diff options
author | Alexandros Frantzis | 2017-09-15 01:45:40 -0500 |
---|---|---|
committer | Alexandros Frantzis | 2017-09-26 05:09:35 -0500 |
commit | 68223500ea8a7608b1446ac39428118e9b16f625 (patch) | |
tree | 23ab6a3926746612d0f6207cb86634b62ec145fa /libsync | |
parent | dea5e081ac0f94a83650a600af881b529817b6fd (diff) | |
download | platform-system-core-68223500ea8a7608b1446ac39428118e9b16f625.tar.gz platform-system-core-68223500ea8a7608b1446ac39428118e9b16f625.tar.xz platform-system-core-68223500ea8a7608b1446ac39428118e9b16f625.zip |
libsync: Add fence info tests
This patch adds regression tests to check that the fence info returned
by libsync contains valid data.
Test: sync-unit-tests
Change-Id: I0c57c49b7be563efc9a43f12381059f20e0a4e52
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Diffstat (limited to 'libsync')
-rw-r--r-- | libsync/tests/sync_test.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/libsync/tests/sync_test.cpp b/libsync/tests/sync_test.cpp index f08e97e2c..0fb86d6fc 100644 --- a/libsync/tests/sync_test.cpp +++ b/libsync/tests/sync_test.cpp | |||
@@ -448,6 +448,41 @@ TEST(FenceTest, MultiTimelineWait) { | |||
448 | ASSERT_EQ(mergedFence.wait(100), 0); | 448 | ASSERT_EQ(mergedFence.wait(100), 0); |
449 | } | 449 | } |
450 | 450 | ||
451 | TEST(FenceTest, GetInfoActive) { | ||
452 | SyncTimeline timeline; | ||
453 | ASSERT_TRUE(timeline.isValid()); | ||
454 | |||
455 | SyncFence fence(timeline, 1); | ||
456 | ASSERT_TRUE(fence.isValid()); | ||
457 | |||
458 | vector<SyncPointInfo> info = fence.getInfo(); | ||
459 | ASSERT_EQ(info.size(), 1); | ||
460 | |||
461 | ASSERT_FALSE(info[0].driverName.empty()); | ||
462 | ASSERT_FALSE(info[0].objectName.empty()); | ||
463 | ASSERT_EQ(info[0].timeStampNs, 0); | ||
464 | ASSERT_EQ(info[0].status, 0); | ||
465 | } | ||
466 | |||
467 | TEST(FenceTest, GetInfoSignaled) { | ||
468 | SyncTimeline timeline; | ||
469 | ASSERT_TRUE(timeline.isValid()); | ||
470 | |||
471 | SyncFence fence(timeline, 1); | ||
472 | ASSERT_TRUE(fence.isValid()); | ||
473 | |||
474 | ASSERT_EQ(timeline.inc(1), 0); | ||
475 | ASSERT_EQ(fence.wait(), 0); | ||
476 | |||
477 | vector<SyncPointInfo> info = fence.getInfo(); | ||
478 | ASSERT_EQ(info.size(), 1); | ||
479 | |||
480 | ASSERT_FALSE(info[0].driverName.empty()); | ||
481 | ASSERT_FALSE(info[0].objectName.empty()); | ||
482 | ASSERT_GT(info[0].timeStampNs, 0); | ||
483 | ASSERT_EQ(info[0].status, 1); | ||
484 | } | ||
485 | |||
451 | TEST(StressTest, TwoThreadsSharedTimeline) { | 486 | TEST(StressTest, TwoThreadsSharedTimeline) { |
452 | const int iterations = 1 << 16; | 487 | const int iterations = 1 << 16; |
453 | int counter = 0; | 488 | int counter = 0; |