Page 1 of 1

Just a simple hint on test suite executed via Shell..

Posted: Thu Mar 14, 2013 3:29 pm
by Debbio
I report a case for people that want to execute test suite via shell cmd where program could stop under debug assert failure :

Here a block from thread test suite ..

Code: Select all

static void thd1_execute(void) {

  threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()-5, thread, "E");
  threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriority()-4, thread, "D");
  threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriority()-3, thread, "C");
  threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriority()-2, thread, "B");
  threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriority()-1, thread, "A");
  test_wait_threads();
  test_assert_sequence(1, "ABCDE");
}


So.. if you spawn a shell with LOWPRIO you have threads[..] with underflow priority value that does not pass the assert :

Code: Select all

Thread *chThdCreateI(void *wsp, size_t size,
                     tprio_t prio, tfunc_t pf, void *arg) {
  /* Thread structure is layed out in the lower part of the thread workspace.*/
  Thread *tp = wsp;

  chDbgCheckClassI();
 /** this one.. prio > HIGHPRIO */
  chDbgCheck((wsp != NULL) && (size >= THD_WA_SIZE(0)) &&
             (prio <= HIGHPRIO) && (pf != NULL),
             "chThdCreateI");
  SETUP_CONTEXT(wsp, size, pf, arg);
  return _thread_init(tp, prio);
}


Well is a simple thing but maybe useful for chibios users.
Please Giovanni verify if i'm wrong..thank you.

Re: Just a simple hint on test suite executed via Shell..

Posted: Thu Mar 14, 2013 6:52 pm
by Giovanni
Hi,

Thanks for reporting, you are not wrong.

Consider that the test suite is not a "normal" subsystem, it is meant for testing only under controlled conditions so it is not necessarily written to work under any condition.

Giovanni