Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/fs/tmpfs Simplify test_mount and log errors.



details:   https://anonhg.NetBSD.org/src/rev/1e214de74409
branches:  trunk
changeset: 785506:1e214de74409
user:      jmmv <jmmv%NetBSD.org@localhost>
date:      Sun Mar 17 01:16:45 2013 +0000

description:
Simplify test_mount and log errors.

If mount_tmpfs fails, show what the stderr output of the command was instead
of failing without details.

While doing this, remove the stupidity to deal with the optional arguments
to the test_mount routine.

diffstat:

 tests/fs/tmpfs/h_funcs.subr |  30 +++++++++++-------------------
 1 files changed, 11 insertions(+), 19 deletions(-)

diffs (47 lines):

diff -r b5338421bb6f -r 1e214de74409 tests/fs/tmpfs/h_funcs.subr
--- a/tests/fs/tmpfs/h_funcs.subr       Sun Mar 17 01:13:00 2013 +0000
+++ b/tests/fs/tmpfs/h_funcs.subr       Sun Mar 17 01:16:45 2013 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: h_funcs.subr,v 1.4 2011/02/21 10:14:29 pooka Exp $
+# $NetBSD: h_funcs.subr,v 1.5 2013/03/17 01:16:45 jmmv Exp $
 #
 # Copyright (c) 2005, 2006, 2007 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -40,25 +40,17 @@
        require_fs tmpfs
 
        Mount_Point=$(pwd)/mntpt
-       atf_check -s eq:0 -o empty -e empty mkdir ${Mount_Point}
-       if [ $# -gt 0 ]; then
-               mount -t tmpfs $* tmpfs ${Mount_Point} 2> mounterr
-               if [ $? -ne 0 ]; then
-                       if grep 'Operation not supp' mounterr > /dev/null ; then
-                               atf_skip "tmpfs not supported"
-                       fi 
-                       atf_fail "mount tmpfs"
-               fi
-        else
-               mount -t tmpfs tmpfs ${Mount_Point} 2> mounterr
-               if [ $? -ne 0 ]; then
-                       if grep 'Operation not supp' mounterr > /dev/null ; then
-                               atf_skip "tmpfs not supported"
-                       fi 
-                       atf_fail "mount tmpfs"
-               fi
+       atf_check -s eq:0 -o empty -e empty mkdir "${Mount_Point}"
+       echo "mount -t tmpfs ${*} tmpfs ${Mount_Point}"
+       mount -t tmpfs "${@}" tmpfs "${Mount_Point}" 2>mounterr
+       if [ "${?}" -ne 0 ]; then
+               cat mounterr 1>&2
+               if grep 'Operation not supported' mounterr > /dev/null; then
+                       atf_skip "tmpfs not supported"
+               fi 
+               atf_fail "Failed to mount a tmpfs file system"
        fi
-       cd ${Mount_Point}
+       cd "${Mount_Point}"
 }
 
 #



Home | Main Index | Thread Index | Old Index