From 92198537a6ec039dc68dcc162766882f57b85755 Mon Sep 17 00:00:00 2001 From: Artur Harasimiuk Date: Tue, 13 Feb 2018 13:02:40 +0100 Subject: [PATCH] enable gcc7 with address sanitizer because of deffered deletion some variables are dereferenced after leaving test scope. this causes invalid stack memory accesses reported by GCC 7. Change-Id: I183be8ec3c815a41a75a1f71635d9afb560c7457 --- manifests/manifest.yml | 2 +- .../linux/drm_memory_manager_tests.cpp | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/manifests/manifest.yml b/manifests/manifest.yml index adba7cd9a0..fefc6860ca 100644 --- a/manifests/manifest.yml +++ b/manifests/manifest.yml @@ -31,7 +31,7 @@ components: branch: infra clean_on_sync: true dest_dir: infra - revision: b78ce68f547ede0beabb9333a6568703537ac515 + revision: 67529f98817725900c58e7fdb1b8eddbae448971 type: git internal: branch: master diff --git a/unit_tests/os_interface/linux/drm_memory_manager_tests.cpp b/unit_tests/os_interface/linux/drm_memory_manager_tests.cpp index ae7bc93a9b..e640373a12 100644 --- a/unit_tests/os_interface/linux/drm_memory_manager_tests.cpp +++ b/unit_tests/os_interface/linux/drm_memory_manager_tests.cpp @@ -135,6 +135,9 @@ class DrmMemoryManagerFixture : public MemoryManagementFixture { this->mock = nullptr; MemoryManagementFixture::TearDown(); } + + protected: + DrmMockCustom::IoctlResExt ioctlResExt = {0, 0}; }; typedef Test DrmMemoryManagerTest; @@ -781,9 +784,8 @@ TEST_F(DrmMemoryManagerTest, Given32bitAllocatorWhenAskedForBufferCreatedFrom64B TEST_F(DrmMemoryManagerTest, givenMemoryManagerWhenAskedFor32BitAllocationWithHostPtrAndAllocUserptrFailsThenFails) { mock->ioctl_expected = 1; - DrmMockCustom::IoctlResExt ioctlToPass = {0, -1}; - - mock->ioctl_res_ext = &ioctlToPass; + this->ioctlResExt = {0, -1}; + mock->ioctl_res_ext = &ioctlResExt; auto size = 10u; void *host_ptr = (void *)0x1000; @@ -795,9 +797,8 @@ TEST_F(DrmMemoryManagerTest, givenMemoryManagerWhenAskedFor32BitAllocationWithHo TEST_F(DrmMemoryManagerTest, givenMemoryManagerWhenAskedFor32BitAllocationAndAllocUserptrFailsThenFails) { mock->ioctl_expected = 1; - DrmMockCustom::IoctlResExt ioctlToPass = {0, -1}; - - mock->ioctl_res_ext = &ioctlToPass; + this->ioctlResExt = {0, -1}; + mock->ioctl_res_ext = &ioctlResExt; auto size = 10u; auto allocation = memoryManager->allocate32BitGraphicsMemory(size, nullptr); @@ -1469,8 +1470,9 @@ TEST_F(DrmMemoryManagerTest, givenMemoryManagerSupportingVirutalPaddingWhenItIsR TEST_F(DrmMemoryManagerTest, givenMemoryManagerSupportingVirutalPaddingWhenAllocUserptrFailsThenReturnsNullptr) { mock->ioctl_expected = 7; - DrmMockCustom::IoctlResExt ioctlToFail = {2, -1}; - mock->ioctl_res_ext = &ioctlToFail; + + this->ioctlResExt = {2, -1}; + mock->ioctl_res_ext = &ioctlResExt; //first let's create normal buffer auto bufferSize = MemoryConstants::pageSize;