Changeset c1eb577 in rtems


Ignore:
Timestamp:
Oct 1, 2019, 7:53:05 AM (3 weeks ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
d4880509
Parents:
aeb981e
git-author:
Sebastian Huber <sebastian.huber@…> (10/01/19 07:53:05)
git-committer:
Sebastian Huber <sebastian.huber@…> (10/01/19 07:55:07)
Message:

libtests/record01: Fix test failure

Update #3665.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • testsuites/libtests/record01/init.c

    raeb981e rc1eb577  
    518518#define PORT 1234
    519519
     520typedef enum {
     521  HEADER_ARCH,
     522  HEADER_MULTILIB,
     523  HEADER_BSP,
     524  HEADER_VERSION_CONTROL_KEY,
     525  HEADER_TOOLS,
     526  HEADER_LAST
     527} header_state;
     528
    520529static uint32_t get_format(void)
    521530{
     
    545554}
    546555
     556static rtems_record_event hs_to_ev(header_state hs)
     557{
     558  switch (hs) {
     559    case HEADER_ARCH:
     560      return RTEMS_RECORD_ARCH;
     561    case HEADER_MULTILIB:
     562      return RTEMS_RECORD_MULTILIB;
     563    case HEADER_BSP:
     564      return RTEMS_RECORD_BSP;
     565    case HEADER_VERSION_CONTROL_KEY:
     566      return RTEMS_RECORD_VERSION_CONTROL_KEY;
     567    case HEADER_TOOLS:
     568      return RTEMS_RECORD_TOOLS;
     569    default:
     570      rtems_test_assert(0);
     571      return RTEMS_RECORD_EMPTY;
     572  }
     573}
     574
    547575static int connect_client(void)
    548576{
     
    554582  rtems_record_item item;
    555583  rtems_record_item items[8];
     584  header_state hs;
    556585
    557586  fd = socket(PF_INET, SOCK_STREAM, 0);
     
    593622  rtems_test_assert(item.data == rtems_counter_frequency());
    594623
    595   n = read(fd, items, sizeof(expected_items_13));
    596   rtems_test_assert(n == (ssize_t) sizeof(expected_items_13));
     624  hs = HEADER_ARCH;
     625  while (hs != HEADER_LAST) {
     626    n = read(fd, items, sizeof(items[0]));
     627    rtems_test_assert(n == (ssize_t) sizeof(items[0]));
     628
     629    if (items[0].event != hs_to_ev(hs)) {
     630      ++hs;
     631    }
     632
     633    rtems_test_assert(hs == HEADER_LAST || items[0].event == hs_to_ev(hs));
     634  }
     635
     636  n = read(fd, &items[1], sizeof(expected_items_13) - sizeof(items[0]));
     637  rtems_test_assert(
     638    n == (ssize_t) (sizeof(expected_items_13) - sizeof(items[0]))
     639  );
    597640  rtems_test_assert(
    598641    memcmp(items, expected_items_13, sizeof(expected_items_13)) == 0
Note: See TracChangeset for help on using the changeset viewer.