Commit 8c50e8c1 authored by Jim Harris's avatar Jim Harris Committed by Darek Stojaczyk
Browse files

test: handle align=0 in test_env spdk_malloc



DPDK treats align=0 as effectively align=8.  But the
test_env spdk_malloc uses posix_memalign and passes
the align as-is.  posix_memalign requires a non-zero
align parameter however.  So change the test_env
implementation to match DPDK.

This fixes libreduce unit tests, since it does some
allocations with default alignment.

Signed-off-by: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: If2fbad0bcc3bc92b50b50f21d7e893e0ba05e325

Reviewed-on: https://review.gerrithub.io/433083


Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent 08d36a55
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -72,6 +72,11 @@ spdk_malloc(size_t size, size_t align, uint64_t *phys_addr, int socket_id, uint3
	HANDLE_RETURN_MOCK(spdk_malloc);

	void *buf = NULL;

	if (align == 0) {
		align = 8;
	}

	if (posix_memalign(&buf, align, size)) {
		return NULL;
	}