DPDK patches and discussions
 help / color / mirror / Atom feed
From: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
To: jerin.jacob@caviumnetworks.com, thomas@monjalon.net
Cc: dev@dpdk.org, Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Subject: [dpdk-dev]  [PATCH 2/2] test: update common auto test
Date: Wed, 14 Mar 2018 15:11:00 +0530	[thread overview]
Message-ID: <20180314094100.12373-2-pbhagavatula@caviumnetworks.com> (raw)
In-Reply-To: <20180314094100.12373-1-pbhagavatula@caviumnetworks.com>

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

Signed-off-by: Pavan Nikhilesh <pbhagavatula@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

  reply	other threads:[~2018-03-14  9:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-14  9:40 [dpdk-dev] [PATCH 1/2] eal: add macros to align value to multiple Pavan Nikhilesh
2018-03-14  9:41 ` Pavan Nikhilesh [this message]
2018-03-15 23:53   ` [dpdk-dev] [PATCH 2/2] test: update common auto test Thomas Monjalon
2018-03-16  8:56     ` Pavan Nikhilesh
2018-03-14 10:42 ` [dpdk-dev] [PATCH 1/2] eal: add macros to align value to multiple Ananyev, Konstantin
2018-03-16  8:41   ` Pavan Nikhilesh
2018-03-20 13:24 ` [dpdk-dev] [PATCH v2] " Pavan Nikhilesh
2018-04-04  9:14   ` Thomas Monjalon
  -- strict thread matches above, loose matches on Subject: below --
2018-02-17 10:49 [dpdk-dev] [PATCH 1/2] eal: add API to align integer to previous power of 2 Pavan Nikhilesh
2018-02-17 10:49 ` [dpdk-dev] [PATCH 2/2] test: update common auto test Pavan Nikhilesh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180314094100.12373-2-pbhagavatula@caviumnetworks.com \
    --to=pbhagavatula@caviumnetworks.com \
    --cc=dev@dpdk.org \
    --cc=jerin.jacob@caviumnetworks.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).