Changeset 5e4bab7 in rtems for testsuites


Ignore:
Timestamp:
Aug 3, 2018, 8:21:20 PM (16 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
3278d20
Parents:
6f34f13
git-author:
Sebastian Huber <sebastian.huber@…> (08/03/18 20:21:20)
git-committer:
Sebastian Huber <sebastian.huber@…> (08/07/18 05:17:18)
Message:

libtests/block12: Use rtems_blkdev_create()

Update #3358.

File:
1 edited

Legend:

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

    r6f34f13 r5e4bab7  
    11/*
    2  * Copyright (c) 2012 embedded brains GmbH.  All rights reserved.
     2 * Copyright (c) 2012, 2018 embedded brains GmbH.  All rights reserved.
    33 *
    44 *  embedded brains GmbH
    5  *  Obere Lagerstr. 30
     5 *  Dornierstr. 4
    66 *  82178 Puchheim
    77 *  Germany
     
    1919#include "tmacros.h"
    2020
     21#include <sys/stat.h>
     22#include <assert.h>
    2123#include <errno.h>
     24#include <fcntl.h>
    2225#include <string.h>
     26#include <unistd.h>
    2327
    2428#include <rtems/blkdev.h>
     
    2832
    2933#define BLOCK_COUNT 15
     34
     35#define DISK_PATH "/disk"
    3036
    3137static int block_access_counts [BLOCK_COUNT];
     
    6066    rtems_blkdev_request_done(breq, RTEMS_SUCCESSFUL);
    6167  } else {
    62     errno = EINVAL;
    63     rv = -1;
     68    rv = rtems_blkdev_ioctl(dd, req, arg);
    6469  }
    6570
     
    8691{
    8792  rtems_status_code sc;
    88   dev_t dev = 0;
     93  int fd;
     94  int rv;
    8995  rtems_disk_device *dd;
    9096
    91   sc = rtems_disk_io_initialize();
    92   rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    93 
    94   sc = rtems_disk_create_phys(
    95     dev,
     97  sc = rtems_blkdev_create(
     98    DISK_PATH,
    9699    1,
    97100    BLOCK_COUNT,
    98101    test_disk_ioctl,
    99     NULL,
    100102    NULL
    101103  );
    102104  rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    103105
    104   dd = rtems_disk_obtain(dev);
    105   rtems_test_assert(dd != NULL);
     106  fd = open(DISK_PATH, O_RDWR);
     107  rtems_test_assert(fd >= 0);
     108
     109  rv = rtems_disk_fd_get_disk_device(fd, &dd);
     110  rtems_test_assert(rv == 0);
     111
     112  rv = close(fd);
     113  rtems_test_assert(rv == 0);
    106114
    107115  do_read_sequence(dd);
     
    117125  );
    118126
    119   sc = rtems_disk_release(dd);
    120   rtems_test_assert(sc == RTEMS_SUCCESSFUL);
    121 
    122   sc = rtems_disk_delete(dev);
    123   rtems_test_assert(sc == RTEMS_SUCCESSFUL);
     127  rv = unlink(DISK_PATH);
     128  rtems_test_assert(rv == 0);
    124129}
    125130
     
    139144#define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK
    140145
     146#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 4
     147
    141148#define CONFIGURE_BDBUF_BUFFER_MIN_SIZE 1
    142149#define CONFIGURE_BDBUF_BUFFER_MAX_SIZE 1
Note: See TracChangeset for help on using the changeset viewer.