On 2023-10-10 13:56, David Marchand wrote:
On Mon, Oct 9, 2023 at 8:22 PM Mattias Rönnblom
<mattias.ronnb...@ericsson.com> wrote:
+static int
+test_dispatcher(void)
+{
+       return unit_test_suite_runner(&test_suite);
+}
+
+REGISTER_FAST_TEST(dispatcher_autotest, false, true, test_dispatcher);

Since this test expects some lcores, wdyt of adding:

@@ -1044,6 +1044,12 @@ static struct unit_test_suite test_suite = {
  static int
  test_dispatcher(void)
  {
+       if (rte_lcore_count() < NUM_SERVICE_CORES + 1) {
+               printf("Not enough cores for dispatcher_autotest,
expecting at least %u\n",
+                       NUM_SERVICE_CORES + 1);
+               return TEST_SKIPPED;
+       }
+
         return unit_test_suite_runner(&test_suite);
  }

This should avoid the failures we get with some CI env.
(additionnally, I tested this on my laptop and the test runs fine)



Indeed, this is a much better way than to fail the test case.

I'm thinking this is best done in test_setup(), since it's related to the setup. In case other test cases are added that required a different setup, there may be no minimum lcore requirement.

You will get multiple (four, for the moment) print-outs though, in case you run with fewer than 4 lcores.

I'll also make sure I skip (and not fail) the tests in case the DSW event device is not included in the build.

Reply via email to