Merge "libsync: Add fence info tests"

am: 6832535cd5

Change-Id: I434ca616c410cf4898b8428d2035fc17220e618d
This commit is contained in:
Alexandros Frantzis 2017-09-26 23:58:18 +00:00 committed by android-build-merger
commit b5876fe3ed

View file

@ -448,6 +448,41 @@ TEST(FenceTest, MultiTimelineWait) {
ASSERT_EQ(mergedFence.wait(100), 0);
}
TEST(FenceTest, GetInfoActive) {
SyncTimeline timeline;
ASSERT_TRUE(timeline.isValid());
SyncFence fence(timeline, 1);
ASSERT_TRUE(fence.isValid());
vector<SyncPointInfo> info = fence.getInfo();
ASSERT_EQ(info.size(), 1);
ASSERT_FALSE(info[0].driverName.empty());
ASSERT_FALSE(info[0].objectName.empty());
ASSERT_EQ(info[0].timeStampNs, 0);
ASSERT_EQ(info[0].status, 0);
}
TEST(FenceTest, GetInfoSignaled) {
SyncTimeline timeline;
ASSERT_TRUE(timeline.isValid());
SyncFence fence(timeline, 1);
ASSERT_TRUE(fence.isValid());
ASSERT_EQ(timeline.inc(1), 0);
ASSERT_EQ(fence.wait(), 0);
vector<SyncPointInfo> info = fence.getInfo();
ASSERT_EQ(info.size(), 1);
ASSERT_FALSE(info[0].driverName.empty());
ASSERT_FALSE(info[0].objectName.empty());
ASSERT_GT(info[0].timeStampNs, 0);
ASSERT_EQ(info[0].status, 1);
}
TEST(StressTest, TwoThreadsSharedTimeline) {
const int iterations = 1 << 16;
int counter = 0;