summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTreehugger Robot2017-09-26 18:46:32 -0500
committerGerrit Code Review2017-09-26 18:46:32 -0500
commit6832535cd5c409325aa4f257fdebf03080f0f9dc (patch)
treef77a417efea578a0c8dfeb7c5290c50c97996ab2 /libsync
parenta0dd1adab0010b61ea7ad2ebce3e9cc598cbe5bd (diff)
parent68223500ea8a7608b1446ac39428118e9b16f625 (diff)
downloadplatform-system-core-6832535cd5c409325aa4f257fdebf03080f0f9dc.tar.gz
platform-system-core-6832535cd5c409325aa4f257fdebf03080f0f9dc.tar.xz
platform-system-core-6832535cd5c409325aa4f257fdebf03080f0f9dc.zip
Merge "libsync: Add fence info tests"
Diffstat (limited to 'libsync')
-rw-r--r--libsync/tests/sync_test.cpp35
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
451TEST(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
467TEST(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
451TEST(StressTest, TwoThreadsSharedTimeline) { 486TEST(StressTest, TwoThreadsSharedTimeline) {
452 const int iterations = 1 << 16; 487 const int iterations = 1 << 16;
453 int counter = 0; 488 int counter = 0;