diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-06-19 15:53:56 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-06-19 15:55:01 +0200 |
commit | 361a400c5762b08647210cf4834dc4a2934ab1cf (patch) | |
tree | 202e4c3296fe7ba37f0fbbe3d10f60bd84782129 /testsuites/fstests/fsfseeko01/init.c | |
parent | bsp/lpc24xx: More flexible region configuration (diff) | |
download | rtems-361a400c5762b08647210cf4834dc4a2934ab1cf.tar.bz2 |
fstests/fsfseeko01: New test
Diffstat (limited to '')
-rw-r--r-- | testsuites/fstests/fsfseeko01/init.c | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/testsuites/fstests/fsfseeko01/init.c b/testsuites/fstests/fsfseeko01/init.c new file mode 100644 index 0000000000..b6de9a53d2 --- /dev/null +++ b/testsuites/fstests/fsfseeko01/init.c @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2012 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Obere Lagerstr. 30 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + +#include "tmacros.h" + +#include <sys/types.h> +#include <stdio.h> +#include <errno.h> +#include <inttypes.h> +#include <limits.h> + +static void test(void) +{ + FILE *file; + int rv; + const off_t off = sizeof(off_t) >= sizeof(int64_t) + ? INT64_MAX + : (sizeof(off_t) == sizeof(int32_t) ? INT32_MAX : 1); + off_t actual_off; + + errno = 0; + file = fopen("file", "w+"); + perror("fopen"); + rtems_test_assert(file != NULL); + + errno = 0; + rv = fseeko(file, off, SEEK_SET); + perror("fseeko"); + rtems_test_assert(rv == 0); + + errno = 0; + actual_off = ftello(file); + perror("ftello"); + rtems_test_assert(actual_off == off); + + errno = 0; + rv = fclose(file); + perror("fclose"); + rtems_test_assert(rv == 0); +} + +static void Init(rtems_task_argument arg) +{ + puts("\n\n*** TEST FSFSEEKO 1 ***"); + + test(); + + puts("*** END OF TEST FSFSEEKO 1 ***"); + + rtems_test_exit(0); +} + +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER + +#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 4 + +#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM + +#define CONFIGURE_MAXIMUM_TASKS 1 + +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#define CONFIGURE_INIT + +#include <rtems/confdefs.h> |