[dpdk-dev] [PATCH 2/2] test: update common auto test

Pavan Nikhilesh pbhagavatula at caviumnetworks.com
Wed Mar 14 10:41:00 CET 2018


Update common auto test to include test for aligning values to multiples
of given integer.

Signed-off-by: Pavan Nikhilesh <pbhagavatula at caviumnetworks.com>
---
 test/test/test_common.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/test/test/test_common.c b/test/test/test_common.c
index d0342430f..e43cba49b 100644
--- a/test/test/test_common.c
+++ b/test/test/test_common.c
@@ -128,6 +128,18 @@ test_align(void)
 				FAIL("rte_is_aligned");
 		}
 	}
+
+	for (p = 1; p <= MAX_NUM / 2; p++) {
+		for (i = 1; i <= MAX_NUM / 2; i++) {
+			val = RTE_ALIGN_MUL_CEIL(i, p);
+			if (val % p != 0 || val < i)
+				FAIL_ALIGN("RTE_ALIGN_MUL_CEIL", i, p);
+			val = RTE_ALIGN_MUL_FLOOR(i, p);
+			if (val % p != 0 || val > i)
+				FAIL_ALIGN("RTE_ALIGN_MUL_FLOOR", i, p);
+		}
+	}
+
 	return 0;
 }
 
-- 
2.16.2



More information about the dev mailing list