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

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
Debbio
Posts: 16
Joined: Fri Jan 11, 2013 10:42 am

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

Post 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.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

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

Post 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
Post Reply