Re: [RFC PATCH 26/31] test: lmb: run lmb tests only manually

2024-06-09 Thread Sughosh Ganu
On Sat, 8 Jun 2024 at 10:09, Heinrich Schuchardt  wrote:
>
> On 6/7/24 20:52, Sughosh Ganu wrote:
> > The LMB code has been changed so that the memory reservations and
> > allocations are now persistent and global. With this change, the
> > design of the LMB tests needs to be changed accordingly. For now, mark
> > the LMB tests to be run only manually. The tests won't be run as part
> > of the unit test suite, and thus would not interfere with the running
> > of the rest of the tests.
>
> We should run important tests in the CI.
>
> You could trigger the 'manual' test from a Python test and reboot the
> system to get into an initial state.

Yes, that is one of the solutions that I have in mind. Will work on
this for the next version. Thanks.

-sughosh

>
> Best regards
>
> Heinrich
>
> >
> > Signed-off-by: Sughosh Ganu 
> > ---
> >   test/lib/lmb.c | 49 -
> >   1 file changed, 24 insertions(+), 25 deletions(-)
> >
> > diff --git a/test/lib/lmb.c b/test/lib/lmb.c
> > index 67a6be5bc3..813f7e3100 100644
> > --- a/test/lib/lmb.c
> > +++ b/test/lib/lmb.c
> > @@ -195,7 +195,7 @@ static int test_multi_alloc_512mb_x2(struct 
> > unit_test_state *uts,
> >   }
> >
> >   /* Create a memory region with one reserved region and allocate */
> > -static int lib_test_lmb_simple(struct unit_test_state *uts)
> > +static int lib_test_lmb_simple_norun(struct unit_test_state *uts)
> >   {
> >   int ret;
> >
> > @@ -207,10 +207,10 @@ static int lib_test_lmb_simple(struct unit_test_state 
> > *uts)
> >   /* simulate 512 MiB RAM beginning at 1.5GiB */
> >   return test_multi_alloc_512mb(uts, 0xE000);
> >   }
> > -LIB_TEST(lib_test_lmb_simple, 0);
> > +LIB_TEST(lib_test_lmb_simple_norun, UT_TESTF_MANUAL);
> >
> >   /* Create two memory regions with one reserved region and allocate */
> > -static int lib_test_lmb_simple_x2(struct unit_test_state *uts)
> > +static int lib_test_lmb_simple_x2_norun(struct unit_test_state *uts)
> >   {
> >   int ret;
> >
> > @@ -222,7 +222,7 @@ static int lib_test_lmb_simple_x2(struct 
> > unit_test_state *uts)
> >   /* simulate 512 MiB RAM beginning at 3.5GiB and 1 GiB */
> >   return test_multi_alloc_512mb_x2(uts, 0xE000, 0x4000);
> >   }
> > -LIB_TEST(lib_test_lmb_simple_x2, 0);
> > +LIB_TEST(lib_test_lmb_simple_x2_norun, UT_TESTF_MANUAL);
> >
> >   /* Simulate 512 MiB RAM, allocate some blocks that fit/don't fit */
> >   static int test_bigblock(struct unit_test_state *uts, const phys_addr_t 
> > ram)
> > @@ -275,7 +275,7 @@ static int test_bigblock(struct unit_test_state *uts, 
> > const phys_addr_t ram)
> >   return 0;
> >   }
> >
> > -static int lib_test_lmb_big(struct unit_test_state *uts)
> > +static int lib_test_lmb_big_norun(struct unit_test_state *uts)
> >   {
> >   int ret;
> >
> > @@ -287,7 +287,7 @@ static int lib_test_lmb_big(struct unit_test_state *uts)
> >   /* simulate 512 MiB RAM beginning at 1.5GiB */
> >   return test_bigblock(uts, 0xE000);
> >   }
> > -LIB_TEST(lib_test_lmb_big, 0);
> > +LIB_TEST(lib_test_lmb_big_norun, UT_TESTF_MANUAL);
> >
> >   /* Simulate 512 MiB RAM, allocate a block without previous reservation */
> >   static int test_noreserved(struct unit_test_state *uts, const phys_addr_t 
> > ram,
> > @@ -348,7 +348,7 @@ static int test_noreserved(struct unit_test_state *uts, 
> > const phys_addr_t ram,
> >   return 0;
> >   }
> >
> > -static int lib_test_lmb_noreserved(struct unit_test_state *uts)
> > +static int lib_test_lmb_noreserved_norun(struct unit_test_state *uts)
> >   {
> >   int ret;
> >
> > @@ -360,10 +360,9 @@ static int lib_test_lmb_noreserved(struct 
> > unit_test_state *uts)
> >   /* simulate 512 MiB RAM beginning at 1.5GiB */
> >   return test_noreserved(uts, 0xE000, 4, 1);
> >   }
> > +LIB_TEST(lib_test_lmb_noreserved_norun, UT_TESTF_MANUAL);
> >
> > -LIB_TEST(lib_test_lmb_noreserved, 0);
> > -
> > -static int lib_test_lmb_unaligned_size(struct unit_test_state *uts)
> > +static int lib_test_lmb_unaligned_size_norun(struct unit_test_state *uts)
> >   {
> >   int ret;
> >
> > @@ -375,13 +374,13 @@ static int lib_test_lmb_unaligned_size(struct 
> > unit_test_state *uts)
> >   /* simulate 512 MiB RAM beginning at 1.5GiB */
> >   return test_noreserved(uts, 0xE000, 5, 8);
> >   }
> > -LIB_TEST(lib_test_lmb_unaligned_size, 0);
> > +LIB_TEST(lib_test_lmb_unaligned_size_norun, UT_TESTF_MANUAL);
> >
> >   /*
> >* Simulate a RAM that starts at 0 and allocate down to address 0, which 
> > must
> >* fail as '0' means failure for the lmb_alloc functions.
> >*/
> > -static int lib_test_lmb_at_0(struct unit_test_state *uts)
> > +static int lib_test_lmb_at_0_norun(struct unit_test_state *uts)
> >   {
> >   const phys_addr_t ram = 0;
> >   const phys_size_t ram_size = 0x2000;
> > @@ -417,9 +416,9 @@ static int lib_test_lmb_at_0(struct unit_test_state 
> > *uts)
> >
> >   return 0;
> >   }
> > -LIB_TEST(

Re: [RFC PATCH 26/31] test: lmb: run lmb tests only manually

2024-06-07 Thread Heinrich Schuchardt

On 6/7/24 20:52, Sughosh Ganu wrote:

The LMB code has been changed so that the memory reservations and
allocations are now persistent and global. With this change, the
design of the LMB tests needs to be changed accordingly. For now, mark
the LMB tests to be run only manually. The tests won't be run as part
of the unit test suite, and thus would not interfere with the running
of the rest of the tests.


We should run important tests in the CI.

You could trigger the 'manual' test from a Python test and reboot the
system to get into an initial state.

Best regards

Heinrich



Signed-off-by: Sughosh Ganu 
---
  test/lib/lmb.c | 49 -
  1 file changed, 24 insertions(+), 25 deletions(-)

diff --git a/test/lib/lmb.c b/test/lib/lmb.c
index 67a6be5bc3..813f7e3100 100644
--- a/test/lib/lmb.c
+++ b/test/lib/lmb.c
@@ -195,7 +195,7 @@ static int test_multi_alloc_512mb_x2(struct unit_test_state 
*uts,
  }

  /* Create a memory region with one reserved region and allocate */
-static int lib_test_lmb_simple(struct unit_test_state *uts)
+static int lib_test_lmb_simple_norun(struct unit_test_state *uts)
  {
int ret;

@@ -207,10 +207,10 @@ static int lib_test_lmb_simple(struct unit_test_state 
*uts)
/* simulate 512 MiB RAM beginning at 1.5GiB */
return test_multi_alloc_512mb(uts, 0xE000);
  }
-LIB_TEST(lib_test_lmb_simple, 0);
+LIB_TEST(lib_test_lmb_simple_norun, UT_TESTF_MANUAL);

  /* Create two memory regions with one reserved region and allocate */
-static int lib_test_lmb_simple_x2(struct unit_test_state *uts)
+static int lib_test_lmb_simple_x2_norun(struct unit_test_state *uts)
  {
int ret;

@@ -222,7 +222,7 @@ static int lib_test_lmb_simple_x2(struct unit_test_state 
*uts)
/* simulate 512 MiB RAM beginning at 3.5GiB and 1 GiB */
return test_multi_alloc_512mb_x2(uts, 0xE000, 0x4000);
  }
-LIB_TEST(lib_test_lmb_simple_x2, 0);
+LIB_TEST(lib_test_lmb_simple_x2_norun, UT_TESTF_MANUAL);

  /* Simulate 512 MiB RAM, allocate some blocks that fit/don't fit */
  static int test_bigblock(struct unit_test_state *uts, const phys_addr_t ram)
@@ -275,7 +275,7 @@ static int test_bigblock(struct unit_test_state *uts, const 
phys_addr_t ram)
return 0;
  }

-static int lib_test_lmb_big(struct unit_test_state *uts)
+static int lib_test_lmb_big_norun(struct unit_test_state *uts)
  {
int ret;

@@ -287,7 +287,7 @@ static int lib_test_lmb_big(struct unit_test_state *uts)
/* simulate 512 MiB RAM beginning at 1.5GiB */
return test_bigblock(uts, 0xE000);
  }
-LIB_TEST(lib_test_lmb_big, 0);
+LIB_TEST(lib_test_lmb_big_norun, UT_TESTF_MANUAL);

  /* Simulate 512 MiB RAM, allocate a block without previous reservation */
  static int test_noreserved(struct unit_test_state *uts, const phys_addr_t ram,
@@ -348,7 +348,7 @@ static int test_noreserved(struct unit_test_state *uts, 
const phys_addr_t ram,
return 0;
  }

-static int lib_test_lmb_noreserved(struct unit_test_state *uts)
+static int lib_test_lmb_noreserved_norun(struct unit_test_state *uts)
  {
int ret;

@@ -360,10 +360,9 @@ static int lib_test_lmb_noreserved(struct unit_test_state 
*uts)
/* simulate 512 MiB RAM beginning at 1.5GiB */
return test_noreserved(uts, 0xE000, 4, 1);
  }
+LIB_TEST(lib_test_lmb_noreserved_norun, UT_TESTF_MANUAL);

-LIB_TEST(lib_test_lmb_noreserved, 0);
-
-static int lib_test_lmb_unaligned_size(struct unit_test_state *uts)
+static int lib_test_lmb_unaligned_size_norun(struct unit_test_state *uts)
  {
int ret;

@@ -375,13 +374,13 @@ static int lib_test_lmb_unaligned_size(struct 
unit_test_state *uts)
/* simulate 512 MiB RAM beginning at 1.5GiB */
return test_noreserved(uts, 0xE000, 5, 8);
  }
-LIB_TEST(lib_test_lmb_unaligned_size, 0);
+LIB_TEST(lib_test_lmb_unaligned_size_norun, UT_TESTF_MANUAL);

  /*
   * Simulate a RAM that starts at 0 and allocate down to address 0, which must
   * fail as '0' means failure for the lmb_alloc functions.
   */
-static int lib_test_lmb_at_0(struct unit_test_state *uts)
+static int lib_test_lmb_at_0_norun(struct unit_test_state *uts)
  {
const phys_addr_t ram = 0;
const phys_size_t ram_size = 0x2000;
@@ -417,9 +416,9 @@ static int lib_test_lmb_at_0(struct unit_test_state *uts)

return 0;
  }
-LIB_TEST(lib_test_lmb_at_0, 0);
+LIB_TEST(lib_test_lmb_at_0_norun, UT_TESTF_MANUAL);

-static int lib_test_lmb_overlapping_add(struct unit_test_state *uts)
+static int lib_test_lmb_overlapping_add_norun(struct unit_test_state *uts)
  {
const phys_addr_t ram = 0x4000;
const phys_size_t ram_size = 0x2000;
@@ -433,10 +432,10 @@ static int lib_test_lmb_overlapping_add(struct 
unit_test_state *uts)

return 0;
  }
-LIB_TEST(lib_test_lmb_overlapping_add, 0);
+LIB_TEST(lib_test_lmb_overlapping_add_norun, UT_TESTF_MANUAL);

  /* Check that calling lmb_reserve with overlapping regions fails.

[RFC PATCH 26/31] test: lmb: run lmb tests only manually

2024-06-07 Thread Sughosh Ganu
The LMB code has been changed so that the memory reservations and
allocations are now persistent and global. With this change, the
design of the LMB tests needs to be changed accordingly. For now, mark
the LMB tests to be run only manually. The tests won't be run as part
of the unit test suite, and thus would not interfere with the running
of the rest of the tests.

Signed-off-by: Sughosh Ganu 
---
 test/lib/lmb.c | 49 -
 1 file changed, 24 insertions(+), 25 deletions(-)

diff --git a/test/lib/lmb.c b/test/lib/lmb.c
index 67a6be5bc3..813f7e3100 100644
--- a/test/lib/lmb.c
+++ b/test/lib/lmb.c
@@ -195,7 +195,7 @@ static int test_multi_alloc_512mb_x2(struct unit_test_state 
*uts,
 }
 
 /* Create a memory region with one reserved region and allocate */
-static int lib_test_lmb_simple(struct unit_test_state *uts)
+static int lib_test_lmb_simple_norun(struct unit_test_state *uts)
 {
int ret;
 
@@ -207,10 +207,10 @@ static int lib_test_lmb_simple(struct unit_test_state 
*uts)
/* simulate 512 MiB RAM beginning at 1.5GiB */
return test_multi_alloc_512mb(uts, 0xE000);
 }
-LIB_TEST(lib_test_lmb_simple, 0);
+LIB_TEST(lib_test_lmb_simple_norun, UT_TESTF_MANUAL);
 
 /* Create two memory regions with one reserved region and allocate */
-static int lib_test_lmb_simple_x2(struct unit_test_state *uts)
+static int lib_test_lmb_simple_x2_norun(struct unit_test_state *uts)
 {
int ret;
 
@@ -222,7 +222,7 @@ static int lib_test_lmb_simple_x2(struct unit_test_state 
*uts)
/* simulate 512 MiB RAM beginning at 3.5GiB and 1 GiB */
return test_multi_alloc_512mb_x2(uts, 0xE000, 0x4000);
 }
-LIB_TEST(lib_test_lmb_simple_x2, 0);
+LIB_TEST(lib_test_lmb_simple_x2_norun, UT_TESTF_MANUAL);
 
 /* Simulate 512 MiB RAM, allocate some blocks that fit/don't fit */
 static int test_bigblock(struct unit_test_state *uts, const phys_addr_t ram)
@@ -275,7 +275,7 @@ static int test_bigblock(struct unit_test_state *uts, const 
phys_addr_t ram)
return 0;
 }
 
-static int lib_test_lmb_big(struct unit_test_state *uts)
+static int lib_test_lmb_big_norun(struct unit_test_state *uts)
 {
int ret;
 
@@ -287,7 +287,7 @@ static int lib_test_lmb_big(struct unit_test_state *uts)
/* simulate 512 MiB RAM beginning at 1.5GiB */
return test_bigblock(uts, 0xE000);
 }
-LIB_TEST(lib_test_lmb_big, 0);
+LIB_TEST(lib_test_lmb_big_norun, UT_TESTF_MANUAL);
 
 /* Simulate 512 MiB RAM, allocate a block without previous reservation */
 static int test_noreserved(struct unit_test_state *uts, const phys_addr_t ram,
@@ -348,7 +348,7 @@ static int test_noreserved(struct unit_test_state *uts, 
const phys_addr_t ram,
return 0;
 }
 
-static int lib_test_lmb_noreserved(struct unit_test_state *uts)
+static int lib_test_lmb_noreserved_norun(struct unit_test_state *uts)
 {
int ret;
 
@@ -360,10 +360,9 @@ static int lib_test_lmb_noreserved(struct unit_test_state 
*uts)
/* simulate 512 MiB RAM beginning at 1.5GiB */
return test_noreserved(uts, 0xE000, 4, 1);
 }
+LIB_TEST(lib_test_lmb_noreserved_norun, UT_TESTF_MANUAL);
 
-LIB_TEST(lib_test_lmb_noreserved, 0);
-
-static int lib_test_lmb_unaligned_size(struct unit_test_state *uts)
+static int lib_test_lmb_unaligned_size_norun(struct unit_test_state *uts)
 {
int ret;
 
@@ -375,13 +374,13 @@ static int lib_test_lmb_unaligned_size(struct 
unit_test_state *uts)
/* simulate 512 MiB RAM beginning at 1.5GiB */
return test_noreserved(uts, 0xE000, 5, 8);
 }
-LIB_TEST(lib_test_lmb_unaligned_size, 0);
+LIB_TEST(lib_test_lmb_unaligned_size_norun, UT_TESTF_MANUAL);
 
 /*
  * Simulate a RAM that starts at 0 and allocate down to address 0, which must
  * fail as '0' means failure for the lmb_alloc functions.
  */
-static int lib_test_lmb_at_0(struct unit_test_state *uts)
+static int lib_test_lmb_at_0_norun(struct unit_test_state *uts)
 {
const phys_addr_t ram = 0;
const phys_size_t ram_size = 0x2000;
@@ -417,9 +416,9 @@ static int lib_test_lmb_at_0(struct unit_test_state *uts)
 
return 0;
 }
-LIB_TEST(lib_test_lmb_at_0, 0);
+LIB_TEST(lib_test_lmb_at_0_norun, UT_TESTF_MANUAL);
 
-static int lib_test_lmb_overlapping_add(struct unit_test_state *uts)
+static int lib_test_lmb_overlapping_add_norun(struct unit_test_state *uts)
 {
const phys_addr_t ram = 0x4000;
const phys_size_t ram_size = 0x2000;
@@ -433,10 +432,10 @@ static int lib_test_lmb_overlapping_add(struct 
unit_test_state *uts)
 
return 0;
 }
-LIB_TEST(lib_test_lmb_overlapping_add, 0);
+LIB_TEST(lib_test_lmb_overlapping_add_norun, UT_TESTF_MANUAL);
 
 /* Check that calling lmb_reserve with overlapping regions fails. */
-static int lib_test_lmb_overlapping_reserve(struct unit_test_state *uts)
+static int lib_test_lmb_overlapping_reserve_norun(struct unit_test_state *uts)
 {
const phys_addr_t ram = 0x4000;
const phys_size_