Ignore:
Timestamp:
Jul 23, 2015, 7:00:31 AM (4 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
98a41f41
Parents:
19078dc6
Message:

i2c: Fix return status of i2c dev read/write

File:
1 edited

Legend:

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

    r19078dc6 r08135c85  
    7272typedef struct {
    7373  test_device base;
     74  bool eio;
    7475  unsigned current_address;
    7576  uint8_t data[EEPROM_SIZE];
     
    198199  i2c_msg *msg = &msgs[0];
    199200  uint32_t i;
     201
     202  if (dev->eio) {
     203    return -EIO;
     204  }
    200205
    201206  if (msg_count > 0 && (msg->flags & I2C_M_RD) == 0) {
     
    407412}
    408413
    409 static void test_eeprom(void)
     414static void test_eeprom(test_bus *bus)
    410415{
    411416  int rv;
     
    443448  memset(&out[0], 0, sizeof(out));
    444449
     450  bus->eeprom.eio = true;
     451
     452  errno = 0;
     453  n = read(fd_in, &in[0], 1);
     454  rtems_test_assert(n == -1);
     455  rtems_test_assert(errno == EIO);
     456
     457  errno = 0;
     458  n = write(fd_out, &out[0], 1);
     459  rtems_test_assert(n == -1);
     460  rtems_test_assert(errno == EIO);
     461
     462  bus->eeprom.eio = false;
     463
    445464  n = read(fd_in, &in[0], sizeof(in) + 1);
    446465  rtems_test_assert(n == (ssize_t) sizeof(in));
     
    609628
    610629  test_simple_read_write(bus, fd);
    611   test_eeprom();
     630  test_eeprom(bus);
    612631  test_gpio_nxp_pca9535();
    613632  test_switch_nxp_pca9548a();
Note: See TracChangeset for help on using the changeset viewer.