[4/6] eal: add unit tests for atomic bitset operations
Checks
Commit Message
Extend bitset tests to cover the basic operation of the
rte_bitset_atomic_*() family of functions.
Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
---
app/test/test_bitset.c | 48 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
Comments
On Fri, Aug 09, 2024 at 10:14:38PM +0200, Mattias R??nnblom wrote:
> Extend bitset tests to cover the basic operation of the
> rte_bitset_atomic_*() family of functions.
>
> Signed-off-by: Mattias R??nnblom <mattias.ronnblom@ericsson.com>
> ---
Tyler Retzlaff <roretzla@linux.microsoft.com>
> From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> Sent: Thursday, 12 September 2024 06.52
>
> On Fri, Aug 09, 2024 at 10:14:38PM +0200, Mattias R??nnblom wrote:
> > Extend bitset tests to cover the basic operation of the
> > rte_bitset_atomic_*() family of functions.
> >
> > Signed-off-by: Mattias R??nnblom <mattias.ronnblom@ericsson.com>
> > ---
>
> Tyler Retzlaff <roretzla@linux.microsoft.com>
Fixing this, for the benefit of Patchwork...
Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
On Wed, Oct 09, 2024 at 10:29:01PM +0200, Morten Brørup wrote:
> > From: Tyler Retzlaff [mailto:roretzla@linux.microsoft.com]
> > Sent: Thursday, 12 September 2024 06.52
> >
> > On Fri, Aug 09, 2024 at 10:14:38PM +0200, Mattias R??nnblom wrote:
> > > Extend bitset tests to cover the basic operation of the
> > > rte_bitset_atomic_*() family of functions.
> > >
> > > Signed-off-by: Mattias R??nnblom <mattias.ronnblom@ericsson.com>
> > > ---
> >
> > Tyler Retzlaff <roretzla@linux.microsoft.com>
>
> Fixing this, for the benefit of Patchwork...
>
> Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
thank you
@@ -222,6 +222,52 @@ test_flip(void)
rte_bitset_flip);
}
+static bool
+bitset_atomic_test(const uint64_t *bitset, size_t bit_num)
+{
+ return rte_bitset_atomic_test(bitset, bit_num,
+ rte_memory_order_relaxed);
+}
+
+static void
+bitset_atomic_set(uint64_t *bitset, size_t bit_num)
+{
+ rte_bitset_atomic_set(bitset, bit_num, rte_memory_order_relaxed);
+}
+
+static void
+bitset_atomic_clear(uint64_t *bitset, size_t bit_num)
+{
+ rte_bitset_atomic_clear(bitset, bit_num, rte_memory_order_relaxed);
+}
+
+static void
+bitset_atomic_flip(uint64_t *bitset, size_t bit_num)
+{
+ rte_bitset_atomic_flip(bitset, bit_num, rte_memory_order_relaxed);
+}
+
+static void
+bitset_atomic_assign(uint64_t *bitset, size_t bit_num, bool bit_value)
+{
+ rte_bitset_atomic_assign(bitset, bit_num, bit_value,
+ rte_memory_order_relaxed);
+}
+
+static int
+test_atomic_set_clear(void)
+{
+ return test_set_clear_fun(bitset_atomic_test, bitset_atomic_set,
+ bitset_atomic_clear);
+}
+
+static int
+test_atomic_flip(void)
+{
+ return test_flip_fun(bitset_atomic_test, bitset_atomic_assign,
+ bitset_atomic_flip);
+}
+
static ssize_t
find(const bool *ary, size_t num_bools, size_t start, size_t len, bool set)
{
@@ -868,6 +914,8 @@ static struct unit_test_suite bitset_tests = {
.unit_test_cases = {
TEST_CASE_ST(NULL, NULL, test_set_clear),
TEST_CASE_ST(NULL, NULL, test_flip),
+ TEST_CASE_ST(NULL, NULL, test_atomic_set_clear),
+ TEST_CASE_ST(NULL, NULL, test_atomic_flip),
TEST_CASE_ST(NULL, NULL, test_find),
TEST_CASE_ST(NULL, NULL, test_foreach),
TEST_CASE_ST(NULL, NULL, test_count),