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

4.11
Last change on this file since ad48ebb was 7b369af, checked in by Sebastian Huber <sebastian.huber@…>, on Apr 11, 2013 at 11:58:33 AM

testsuites: Fix warnings

  • Property mode set to 100644
File size: 1.5 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  puts( "\n\n*** FILE SYSTEM TEST ( " FILESYSTEM " ) ***" );
60
61  puts( "Initializing filesystem " FILESYSTEM );
62  test_initialize_filesystem();
63
64  rc=chroot(BASE_FOR_TEST);
65  rtems_test_assert(rc==0);
66
67  test();
68
69  break_out_of_chroot();
70
71  puts( "\n\nShutting down filesystem " FILESYSTEM );
72  test_shutdown_filesystem();
73
74  puts( "*** END OF FILE SYSTEM TEST ( " FILESYSTEM " ) ***" );
75  rtems_test_exit(0);
76}
Note: See TracBrowser for help on using the repository browser.