source: rtems/testsuites/fstests/support/fstest_support.c @ d6da1b1

4.115
Last change on this file since d6da1b1 was bc75887, checked in by Sebastian Huber <sebastian.huber@…>, on 03/16/14 at 15:15:33

tests/fstests: Use <rtems/test.h>

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2011.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.com/license/LICENSE.
8 */
9
10#ifdef HAVE_CONFIG_H
11#include "config.h"
12#endif
13
14#include <stdio.h>
15#include <errno.h>
16#include <fcntl.h>
17#include <string.h>
18#include <unistd.h>
19#include <stdlib.h>
20#include <sys/stat.h>
21#include <sys/types.h>
22
23#include <rtems.h>
24#include <rtems/userenv.h>
25
26#include "fstest_support.h"
27#include "fs_config.h"
28
29#include "fstest.h"
30#include "pmacros.h"
31
32void *volatile prevent_compiler_optimizations;
33
34/* Break out of a chroot() environment in C */
35static void break_out_of_chroot(void)
36{
37  int rv;
38  struct stat st;
39
40  rtems_libio_use_global_env();
41
42  /* Perform deferred global location releases */
43  rv = stat(".", &st);
44  rtems_test_assert(rv == 0);
45
46  /* Perform deferred memory frees */
47  prevent_compiler_optimizations = malloc(1);
48  free(prevent_compiler_optimizations);
49}
50
51/*
52 *  Main entry point of every filesystem test
53 */
54
55rtems_task Init(
56    rtems_task_argument ignored)
57{
58  int rc=0;
59
60  TEST_BEGIN();
61
62  puts( "Initializing filesystem " FILESYSTEM );
63  test_initialize_filesystem();
64
65  rc=chroot(BASE_FOR_TEST);
66  rtems_test_assert(rc==0);
67
68  test();
69
70  break_out_of_chroot();
71
72  puts( "\n\nShutting down filesystem " FILESYSTEM );
73  test_shutdown_filesystem();
74
75  TEST_END();
76  rtems_test_exit(0);
77}
Note: See TracBrowser for help on using the repository browser.