source: rtems/testsuites/fstests/fsfseeko01/init.c @ 9baffdf

4.115
Last change on this file since 9baffdf was a0b1b5ed, checked in by Sebastian Huber <sebastian.huber@…>, on 12/15/14 at 13:19:43

Delete CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM

This define was superfluous, undocumented and used inconsistently.

  • Property mode set to 100644
File size: 2.2 KB
Line 
1/*
2 * Copyright (c) 2012 embedded brains GmbH.  All rights reserved.
3 *
4 *  embedded brains GmbH
5 *  Obere Lagerstr. 30
6 *  82178 Puchheim
7 *  Germany
8 *  <rtems@embedded-brains.de>
9 *
10 * The license and distribution terms for this file may be
11 * found in the file LICENSE in this distribution or at
12 * http://www.rtems.org/license/LICENSE.
13 */
14
15#ifdef HAVE_CONFIG_H
16  #include "config.h"
17#endif
18
19#include "tmacros.h"
20
21#include <sys/types.h>
22#include <stdio.h>
23#include <errno.h>
24#include <inttypes.h>
25#include <limits.h>
26
27const char rtems_test_name[] = "FSFSEEKO 1";
28
29static void test(void)
30{
31  FILE *file;
32  int rv;
33  const off_t off = sizeof(off_t) >= sizeof(int64_t)
34    ? INT64_MAX
35    : (sizeof(off_t) == sizeof(int32_t) ? INT32_MAX : 1);
36  off_t actual_off;
37  const long long_off = LONG_MAX;
38  long actual_long_off;
39
40  errno = 0;
41  file = fopen("file", "w+");
42  rtems_test_assert(file != NULL);
43  rtems_test_assert(errno == 0);
44
45  errno = 0;
46  rv = fseek(file, long_off, SEEK_SET);
47  rtems_test_assert(rv == 0);
48  rtems_test_assert(errno == 0);
49
50  errno = 0;
51  actual_long_off = ftell(file);
52  rtems_test_assert(actual_long_off == long_off);
53  rtems_test_assert(errno == 0);
54
55  errno = 0;
56  actual_off = ftello(file);
57  rtems_test_assert(actual_off == long_off);
58  rtems_test_assert(errno == 0);
59
60  errno = 0;
61  rv = fseeko(file, off, SEEK_SET);
62  rtems_test_assert(rv == 0);
63  rtems_test_assert(errno == 0);
64
65  errno = 0;
66  actual_long_off = ftell(file);
67  rtems_test_assert(actual_long_off == -1L);
68  rtems_test_assert(errno == EOVERFLOW);
69
70  errno = 0;
71  actual_off = ftello(file);
72  rtems_test_assert(actual_off == off);
73  rtems_test_assert(errno == 0);
74
75  errno = 0;
76  rv = fclose(file);
77  rtems_test_assert(rv == 0);
78  rtems_test_assert(errno == 0);
79}
80
81static void Init(rtems_task_argument arg)
82{
83  TEST_BEGIN();
84
85  test();
86
87  TEST_END();
88  rtems_test_exit(0);
89}
90
91#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
92#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
93
94#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 4
95
96#define CONFIGURE_MAXIMUM_TASKS 1
97
98#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
99
100#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
101
102#define CONFIGURE_INIT
103
104#include <rtems/confdefs.h>
Note: See TracBrowser for help on using the repository browser.