[rtems commit] fstests: Use global environment and clean up

Sebastian Huber sebh at rtems.org
Wed Jan 30 16:03:40 UTC 2013


Module:    rtems
Branch:    master
Commit:    065441d80f4671f067c7e08941e1f41256128b4d
Changeset: http://git.rtems.org/rtems/commit/?id=065441d80f4671f067c7e08941e1f41256128b4d

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed Jan 30 17:01:07 2013 +0100

fstests: Use global environment and clean up

This releases all resources acquired by the chroot().

---

 testsuites/fstests/support/fstest_support.c |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/testsuites/fstests/support/fstest_support.c b/testsuites/fstests/support/fstest_support.c
index 51f19c1..cbd8326 100644
--- a/testsuites/fstests/support/fstest_support.c
+++ b/testsuites/fstests/support/fstest_support.c
@@ -16,11 +16,12 @@
 #include <fcntl.h>
 #include <string.h>
 #include <unistd.h>
-#include <stdlib.h> /* exit */
+#include <stdlib.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 
-#include "rtems.h"
+#include <rtems.h>
+#include <rtems/userenv.h>
 
 #include "fstest_support.h"
 #include "fs_config.h"
@@ -31,7 +32,17 @@
 /* Break out of a chroot() environment in C */
 static void break_out_of_chroot(void)
 {
-  chroot("/");
+  int rv;
+  struct stat st;
+
+  rtems_libio_use_global_env();
+
+  /* Perform deferred global location releases */
+  rv = stat(".", &st);
+  rtems_test_assert(rv == 0);
+
+  /* Perform deferred memory frees */
+  free(malloc(1));
 }
 
 /*




More information about the vc mailing list