public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] Let's use isofs.sh as an ordinary test case
@ 2014-03-13 12:38 Stanislav Kholmanskikh
  2014-03-13 12:38 ` [LTP] [PATCH 1/3] isofs.sh: use $TMPDIR for temporary directory Stanislav Kholmanskikh
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Stanislav Kholmanskikh @ 2014-03-13 12:38 UTC (permalink / raw)
  To: ltp-list; +Cc: vasily.isaenko

Hi!

As for me, testscripts/ is not the best place to keep isofs.sh.

Maybe it would be better to use isofs.sh as an "ordinary" test
for ISO9660 file system. And this series does this.

Thank you.



------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [LTP] [PATCH 1/3] isofs.sh: use $TMPDIR for temporary directory
  2014-03-13 12:38 [LTP] Let's use isofs.sh as an ordinary test case Stanislav Kholmanskikh
@ 2014-03-13 12:38 ` Stanislav Kholmanskikh
  2014-03-13 20:55   ` Mike Frysinger
  2014-03-13 12:38 ` [LTP] [PATCH 2/3] isofs.sh: be more quiet Stanislav Kholmanskikh
  2014-03-13 12:38 ` [LTP] [RFC PATCH 3/3] Declare iso9660 fs testcase based on isofs.sh Stanislav Kholmanskikh
  2 siblings, 1 reply; 16+ messages in thread
From: Stanislav Kholmanskikh @ 2014-03-13 12:38 UTC (permalink / raw)
  To: ltp-list; +Cc: vasily.isaenko

If $TMPDIR is not set, use /tmp.

Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
---
 testscripts/isofs.sh |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/testscripts/isofs.sh b/testscripts/isofs.sh
index e6a3b09..9031922 100755
--- a/testscripts/isofs.sh
+++ b/testscripts/isofs.sh
@@ -60,21 +60,22 @@ NO_CLEANUP=""
   }
 
 #Initialize directory variables
-    MNT_POINT="/tmp/isofs_$$"
+    TMPDIR=${TMPDIR:-/tmp}
+    MNT_POINT="$TMPDIR/isofs_$$"
     COPY_DIR="/etc/"
-    TEMP_DIR="/tmp/for_isofs_test"
+    TEMP_DIR="$TMPDIR/for_isofs_test"
     MAKE_FILE_SYS_DIR=$TEMP_DIR$COPY_DIR
 
    while getopts :hnd: arg
       do  case $arg in
 	  d)
              COPY_DIR=$OPTARG
-    	     MAKE_FILE_SYS_DIR="/tmp/for_isofs_test"$COPY_DIR
+    	     MAKE_FILE_SYS_DIR=${TEMP_DIR}${COPY_DIR}
 	    ;;
 	  h)
 	    echo ""
             echo "n - The directories created will not be removed"
-            echo "d - Specify a directory to copy into /tmp"
+            echo "d - Specify a directory to copy into $TEMP_DIR"
 	    echo "h - Help options"
 	    echo ""
 	    usage
@@ -133,7 +134,7 @@ do
 	mkisofs -o isofs.iso -quiet $mkisofs_opt $MAKE_FILE_SYS_DIR
 	if [ $? != 0 ]
 	then
-		rm -rf isofs.iso $MNT_POINT
+		rm -rf isofs.iso $MNT_POINT $TEMP_DIR
 		echo "FAILED: mkisofs -o isofs.iso $mkisofs_opt $MAKE_FILE_SYS_DIR failed"
 		exit 1
 	fi
@@ -154,7 +155,7 @@ do
 		mount -t iso9660 -o $mount_opt isofs.iso $MNT_POINT
 		if [ $? != 0 ]
 		then
-			rm -rf isofs.iso $MNT_POINT
+			rm -rf isofs.iso $MNT_POINT $TEMP_DIR
 			echo "FAILED: mount -t iso9660 -o $mount_opt isofs.iso $MNT_POINT failed"
 			exit 1
 		fi
-- 
1.7.9.5


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [LTP] [PATCH 2/3] isofs.sh: be more quiet
  2014-03-13 12:38 [LTP] Let's use isofs.sh as an ordinary test case Stanislav Kholmanskikh
  2014-03-13 12:38 ` [LTP] [PATCH 1/3] isofs.sh: use $TMPDIR for temporary directory Stanislav Kholmanskikh
@ 2014-03-13 12:38 ` Stanislav Kholmanskikh
  2014-03-13 20:56   ` Mike Frysinger
  2014-03-13 12:38 ` [LTP] [RFC PATCH 3/3] Declare iso9660 fs testcase based on isofs.sh Stanislav Kholmanskikh
  2 siblings, 1 reply; 16+ messages in thread
From: Stanislav Kholmanskikh @ 2014-03-13 12:38 UTC (permalink / raw)
  To: ltp-list; +Cc: vasily.isaenko

Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
---
 testscripts/isofs.sh |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/testscripts/isofs.sh b/testscripts/isofs.sh
index 9031922..fd42a3c 100755
--- a/testscripts/isofs.sh
+++ b/testscripts/isofs.sh
@@ -131,7 +131,7 @@ for mkisofs_opt in \
 	"-allow-lowercase -allow-multidot -iso-level 3 -f -l -D -J -L -R"
 do
         echo "Running mkisofs -o isofs.iso -quiet $mkisofs_opt $MAKE_FILE_SYS_DIR  Command"
-	mkisofs -o isofs.iso -quiet $mkisofs_opt $MAKE_FILE_SYS_DIR
+	mkisofs -o isofs.iso -quiet $mkisofs_opt $MAKE_FILE_SYS_DIR 2> /dev/null
 	if [ $? != 0 ]
 	then
 		rm -rf isofs.iso $MNT_POINT $TEMP_DIR
@@ -160,7 +160,7 @@ do
 			exit 1
 		fi
 		echo "Running ls -lR $MNT_POINT Command"
-		ls -lR $MNT_POINT
+		ls -lR $MNT_POINT > /dev/null
 		exportfs -i -o no_root_squash,rw *:$MNT_POINT
 		exportfs -u :$MNT_POINT
 		umount $MNT_POINT
-- 
1.7.9.5


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [LTP] [RFC PATCH 3/3] Declare iso9660 fs testcase based on isofs.sh
  2014-03-13 12:38 [LTP] Let's use isofs.sh as an ordinary test case Stanislav Kholmanskikh
  2014-03-13 12:38 ` [LTP] [PATCH 1/3] isofs.sh: use $TMPDIR for temporary directory Stanislav Kholmanskikh
  2014-03-13 12:38 ` [LTP] [PATCH 2/3] isofs.sh: be more quiet Stanislav Kholmanskikh
@ 2014-03-13 12:38 ` Stanislav Kholmanskikh
  2 siblings, 0 replies; 16+ messages in thread
From: Stanislav Kholmanskikh @ 2014-03-13 12:38 UTC (permalink / raw)
  To: ltp-list; +Cc: vasily.isaenko

Script isofs.sh looks like a not bad candidate for
testing iso9660 file system.

Therefore moved it into a separate directory and declared
a new test case entry in runtest/fs.

Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
---
 runtest/fs                           |    2 +
 testcases/kernel/fs/iso9660/Makefile |   25 +++++
 testcases/kernel/fs/iso9660/isofs.sh |  187 ++++++++++++++++++++++++++++++++++
 testscripts/isofs.sh                 |  187 ----------------------------------
 4 files changed, 214 insertions(+), 187 deletions(-)
 create mode 100644 testcases/kernel/fs/iso9660/Makefile
 create mode 100755 testcases/kernel/fs/iso9660/isofs.sh
 delete mode 100755 testscripts/isofs.sh

diff --git a/runtest/fs b/runtest/fs
index 438c79c..9687ffa 100644
--- a/runtest/fs
+++ b/runtest/fs
@@ -74,3 +74,5 @@ fs_racer fs_racer.sh -t 5
 
 #Run the Quota Remount Test introduced in linux-2.6.26
 quota_remount_test01 quota_remount_test01.sh
+
+iso9660 isofs.sh
diff --git a/testcases/kernel/fs/iso9660/Makefile b/testcases/kernel/fs/iso9660/Makefile
new file mode 100644
index 0000000..bba35e6
--- /dev/null
+++ b/testcases/kernel/fs/iso9660/Makefile
@@ -0,0 +1,25 @@
+#
+#  Copyright (c) 2005-2014 Linux Test Project
+#
+#  This program is free software;  you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY;  without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+#  the GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program;  if not, write to the Free Software
+#  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+top_srcdir		?= ../../../..
+
+include $(top_srcdir)/include/mk/testcases.mk
+
+INSTALL_TARGETS		:= isofs.sh
+
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/fs/iso9660/isofs.sh b/testcases/kernel/fs/iso9660/isofs.sh
new file mode 100755
index 0000000..fd42a3c
--- /dev/null
+++ b/testcases/kernel/fs/iso9660/isofs.sh
@@ -0,0 +1,187 @@
+#!/bin/bash
+
+
+##############################################################
+#
+#  Copyright (c) International Business Machines  Corp., 2003
+#
+#  This program is free software;  you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY;  without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+#  the GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program;  if not, write to the Free Software
+#  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+#  FILE        : isofs.sh
+#  USAGE       : isofs.sh <optional> -n (no clean up)
+#
+#  DESCRIPTION : A script that will test isofs on Linux system.
+#                It makes ISO9660 file system with different options and also
+#                mounts the ISO9660 file system with different mount options.
+#
+#  REQUIREMENTS:
+#
+#  HISTORY     :
+#      06/27/2003 Prakash Narayana (prakashn@us.ibm.com)
+#      07/28/2005 Michael Reed (mreed10@us.ibm.com)
+#      - Changed the directory where the filesytems were being created
+#        from /etc to copying /etc to /tmp/for_isofs_test/etc and
+#        creating the file systems there
+#      - Added the -n option to not remove the directories created for
+#        debugging purposes
+#      - Added -d option to specify a different directory to copy to /tmp
+#        to make the file system
+#
+#  CODE COVERAGE: 40.5% - fs/isofs (Total Coverage)
+#
+#                 23.7% - fs/isofs/dir.c
+#                 46.0% - fs/isofs/inode.c
+#                 22.9% - fs/isofs/joliet.c
+#                 50.0% - fs/isofs/namei.c
+#                 38.5% - fs/isofs/rock.c
+#                 10.7% - fs/isofs/util.c
+#
+##############################################################
+
+USAGE="$0"
+NO_CLEANUP=""
+
+  usage()
+  {
+    echo "USAGE: $USAGE <optional> -n -h -d [directory name]"
+    exit
+  }
+
+#Initialize directory variables
+    TMPDIR=${TMPDIR:-/tmp}
+    MNT_POINT="$TMPDIR/isofs_$$"
+    COPY_DIR="/etc/"
+    TEMP_DIR="$TMPDIR/for_isofs_test"
+    MAKE_FILE_SYS_DIR=$TEMP_DIR$COPY_DIR
+
+   while getopts :hnd: arg
+      do  case $arg in
+	  d)
+             COPY_DIR=$OPTARG
+    	     MAKE_FILE_SYS_DIR=${TEMP_DIR}${COPY_DIR}
+	    ;;
+	  h)
+	    echo ""
+            echo "n - The directories created will not be removed"
+            echo "d - Specify a directory to copy into $TEMP_DIR"
+	    echo "h - Help options"
+	    echo ""
+	    usage
+	    echo ""
+	    ;;
+	  n)
+	    NO_CLEANUP="no"
+	    ;;
+        esac
+    done
+
+
+##############################################################
+#
+# Make sure that uid=root is running this script.
+# Validate the command line arguments.
+#
+##############################################################
+
+if [ $UID != 0 ]
+then
+	echo "FAILED: Must have root access to execute this script"
+	exit 1
+fi
+
+
+      mkdir -p -m 777 $MNT_POINT
+      mkdir -p $MAKE_FILE_SYS_DIR
+
+
+	if [ -e "$COPY_DIR" ]; then
+   		cp -rf $COPY_DIR* $MAKE_FILE_SYS_DIR
+	else
+    		echo "$COPY_DIR not found"
+    		echo "use the -d option to copy a different directory into"
+    		echo "/tmp to makethe ISO9660 file system with different"
+                echo "options"
+    		usage
+	fi
+
+
+
+# Make ISO9660 file system with different options.
+# Mount the ISO9660 file system with different mount options.
+
+for mkisofs_opt in \
+	" " \
+	"-J" \
+	"-hfs -D" \
+	" -R " \
+	"-R -J" \
+	"-f -l -D -J -L -R" \
+	"-allow-lowercase -allow-multidot -iso-level 3 -f -l -D -J -L -R"
+do
+        echo "Running mkisofs -o isofs.iso -quiet $mkisofs_opt $MAKE_FILE_SYS_DIR  Command"
+	mkisofs -o isofs.iso -quiet $mkisofs_opt $MAKE_FILE_SYS_DIR 2> /dev/null
+	if [ $? != 0 ]
+	then
+		rm -rf isofs.iso $MNT_POINT $TEMP_DIR
+		echo "FAILED: mkisofs -o isofs.iso $mkisofs_opt $MAKE_FILE_SYS_DIR failed"
+		exit 1
+	fi
+	for mount_opt in \
+		"loop" \
+		"loop,norock" \
+		"loop,nojoliet" \
+		"loop,block=512,unhide" \
+		"loop,block=1024,cruft" \
+		"loop,block=2048,nocompress" \
+		"loop,check=strict,map=off,gid=bin,uid=bin" \
+		"loop,check=strict,map=acorn,gid=bin,uid=bin" \
+		"loop,check=relaxed,map=normal" \
+		"loop,block=512,unhide,session=2"
+		# "loop,sbsector=32"
+	do
+		echo "Running mount -o $mount_opt isofs.iso $MNT_POINT Command"
+		mount -t iso9660 -o $mount_opt isofs.iso $MNT_POINT
+		if [ $? != 0 ]
+		then
+			rm -rf isofs.iso $MNT_POINT $TEMP_DIR
+			echo "FAILED: mount -t iso9660 -o $mount_opt isofs.iso $MNT_POINT failed"
+			exit 1
+		fi
+		echo "Running ls -lR $MNT_POINT Command"
+		ls -lR $MNT_POINT > /dev/null
+		exportfs -i -o no_root_squash,rw *:$MNT_POINT
+		exportfs -u :$MNT_POINT
+		umount $MNT_POINT
+	done
+	rm -rf isofs.iso
+done
+
+#######################################################
+#
+# Just before exit, perform the cleanup.
+#
+#######################################################
+
+  if [ "$NO_CLEANUP" == "no" ]; then
+     echo "$MAKE_FILE_SYS_DIR and $MNT_POINT were not removed"
+     echo "These directories will have to be removed manually"
+  else
+    rm -rf $TEMP_DIR
+    rm -rf $MNT_POINT
+  fi
+
+
+echo "PASSED: $0 passed!"
+exit 0
diff --git a/testscripts/isofs.sh b/testscripts/isofs.sh
deleted file mode 100755
index fd42a3c..0000000
--- a/testscripts/isofs.sh
+++ /dev/null
@@ -1,187 +0,0 @@
-#!/bin/bash
-
-
-##############################################################
-#
-#  Copyright (c) International Business Machines  Corp., 2003
-#
-#  This program is free software;  you can redistribute it and/or modify
-#  it under the terms of the GNU General Public License as published by
-#  the Free Software Foundation; either version 2 of the License, or
-#  (at your option) any later version.
-#
-#  This program is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY;  without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-#  the GNU General Public License for more details.
-#
-#  You should have received a copy of the GNU General Public License
-#  along with this program;  if not, write to the Free Software
-#  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-#
-#  FILE        : isofs.sh
-#  USAGE       : isofs.sh <optional> -n (no clean up)
-#
-#  DESCRIPTION : A script that will test isofs on Linux system.
-#                It makes ISO9660 file system with different options and also
-#                mounts the ISO9660 file system with different mount options.
-#
-#  REQUIREMENTS:
-#
-#  HISTORY     :
-#      06/27/2003 Prakash Narayana (prakashn@us.ibm.com)
-#      07/28/2005 Michael Reed (mreed10@us.ibm.com)
-#      - Changed the directory where the filesytems were being created
-#        from /etc to copying /etc to /tmp/for_isofs_test/etc and
-#        creating the file systems there
-#      - Added the -n option to not remove the directories created for
-#        debugging purposes
-#      - Added -d option to specify a different directory to copy to /tmp
-#        to make the file system
-#
-#  CODE COVERAGE: 40.5% - fs/isofs (Total Coverage)
-#
-#                 23.7% - fs/isofs/dir.c
-#                 46.0% - fs/isofs/inode.c
-#                 22.9% - fs/isofs/joliet.c
-#                 50.0% - fs/isofs/namei.c
-#                 38.5% - fs/isofs/rock.c
-#                 10.7% - fs/isofs/util.c
-#
-##############################################################
-
-USAGE="$0"
-NO_CLEANUP=""
-
-  usage()
-  {
-    echo "USAGE: $USAGE <optional> -n -h -d [directory name]"
-    exit
-  }
-
-#Initialize directory variables
-    TMPDIR=${TMPDIR:-/tmp}
-    MNT_POINT="$TMPDIR/isofs_$$"
-    COPY_DIR="/etc/"
-    TEMP_DIR="$TMPDIR/for_isofs_test"
-    MAKE_FILE_SYS_DIR=$TEMP_DIR$COPY_DIR
-
-   while getopts :hnd: arg
-      do  case $arg in
-	  d)
-             COPY_DIR=$OPTARG
-    	     MAKE_FILE_SYS_DIR=${TEMP_DIR}${COPY_DIR}
-	    ;;
-	  h)
-	    echo ""
-            echo "n - The directories created will not be removed"
-            echo "d - Specify a directory to copy into $TEMP_DIR"
-	    echo "h - Help options"
-	    echo ""
-	    usage
-	    echo ""
-	    ;;
-	  n)
-	    NO_CLEANUP="no"
-	    ;;
-        esac
-    done
-
-
-##############################################################
-#
-# Make sure that uid=root is running this script.
-# Validate the command line arguments.
-#
-##############################################################
-
-if [ $UID != 0 ]
-then
-	echo "FAILED: Must have root access to execute this script"
-	exit 1
-fi
-
-
-      mkdir -p -m 777 $MNT_POINT
-      mkdir -p $MAKE_FILE_SYS_DIR
-
-
-	if [ -e "$COPY_DIR" ]; then
-   		cp -rf $COPY_DIR* $MAKE_FILE_SYS_DIR
-	else
-    		echo "$COPY_DIR not found"
-    		echo "use the -d option to copy a different directory into"
-    		echo "/tmp to makethe ISO9660 file system with different"
-                echo "options"
-    		usage
-	fi
-
-
-
-# Make ISO9660 file system with different options.
-# Mount the ISO9660 file system with different mount options.
-
-for mkisofs_opt in \
-	" " \
-	"-J" \
-	"-hfs -D" \
-	" -R " \
-	"-R -J" \
-	"-f -l -D -J -L -R" \
-	"-allow-lowercase -allow-multidot -iso-level 3 -f -l -D -J -L -R"
-do
-        echo "Running mkisofs -o isofs.iso -quiet $mkisofs_opt $MAKE_FILE_SYS_DIR  Command"
-	mkisofs -o isofs.iso -quiet $mkisofs_opt $MAKE_FILE_SYS_DIR 2> /dev/null
-	if [ $? != 0 ]
-	then
-		rm -rf isofs.iso $MNT_POINT $TEMP_DIR
-		echo "FAILED: mkisofs -o isofs.iso $mkisofs_opt $MAKE_FILE_SYS_DIR failed"
-		exit 1
-	fi
-	for mount_opt in \
-		"loop" \
-		"loop,norock" \
-		"loop,nojoliet" \
-		"loop,block=512,unhide" \
-		"loop,block=1024,cruft" \
-		"loop,block=2048,nocompress" \
-		"loop,check=strict,map=off,gid=bin,uid=bin" \
-		"loop,check=strict,map=acorn,gid=bin,uid=bin" \
-		"loop,check=relaxed,map=normal" \
-		"loop,block=512,unhide,session=2"
-		# "loop,sbsector=32"
-	do
-		echo "Running mount -o $mount_opt isofs.iso $MNT_POINT Command"
-		mount -t iso9660 -o $mount_opt isofs.iso $MNT_POINT
-		if [ $? != 0 ]
-		then
-			rm -rf isofs.iso $MNT_POINT $TEMP_DIR
-			echo "FAILED: mount -t iso9660 -o $mount_opt isofs.iso $MNT_POINT failed"
-			exit 1
-		fi
-		echo "Running ls -lR $MNT_POINT Command"
-		ls -lR $MNT_POINT > /dev/null
-		exportfs -i -o no_root_squash,rw *:$MNT_POINT
-		exportfs -u :$MNT_POINT
-		umount $MNT_POINT
-	done
-	rm -rf isofs.iso
-done
-
-#######################################################
-#
-# Just before exit, perform the cleanup.
-#
-#######################################################
-
-  if [ "$NO_CLEANUP" == "no" ]; then
-     echo "$MAKE_FILE_SYS_DIR and $MNT_POINT were not removed"
-     echo "These directories will have to be removed manually"
-  else
-    rm -rf $TEMP_DIR
-    rm -rf $MNT_POINT
-  fi
-
-
-echo "PASSED: $0 passed!"
-exit 0
-- 
1.7.9.5


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [LTP] [PATCH 1/3] isofs.sh: use $TMPDIR for temporary directory
  2014-03-13 12:38 ` [LTP] [PATCH 1/3] isofs.sh: use $TMPDIR for temporary directory Stanislav Kholmanskikh
@ 2014-03-13 20:55   ` Mike Frysinger
  2014-03-17 14:39     ` Stanislav Kholmanskikh
  0 siblings, 1 reply; 16+ messages in thread
From: Mike Frysinger @ 2014-03-13 20:55 UTC (permalink / raw)
  To: ltp-list; +Cc: vasily.isaenko


[-- Attachment #1.1: Type: text/plain, Size: 236 bytes --]

On Thu 13 Mar 2014 16:38:24 Stanislav Kholmanskikh wrote:
>  #Initialize directory variables
> -    MNT_POINT="/tmp/isofs_$$"
> +    TMPDIR=${TMPDIR:-/tmp}
> +    MNT_POINT="$TMPDIR/isofs_$$"

why not just use `mktemp -d` ?
-mike

[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 370 bytes --]

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech

[-- Attachment #3: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [LTP] [PATCH 2/3] isofs.sh: be more quiet
  2014-03-13 12:38 ` [LTP] [PATCH 2/3] isofs.sh: be more quiet Stanislav Kholmanskikh
@ 2014-03-13 20:56   ` Mike Frysinger
  2014-03-17 14:29     ` Stanislav Kholmanskikh
  0 siblings, 1 reply; 16+ messages in thread
From: Mike Frysinger @ 2014-03-13 20:56 UTC (permalink / raw)
  To: ltp-list; +Cc: vasily.isaenko


[-- Attachment #1.1: Type: text/plain, Size: 313 bytes --]

On Thu 13 Mar 2014 16:38:25 Stanislav Kholmanskikh wrote:
>  		echo "Running ls -lR $MNT_POINT Command"
> -		ls -lR $MNT_POINT
> +		ls -lR $MNT_POINT > /dev/null

the point of this command is to show the contents of the mount.  if you're not 
doing that, then delete the call (and the echo above it).
-mike

[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 370 bytes --]

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech

[-- Attachment #3: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [LTP] [PATCH 2/3] isofs.sh: be more quiet
  2014-03-13 20:56   ` Mike Frysinger
@ 2014-03-17 14:29     ` Stanislav Kholmanskikh
  2014-03-21 10:44       ` Stanislav Kholmanskikh
  0 siblings, 1 reply; 16+ messages in thread
From: Stanislav Kholmanskikh @ 2014-03-17 14:29 UTC (permalink / raw)
  To: Mike Frysinger, ltp-list; +Cc: vasily.isaenko

Hi!

On 14.03.2014 00:56, Mike Frysinger wrote:
> On Thu 13 Mar 2014 16:38:25 Stanislav Kholmanskikh wrote:
>>   		echo "Running ls -lR $MNT_POINT Command"
>> -		ls -lR $MNT_POINT
>> +		ls -lR $MNT_POINT > /dev/null
>
> the point of this command is to show the contents of the mount.  if you're not
> doing that, then delete the call (and the echo above it).

Ok. I'll delete this call.


> -mike
>

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [LTP] [PATCH 1/3] isofs.sh: use $TMPDIR for temporary directory
  2014-03-13 20:55   ` Mike Frysinger
@ 2014-03-17 14:39     ` Stanislav Kholmanskikh
  0 siblings, 0 replies; 16+ messages in thread
From: Stanislav Kholmanskikh @ 2014-03-17 14:39 UTC (permalink / raw)
  To: Mike Frysinger, ltp-list; +Cc: vasily.isaenko



On 14.03.2014 00:55, Mike Frysinger wrote:
> On Thu 13 Mar 2014 16:38:24 Stanislav Kholmanskikh wrote:
>>   #Initialize directory variables
>> -    MNT_POINT="/tmp/isofs_$$"
>> +    TMPDIR=${TMPDIR:-/tmp}
>> +    MNT_POINT="$TMPDIR/isofs_$$"
>
> why not just use `mktemp -d` ?

ok.

> -mike
>

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [LTP] [PATCH 2/3] isofs.sh: be more quiet
  2014-03-17 14:29     ` Stanislav Kholmanskikh
@ 2014-03-21 10:44       ` Stanislav Kholmanskikh
  2014-03-21 13:43         ` Stanislav Kholmanskikh
  0 siblings, 1 reply; 16+ messages in thread
From: Stanislav Kholmanskikh @ 2014-03-21 10:44 UTC (permalink / raw)
  To: Mike Frysinger, ltp-list; +Cc: vasily.isaenko



On 03/17/2014 06:29 PM, Stanislav Kholmanskikh wrote:
> Hi!
>
> On 14.03.2014 00:56, Mike Frysinger wrote:
>> On Thu 13 Mar 2014 16:38:25 Stanislav Kholmanskikh wrote:
>>>    		echo "Running ls -lR $MNT_POINT Command"
>>> -		ls -lR $MNT_POINT
>>> +		ls -lR $MNT_POINT > /dev/null
>>
>> the point of this command is to show the contents of the mount.  if you're not
>> doing that, then delete the call (and the echo above it).
>
> Ok. I'll delete this call.
>
>
>> -mike
>>

I think we were incorrect about it.

The implicit point of the above commands is to give the OS (kernel/udev) 
some time to complete all actions needed to handle a new loop device 
creation situation.

For example, consider this script:

#!/bin/sh

for mount_opt in \
         "loop" \
         "loop,norock" \
         "loop,nojoliet" \
         "loop,block=512,unhide" \
         "loop,block=2048,nocompress" \
         "loop,check=strict,map=off,gid=bin,uid=bin" \
         "loop,check=strict,map=acorn,gid=bin,uid=bin" \
         "loop,check=relaxed,map=normal" \
         "loop,block=512,unhide,session=2"
do
         echo "mount_opt = $mount_opt"
         losetup -a
         mount -t iso9660 -o $mount_opt /tmp/isofs.iso /tmp/mnt
#        ls -lR /tmp/mnt > /dev/null
         umount /tmp/mnt

done

sleep 2
echo "after sleep"
losetup -a

If we execute it, we may get:
mount_opt = loop
mount_opt = loop,norock
/dev/loop0: [fc00]:131091 (/tmp/isofs.iso)
mount_opt = loop,nojoliet
/dev/loop0: [fc00]:131091 (/tmp/isofs.iso)
/dev/loop1: [fc00]:131091 (/tmp/isofs.iso)
mount_opt = loop,block=512,unhide
/dev/loop0: [fc00]:131091 (/tmp/isofs.iso)
/dev/loop1: [fc00]:131091 (/tmp/isofs.iso)
/dev/loop2: [fc00]:131091 (/tmp/isofs.iso)
mount_opt = loop,block=2048,nocompress
/dev/loop1: [fc00]:131091 (/tmp/isofs.iso)
/dev/loop2: [fc00]:131091 (/tmp/isofs.iso)
/dev/loop3: [fc00]:131091 (/tmp/isofs.iso)
mount_opt = loop,check=strict,map=off,gid=bin,uid=bin
/dev/loop0: [fc00]:131091 (/tmp/isofs.iso)
/dev/loop2: [fc00]:131091 (/tmp/isofs.iso)
/dev/loop3: [fc00]:131091 (/tmp/isofs.iso)
mount_opt = loop,check=strict,map=acorn,gid=bin,uid=bin
/dev/loop0: [fc00]:131091 (/tmp/isofs.iso)
/dev/loop1: [fc00]:131091 (/tmp/isofs.iso)
/dev/loop3: [fc00]:131091 (/tmp/isofs.iso)
mount_opt = loop,check=relaxed,map=normal
/dev/loop0: [fc00]:131091 (/tmp/isofs.iso)
/dev/loop1: [fc00]:131091 (/tmp/isofs.iso)
/dev/loop2: [fc00]:131091 (/tmp/isofs.iso)
/dev/loop3: [fc00]:131091 (/tmp/isofs.iso)
mount_opt = loop,block=512,unhide,session=2
/dev/loop2: [fc00]:131091 (/tmp/isofs.iso)
/dev/loop4: [fc00]:131091 (/tmp/isofs.iso)
after sleep

And if we uncomment 'ls -lR > /dev/null', we will get a clean output:
mount_opt = loop
mount_opt = loop,norock
mount_opt = loop,nojoliet
mount_opt = loop,block=512,unhide
mount_opt = loop,block=2048,nocompress
mount_opt = loop,check=strict,map=off,gid=bin,uid=bin
mount_opt = loop,check=strict,map=acorn,gid=bin,uid=bin
mount_opt = loop,check=relaxed,map=normal
mount_opt = loop,block=512,unhide,session=2
after sleep

So the more test cases we have the higher the probability is that sooner 
or later the OS will have no available loop devices.

The above commands were executed on a kernel with 
a1ecac3b0656a68259927c234e505804d33a7b83 patch.

I think that according to the patch the described behaviour is 
absolutely expected. Therefore It would be better to leave "ls -lR" in 
the test or insert a 'sleep' instead. In this case we would use no more 
than 2 loop devices per iteration.

Guys, what do you think?

PS: On a kernel without this patch it's very likely that an umount 
operation will fail with:
loop: can't delete device /dev/loop0: Device or resource busy


>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/13534_NeoTech
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list
>

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [LTP] [PATCH 2/3] isofs.sh: be more quiet
  2014-03-21 10:44       ` Stanislav Kholmanskikh
@ 2014-03-21 13:43         ` Stanislav Kholmanskikh
  2014-03-24 10:04           ` [LTP] [PATCH V2 1/4] testscripts/isofs.sh: cleanup Stanislav Kholmanskikh
                             ` (4 more replies)
  0 siblings, 5 replies; 16+ messages in thread
From: Stanislav Kholmanskikh @ 2014-03-21 13:43 UTC (permalink / raw)
  To: Mike Frysinger, ltp-list; +Cc: vasily.isaenko



On 03/21/2014 02:44 PM, Stanislav Kholmanskikh wrote:

>
> I think that according to the patch the described behaviour is
> absolutely expected. Therefore It would be better to leave "ls -lR" in
> the test or insert a 'sleep' instead. In this case we would use no more
> than 2 loop devices per iteration.
>

I suppose it would be a better solution (and without any waitings):

loop_dev=$(losetup --show -f isofs.iso)
# do mount and other stuff
# do umount
while /bin/true; do
     out=$(losetup -d "$loop_dev" 2>&1)

     if echo "$out" | grep -q -i "No such device"; then
          break
     fi
done

This way we doesn't depend on asynchrony in the loop-driver code.

> Guys, what do you think?
>

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [LTP] [PATCH V2 1/4] testscripts/isofs.sh: cleanup
  2014-03-21 13:43         ` Stanislav Kholmanskikh
@ 2014-03-24 10:04           ` Stanislav Kholmanskikh
  2014-03-24 10:04           ` [LTP] [PATCH V2 2/4] testscripts/isofs.sh: use the new shell interface Stanislav Kholmanskikh
                             ` (3 subsequent siblings)
  4 siblings, 0 replies; 16+ messages in thread
From: Stanislav Kholmanskikh @ 2014-03-24 10:04 UTC (permalink / raw)
  To: ltp-list; +Cc: vasily.isaenko

Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
---
 testscripts/isofs.sh |  165 ++++++++++++++++++++-----------------------------
 1 files changed, 67 insertions(+), 98 deletions(-)

diff --git a/testscripts/isofs.sh b/testscripts/isofs.sh
index e6a3b09..ec1f2fc 100755
--- a/testscripts/isofs.sh
+++ b/testscripts/isofs.sh
@@ -1,91 +1,64 @@
-#!/bin/bash
-
-
-##############################################################
-#
-#  Copyright (c) International Business Machines  Corp., 2003
-#
-#  This program is free software;  you can redistribute it and/or modify
-#  it under the terms of the GNU General Public License as published by
-#  the Free Software Foundation; either version 2 of the License, or
-#  (at your option) any later version.
+#!/bin/sh
 #
-#  This program is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY;  without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-#  the GNU General Public License for more details.
+# Copyright (c) International Business Machines  Corp., 2003
 #
-#  You should have received a copy of the GNU General Public License
-#  along with this program;  if not, write to the Free Software
-#  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
 #
-#  FILE        : isofs.sh
-#  USAGE       : isofs.sh <optional> -n (no clean up)
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
 #
-#  DESCRIPTION : A script that will test isofs on Linux system.
-#                It makes ISO9660 file system with different options and also
-#                mounts the ISO9660 file system with different mount options.
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 #
-#  REQUIREMENTS:
+# Written by Prakash Narayana (prakashn@us.ibm.com)
+# and Michael Reed (mreed10@us.ibm.com)
 #
-#  HISTORY     :
-#      06/27/2003 Prakash Narayana (prakashn@us.ibm.com)
-#      07/28/2005 Michael Reed (mreed10@us.ibm.com)
-#      - Changed the directory where the filesytems were being created
-#        from /etc to copying /etc to /tmp/for_isofs_test/etc and
-#        creating the file systems there
-#      - Added the -n option to not remove the directories created for
-#        debugging purposes
-#      - Added -d option to specify a different directory to copy to /tmp
-#        to make the file system
+# A script that will test isofs on Linux system.
+# It makes ISO9660 file system with different options and also
+# mounts the ISO9660 file system with different mount options.
 #
-#  CODE COVERAGE: 40.5% - fs/isofs (Total Coverage)
-#
-#                 23.7% - fs/isofs/dir.c
-#                 46.0% - fs/isofs/inode.c
-#                 22.9% - fs/isofs/joliet.c
-#                 50.0% - fs/isofs/namei.c
-#                 38.5% - fs/isofs/rock.c
-#                 10.7% - fs/isofs/util.c
-#
-##############################################################
 
 USAGE="$0"
 NO_CLEANUP=""
 
-  usage()
-  {
-    echo "USAGE: $USAGE <optional> -n -h -d [directory name]"
-    exit
-  }
+usage()
+{
+	echo "USAGE: $USAGE <optional> -n -h -d [directory name]"
+	exit
+}
 
 #Initialize directory variables
-    MNT_POINT="/tmp/isofs_$$"
-    COPY_DIR="/etc/"
-    TEMP_DIR="/tmp/for_isofs_test"
-    MAKE_FILE_SYS_DIR=$TEMP_DIR$COPY_DIR
-
-   while getopts :hnd: arg
-      do  case $arg in
-	  d)
-             COPY_DIR=$OPTARG
-    	     MAKE_FILE_SYS_DIR="/tmp/for_isofs_test"$COPY_DIR
-	    ;;
-	  h)
-	    echo ""
-            echo "n - The directories created will not be removed"
-            echo "d - Specify a directory to copy into /tmp"
-	    echo "h - Help options"
-	    echo ""
-	    usage
-	    echo ""
-	    ;;
-	  n)
-	    NO_CLEANUP="no"
-	    ;;
-        esac
-    done
-
+MNT_POINT="/tmp/isofs_$$"
+COPY_DIR="/etc/"
+TEMP_DIR="/tmp/for_isofs_test"
+MAKE_FILE_SYS_DIR=$TEMP_DIR$COPY_DIR
+
+while getopts :hnd: arg; do
+	case $arg in
+	d)
+		COPY_DIR=$OPTARG
+		MAKE_FILE_SYS_DIR="/tmp/for_isofs_test"$COPY_DIR
+		;;
+	h)
+		echo ""
+		echo "n - The directories created will not be removed"
+		echo "d - Specify a directory to copy into /tmp"
+		echo "h - Help options"
+		echo ""
+		usage
+		echo ""
+		;;
+	n)
+		NO_CLEANUP="no"
+		;;
+	esac
+done
 
 ##############################################################
 #
@@ -100,22 +73,19 @@ then
 	exit 1
 fi
 
-
-      mkdir -p -m 777 $MNT_POINT
-      mkdir -p $MAKE_FILE_SYS_DIR
-
-
-	if [ -e "$COPY_DIR" ]; then
-   		cp -rf $COPY_DIR* $MAKE_FILE_SYS_DIR
-	else
-    		echo "$COPY_DIR not found"
-    		echo "use the -d option to copy a different directory into"
-    		echo "/tmp to makethe ISO9660 file system with different"
-                echo "options"
-    		usage
-	fi
+mkdir -p -m 777 $MNT_POINT
+mkdir -p $MAKE_FILE_SYS_DIR
 
 
+if [ -e "$COPY_DIR" ]; then
+	cp -rf $COPY_DIR* $MAKE_FILE_SYS_DIR
+else
+	echo "$COPY_DIR not found"
+	echo "use the -d option to copy a different directory into"
+	echo "/tmp to makethe ISO9660 file system with different"
+	echo "options"
+	usage
+fi
 
 # Make ISO9660 file system with different options.
 # Mount the ISO9660 file system with different mount options.
@@ -129,7 +99,7 @@ for mkisofs_opt in \
 	"-f -l -D -J -L -R" \
 	"-allow-lowercase -allow-multidot -iso-level 3 -f -l -D -J -L -R"
 do
-        echo "Running mkisofs -o isofs.iso -quiet $mkisofs_opt $MAKE_FILE_SYS_DIR  Command"
+	echo "Running mkisofs -o isofs.iso -quiet $mkisofs_opt $MAKE_FILE_SYS_DIR  Command"
 	mkisofs -o isofs.iso -quiet $mkisofs_opt $MAKE_FILE_SYS_DIR
 	if [ $? != 0 ]
 	then
@@ -173,14 +143,13 @@ done
 #
 #######################################################
 
-  if [ "$NO_CLEANUP" == "no" ]; then
-     echo "$MAKE_FILE_SYS_DIR and $MNT_POINT were not removed"
-     echo "These directories will have to be removed manually"
-  else
-    rm -rf $TEMP_DIR
-    rm -rf $MNT_POINT
-  fi
-
+if [ "$NO_CLEANUP" == "no" ]; then
+	echo "$MAKE_FILE_SYS_DIR and $MNT_POINT were not removed"
+	echo "These directories will have to be removed manually"
+else
+	rm -rf $TEMP_DIR
+	rm -rf $MNT_POINT
+fi
 
 echo "PASSED: $0 passed!"
 exit 0
-- 
1.7.1


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [LTP] [PATCH V2 2/4] testscripts/isofs.sh: use the new shell interface
  2014-03-21 13:43         ` Stanislav Kholmanskikh
  2014-03-24 10:04           ` [LTP] [PATCH V2 1/4] testscripts/isofs.sh: cleanup Stanislav Kholmanskikh
@ 2014-03-24 10:04           ` Stanislav Kholmanskikh
  2014-03-24 10:04           ` [LTP] [PATCH V2 3/4] testscripts/isofs.sh: removed some "unnecessary" steps Stanislav Kholmanskikh
                             ` (2 subsequent siblings)
  4 siblings, 0 replies; 16+ messages in thread
From: Stanislav Kholmanskikh @ 2014-03-24 10:04 UTC (permalink / raw)
  To: ltp-list; +Cc: vasily.isaenko

Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
---
 testscripts/isofs.sh |  105 ++++++++++++++++++++++---------------------------
 1 files changed, 47 insertions(+), 58 deletions(-)

diff --git a/testscripts/isofs.sh b/testscripts/isofs.sh
index ec1f2fc..2bb2555 100755
--- a/testscripts/isofs.sh
+++ b/testscripts/isofs.sh
@@ -24,26 +24,34 @@
 # mounts the ISO9660 file system with different mount options.
 #
 
-USAGE="$0"
+TCID=isofs
+TST_TOTAL=77
+. test.sh
+
 NO_CLEANUP=""
 
 usage()
 {
-	echo "USAGE: $USAGE <optional> -n -h -d [directory name]"
+	echo "USAGE: $0 <optional> -n -h -d [directory name]"
 	exit
 }
 
-#Initialize directory variables
-MNT_POINT="/tmp/isofs_$$"
+cleanup()
+{
+	if [ "$NO_CLEANUP" = "no" ]; then
+		tst_resm TINFO "Temporary directory $PWD was not removed"
+	else
+		tst_rmdir
+	fi
+}
+
+
 COPY_DIR="/etc/"
-TEMP_DIR="/tmp/for_isofs_test"
-MAKE_FILE_SYS_DIR=$TEMP_DIR$COPY_DIR
 
 while getopts :hnd: arg; do
 	case $arg in
 	d)
 		COPY_DIR=$OPTARG
-		MAKE_FILE_SYS_DIR="/tmp/for_isofs_test"$COPY_DIR
 		;;
 	h)
 		echo ""
@@ -60,32 +68,22 @@ while getopts :hnd: arg; do
 	esac
 done
 
-##############################################################
-#
-# Make sure that uid=root is running this script.
-# Validate the command line arguments.
-#
-##############################################################
-
-if [ $UID != 0 ]
-then
-	echo "FAILED: Must have root access to execute this script"
-	exit 1
+if [ ! -e "$COPY_DIR" ]; then
+	tst_brkm TCONF "$COPY_DIR not found"
 fi
 
+tst_require_root
+
+tst_tmpdir
+TST_CLEANUP=cleanup
+
+MNT_POINT="$PWD/mnt"
+MAKE_FILE_SYS_DIR="$PWD/tmp/$COPY_DIR"
+
 mkdir -p -m 777 $MNT_POINT
 mkdir -p $MAKE_FILE_SYS_DIR
 
-
-if [ -e "$COPY_DIR" ]; then
-	cp -rf $COPY_DIR* $MAKE_FILE_SYS_DIR
-else
-	echo "$COPY_DIR not found"
-	echo "use the -d option to copy a different directory into"
-	echo "/tmp to makethe ISO9660 file system with different"
-	echo "options"
-	usage
-fi
+cp -rf $COPY_DIR* $MAKE_FILE_SYS_DIR
 
 # Make ISO9660 file system with different options.
 # Mount the ISO9660 file system with different mount options.
@@ -99,14 +97,17 @@ for mkisofs_opt in \
 	"-f -l -D -J -L -R" \
 	"-allow-lowercase -allow-multidot -iso-level 3 -f -l -D -J -L -R"
 do
-	echo "Running mkisofs -o isofs.iso -quiet $mkisofs_opt $MAKE_FILE_SYS_DIR  Command"
+	rm -f isofs.iso
 	mkisofs -o isofs.iso -quiet $mkisofs_opt $MAKE_FILE_SYS_DIR
-	if [ $? != 0 ]
-	then
-		rm -rf isofs.iso $MNT_POINT
-		echo "FAILED: mkisofs -o isofs.iso $mkisofs_opt $MAKE_FILE_SYS_DIR failed"
-		exit 1
+	if [ $? -eq 0 ]; then
+		tst_resm TPASS \
+			"mkisofs -o isofs.iso -quiet $mkisofs_opt $MAKE_FILE_SYS_DIR"
+	else
+		tst_resm TFAIL \
+			tst_resm TFAIL "mkisofs -o isofs.iso -quiet $mkisofs_opt $MAKE_FILE_SYS_DIR"
+		continue
 	fi
+
 	for mount_opt in \
 		"loop" \
 		"loop,norock" \
@@ -120,36 +121,24 @@ do
 		"loop,block=512,unhide,session=2"
 		# "loop,sbsector=32"
 	do
-		echo "Running mount -o $mount_opt isofs.iso $MNT_POINT Command"
 		mount -t iso9660 -o $mount_opt isofs.iso $MNT_POINT
-		if [ $? != 0 ]
-		then
-			rm -rf isofs.iso $MNT_POINT
-			echo "FAILED: mount -t iso9660 -o $mount_opt isofs.iso $MNT_POINT failed"
-			exit 1
+		if [ $? -ne 0 ]; then
+			tst_resm TFAIL \
+				"mount -t iso9660 -o $mount_opt isofs.iso $MNT_POINT"
+			continue
 		fi
-		echo "Running ls -lR $MNT_POINT Command"
+
 		ls -lR $MNT_POINT
 		exportfs -i -o no_root_squash,rw *:$MNT_POINT
 		exportfs -u :$MNT_POINT
+
 		umount $MNT_POINT
+		if [ $? -ne 0 ]; then
+			tst_resm TFAIL "umount $MNT_POINT"
+		fi
+
+		tst_resm TPASS "mount/umount with \"$mount_opt\" options"
 	done
-	rm -rf isofs.iso
 done
 
-#######################################################
-#
-# Just before exit, perform the cleanup.
-#
-#######################################################
-
-if [ "$NO_CLEANUP" == "no" ]; then
-	echo "$MAKE_FILE_SYS_DIR and $MNT_POINT were not removed"
-	echo "These directories will have to be removed manually"
-else
-	rm -rf $TEMP_DIR
-	rm -rf $MNT_POINT
-fi
-
-echo "PASSED: $0 passed!"
-exit 0
+tst_exit
-- 
1.7.1


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [LTP] [PATCH V2 3/4] testscripts/isofs.sh: removed some "unnecessary" steps
  2014-03-21 13:43         ` Stanislav Kholmanskikh
  2014-03-24 10:04           ` [LTP] [PATCH V2 1/4] testscripts/isofs.sh: cleanup Stanislav Kholmanskikh
  2014-03-24 10:04           ` [LTP] [PATCH V2 2/4] testscripts/isofs.sh: use the new shell interface Stanislav Kholmanskikh
@ 2014-03-24 10:04           ` Stanislav Kholmanskikh
  2014-03-24 10:04           ` [LTP] [PATCH V2 4/4] Declare an iso9660 fs testcase based on isofs.sh Stanislav Kholmanskikh
  2014-03-27  6:15           ` [LTP] [PATCH 2/3] isofs.sh: be more quiet Mike Frysinger
  4 siblings, 0 replies; 16+ messages in thread
From: Stanislav Kholmanskikh @ 2014-03-24 10:04 UTC (permalink / raw)
  To: ltp-list; +Cc: vasily.isaenko

I suppose that neither `ls -lR` nor `exportfs` has any direct
relationship to this test. Therefore I removed them to make the test
more silent.

But destroying of a loop device is an asynchronous operation
(see a1ecac3b0656a68259927c234e505804d33a7b83) and so on we
need to be sure that the device is destroyed before creating a new one.

To accomplish this I changed the test to use `losetup -f` and
`losetup -d` explicitly.

Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
---
 testscripts/isofs.sh |   52 +++++++++++++++++++++++++++++++------------------
 1 files changed, 33 insertions(+), 19 deletions(-)

diff --git a/testscripts/isofs.sh b/testscripts/isofs.sh
index 2bb2555..7a674e3 100755
--- a/testscripts/isofs.sh
+++ b/testscripts/isofs.sh
@@ -1,6 +1,7 @@
 #!/bin/sh
 #
 # Copyright (c) International Business Machines  Corp., 2003
+# Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -29,6 +30,7 @@ TST_TOTAL=77
 . test.sh
 
 NO_CLEANUP=""
+IS_MOUNTED=""
 
 usage()
 {
@@ -41,7 +43,7 @@ cleanup()
 	if [ "$NO_CLEANUP" = "no" ]; then
 		tst_resm TINFO "Temporary directory $PWD was not removed"
 	else
-		tst_rmdir
+		[ "$IS_MOUNTED" != "yes" ] && tst_rmdir
 	fi
 }
 
@@ -98,7 +100,7 @@ for mkisofs_opt in \
 	"-allow-lowercase -allow-multidot -iso-level 3 -f -l -D -J -L -R"
 do
 	rm -f isofs.iso
-	mkisofs -o isofs.iso -quiet $mkisofs_opt $MAKE_FILE_SYS_DIR
+	mkisofs -o isofs.iso -quiet $mkisofs_opt $MAKE_FILE_SYS_DIR 2> /dev/null
 	if [ $? -eq 0 ]; then
 		tst_resm TPASS \
 			"mkisofs -o isofs.iso -quiet $mkisofs_opt $MAKE_FILE_SYS_DIR"
@@ -109,33 +111,45 @@ do
 	fi
 
 	for mount_opt in \
-		"loop" \
-		"loop,norock" \
-		"loop,nojoliet" \
-		"loop,block=512,unhide" \
-		"loop,block=1024,cruft" \
-		"loop,block=2048,nocompress" \
-		"loop,check=strict,map=off,gid=bin,uid=bin" \
-		"loop,check=strict,map=acorn,gid=bin,uid=bin" \
-		"loop,check=relaxed,map=normal" \
-		"loop,block=512,unhide,session=2"
-		# "loop,sbsector=32"
+		"ro" \
+		"norock" \
+		"nojoliet" \
+		"block=512,unhide" \
+		"block=1024,cruft" \
+		"block=2048,nocompress" \
+		"check=strict,map=off,gid=bin,uid=bin" \
+		"check=strict,map=acorn,gid=bin,uid=bin" \
+		"check=relaxed,map=normal" \
+		"block=512,unhide,session=2"
+		# "sbsector=32"
 	do
-		mount -t iso9660 -o $mount_opt isofs.iso $MNT_POINT
+		loop_dev=$(losetup --show -f isofs.iso)
+		if [ $? -ne 0 ]; then
+			tst_brkm TBROK "losetup failed"
+		fi
+
+		mount -t iso9660 -o $mount_opt "$loop_dev" $MNT_POINT
 		if [ $? -ne 0 ]; then
 			tst_resm TFAIL \
-				"mount -t iso9660 -o $mount_opt isofs.iso $MNT_POINT"
+				"mount -t iso9660 -o $mount_opt "$loop_dev" $MNT_POINT"
 			continue
 		fi
-
-		ls -lR $MNT_POINT
-		exportfs -i -o no_root_squash,rw *:$MNT_POINT
-		exportfs -u :$MNT_POINT
+		IS_MOUNTED="yes"
 
 		umount $MNT_POINT
 		if [ $? -ne 0 ]; then
 			tst_resm TFAIL "umount $MNT_POINT"
 		fi
+		IS_MOUNTED="no"
+
+		# Now tearing down the loopback device
+		while /bin/true; do
+			out=$(losetup -d "$loop_dev" 2>&1)
+
+			if echo "$out" | grep -q -i "No such device"; then
+				break
+			fi
+		done
 
 		tst_resm TPASS "mount/umount with \"$mount_opt\" options"
 	done
-- 
1.7.1


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [LTP] [PATCH V2 4/4] Declare an iso9660 fs testcase based on isofs.sh
  2014-03-21 13:43         ` Stanislav Kholmanskikh
                             ` (2 preceding siblings ...)
  2014-03-24 10:04           ` [LTP] [PATCH V2 3/4] testscripts/isofs.sh: removed some "unnecessary" steps Stanislav Kholmanskikh
@ 2014-03-24 10:04           ` Stanislav Kholmanskikh
  2014-03-27  6:15           ` [LTP] [PATCH 2/3] isofs.sh: be more quiet Mike Frysinger
  4 siblings, 0 replies; 16+ messages in thread
From: Stanislav Kholmanskikh @ 2014-03-24 10:04 UTC (permalink / raw)
  To: ltp-list; +Cc: vasily.isaenko

Script isofs.sh looks like a not bad candidate for
testing an iso9660 file system.

Therefore moved it into a separate directory and declared
a new test case entry in runtest/fs.

Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmanskikh@oracle.com>
---
 runtest/fs                           |    2 +
 testcases/kernel/fs/iso9660/Makefile |   26 ++++++
 testcases/kernel/fs/iso9660/isofs.sh |  158 ++++++++++++++++++++++++++++++++++
 testscripts/isofs.sh                 |  158 ----------------------------------
 4 files changed, 186 insertions(+), 158 deletions(-)
 create mode 100644 testcases/kernel/fs/iso9660/Makefile
 create mode 100755 testcases/kernel/fs/iso9660/isofs.sh
 delete mode 100755 testscripts/isofs.sh

diff --git a/runtest/fs b/runtest/fs
index 438c79c..33a8412 100644
--- a/runtest/fs
+++ b/runtest/fs
@@ -74,3 +74,5 @@ fs_racer fs_racer.sh -t 5
 
 #Run the Quota Remount Test introduced in linux-2.6.26
 quota_remount_test01 quota_remount_test01.sh
+
+isofs isofs.sh
diff --git a/testcases/kernel/fs/iso9660/Makefile b/testcases/kernel/fs/iso9660/Makefile
new file mode 100644
index 0000000..459b3a4
--- /dev/null
+++ b/testcases/kernel/fs/iso9660/Makefile
@@ -0,0 +1,26 @@
+#
+#  Copyright (c) 2005-2014 Linux Test Project
+#
+#  This program is free software;  you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY;  without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+#  the GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program;  if not, write to the Free Software
+#  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+top_srcdir		?= ../../../..
+
+include $(top_srcdir)/include/mk/testcases.mk
+
+MAKE_TARGETS		:=
+INSTALL_TARGETS		:= isofs.sh
+
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/fs/iso9660/isofs.sh b/testcases/kernel/fs/iso9660/isofs.sh
new file mode 100755
index 0000000..7a674e3
--- /dev/null
+++ b/testcases/kernel/fs/iso9660/isofs.sh
@@ -0,0 +1,158 @@
+#!/bin/sh
+#
+# Copyright (c) International Business Machines  Corp., 2003
+# Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Written by Prakash Narayana (prakashn@us.ibm.com)
+# and Michael Reed (mreed10@us.ibm.com)
+#
+# A script that will test isofs on Linux system.
+# It makes ISO9660 file system with different options and also
+# mounts the ISO9660 file system with different mount options.
+#
+
+TCID=isofs
+TST_TOTAL=77
+. test.sh
+
+NO_CLEANUP=""
+IS_MOUNTED=""
+
+usage()
+{
+	echo "USAGE: $0 <optional> -n -h -d [directory name]"
+	exit
+}
+
+cleanup()
+{
+	if [ "$NO_CLEANUP" = "no" ]; then
+		tst_resm TINFO "Temporary directory $PWD was not removed"
+	else
+		[ "$IS_MOUNTED" != "yes" ] && tst_rmdir
+	fi
+}
+
+
+COPY_DIR="/etc/"
+
+while getopts :hnd: arg; do
+	case $arg in
+	d)
+		COPY_DIR=$OPTARG
+		;;
+	h)
+		echo ""
+		echo "n - The directories created will not be removed"
+		echo "d - Specify a directory to copy into /tmp"
+		echo "h - Help options"
+		echo ""
+		usage
+		echo ""
+		;;
+	n)
+		NO_CLEANUP="no"
+		;;
+	esac
+done
+
+if [ ! -e "$COPY_DIR" ]; then
+	tst_brkm TCONF "$COPY_DIR not found"
+fi
+
+tst_require_root
+
+tst_tmpdir
+TST_CLEANUP=cleanup
+
+MNT_POINT="$PWD/mnt"
+MAKE_FILE_SYS_DIR="$PWD/tmp/$COPY_DIR"
+
+mkdir -p -m 777 $MNT_POINT
+mkdir -p $MAKE_FILE_SYS_DIR
+
+cp -rf $COPY_DIR* $MAKE_FILE_SYS_DIR
+
+# Make ISO9660 file system with different options.
+# Mount the ISO9660 file system with different mount options.
+
+for mkisofs_opt in \
+	" " \
+	"-J" \
+	"-hfs -D" \
+	" -R " \
+	"-R -J" \
+	"-f -l -D -J -L -R" \
+	"-allow-lowercase -allow-multidot -iso-level 3 -f -l -D -J -L -R"
+do
+	rm -f isofs.iso
+	mkisofs -o isofs.iso -quiet $mkisofs_opt $MAKE_FILE_SYS_DIR 2> /dev/null
+	if [ $? -eq 0 ]; then
+		tst_resm TPASS \
+			"mkisofs -o isofs.iso -quiet $mkisofs_opt $MAKE_FILE_SYS_DIR"
+	else
+		tst_resm TFAIL \
+			tst_resm TFAIL "mkisofs -o isofs.iso -quiet $mkisofs_opt $MAKE_FILE_SYS_DIR"
+		continue
+	fi
+
+	for mount_opt in \
+		"ro" \
+		"norock" \
+		"nojoliet" \
+		"block=512,unhide" \
+		"block=1024,cruft" \
+		"block=2048,nocompress" \
+		"check=strict,map=off,gid=bin,uid=bin" \
+		"check=strict,map=acorn,gid=bin,uid=bin" \
+		"check=relaxed,map=normal" \
+		"block=512,unhide,session=2"
+		# "sbsector=32"
+	do
+		loop_dev=$(losetup --show -f isofs.iso)
+		if [ $? -ne 0 ]; then
+			tst_brkm TBROK "losetup failed"
+		fi
+
+		mount -t iso9660 -o $mount_opt "$loop_dev" $MNT_POINT
+		if [ $? -ne 0 ]; then
+			tst_resm TFAIL \
+				"mount -t iso9660 -o $mount_opt "$loop_dev" $MNT_POINT"
+			continue
+		fi
+		IS_MOUNTED="yes"
+
+		umount $MNT_POINT
+		if [ $? -ne 0 ]; then
+			tst_resm TFAIL "umount $MNT_POINT"
+		fi
+		IS_MOUNTED="no"
+
+		# Now tearing down the loopback device
+		while /bin/true; do
+			out=$(losetup -d "$loop_dev" 2>&1)
+
+			if echo "$out" | grep -q -i "No such device"; then
+				break
+			fi
+		done
+
+		tst_resm TPASS "mount/umount with \"$mount_opt\" options"
+	done
+done
+
+tst_exit
diff --git a/testscripts/isofs.sh b/testscripts/isofs.sh
deleted file mode 100755
index 7a674e3..0000000
--- a/testscripts/isofs.sh
+++ /dev/null
@@ -1,158 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) International Business Machines  Corp., 2003
-# Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Written by Prakash Narayana (prakashn@us.ibm.com)
-# and Michael Reed (mreed10@us.ibm.com)
-#
-# A script that will test isofs on Linux system.
-# It makes ISO9660 file system with different options and also
-# mounts the ISO9660 file system with different mount options.
-#
-
-TCID=isofs
-TST_TOTAL=77
-. test.sh
-
-NO_CLEANUP=""
-IS_MOUNTED=""
-
-usage()
-{
-	echo "USAGE: $0 <optional> -n -h -d [directory name]"
-	exit
-}
-
-cleanup()
-{
-	if [ "$NO_CLEANUP" = "no" ]; then
-		tst_resm TINFO "Temporary directory $PWD was not removed"
-	else
-		[ "$IS_MOUNTED" != "yes" ] && tst_rmdir
-	fi
-}
-
-
-COPY_DIR="/etc/"
-
-while getopts :hnd: arg; do
-	case $arg in
-	d)
-		COPY_DIR=$OPTARG
-		;;
-	h)
-		echo ""
-		echo "n - The directories created will not be removed"
-		echo "d - Specify a directory to copy into /tmp"
-		echo "h - Help options"
-		echo ""
-		usage
-		echo ""
-		;;
-	n)
-		NO_CLEANUP="no"
-		;;
-	esac
-done
-
-if [ ! -e "$COPY_DIR" ]; then
-	tst_brkm TCONF "$COPY_DIR not found"
-fi
-
-tst_require_root
-
-tst_tmpdir
-TST_CLEANUP=cleanup
-
-MNT_POINT="$PWD/mnt"
-MAKE_FILE_SYS_DIR="$PWD/tmp/$COPY_DIR"
-
-mkdir -p -m 777 $MNT_POINT
-mkdir -p $MAKE_FILE_SYS_DIR
-
-cp -rf $COPY_DIR* $MAKE_FILE_SYS_DIR
-
-# Make ISO9660 file system with different options.
-# Mount the ISO9660 file system with different mount options.
-
-for mkisofs_opt in \
-	" " \
-	"-J" \
-	"-hfs -D" \
-	" -R " \
-	"-R -J" \
-	"-f -l -D -J -L -R" \
-	"-allow-lowercase -allow-multidot -iso-level 3 -f -l -D -J -L -R"
-do
-	rm -f isofs.iso
-	mkisofs -o isofs.iso -quiet $mkisofs_opt $MAKE_FILE_SYS_DIR 2> /dev/null
-	if [ $? -eq 0 ]; then
-		tst_resm TPASS \
-			"mkisofs -o isofs.iso -quiet $mkisofs_opt $MAKE_FILE_SYS_DIR"
-	else
-		tst_resm TFAIL \
-			tst_resm TFAIL "mkisofs -o isofs.iso -quiet $mkisofs_opt $MAKE_FILE_SYS_DIR"
-		continue
-	fi
-
-	for mount_opt in \
-		"ro" \
-		"norock" \
-		"nojoliet" \
-		"block=512,unhide" \
-		"block=1024,cruft" \
-		"block=2048,nocompress" \
-		"check=strict,map=off,gid=bin,uid=bin" \
-		"check=strict,map=acorn,gid=bin,uid=bin" \
-		"check=relaxed,map=normal" \
-		"block=512,unhide,session=2"
-		# "sbsector=32"
-	do
-		loop_dev=$(losetup --show -f isofs.iso)
-		if [ $? -ne 0 ]; then
-			tst_brkm TBROK "losetup failed"
-		fi
-
-		mount -t iso9660 -o $mount_opt "$loop_dev" $MNT_POINT
-		if [ $? -ne 0 ]; then
-			tst_resm TFAIL \
-				"mount -t iso9660 -o $mount_opt "$loop_dev" $MNT_POINT"
-			continue
-		fi
-		IS_MOUNTED="yes"
-
-		umount $MNT_POINT
-		if [ $? -ne 0 ]; then
-			tst_resm TFAIL "umount $MNT_POINT"
-		fi
-		IS_MOUNTED="no"
-
-		# Now tearing down the loopback device
-		while /bin/true; do
-			out=$(losetup -d "$loop_dev" 2>&1)
-
-			if echo "$out" | grep -q -i "No such device"; then
-				break
-			fi
-		done
-
-		tst_resm TPASS "mount/umount with \"$mount_opt\" options"
-	done
-done
-
-tst_exit
-- 
1.7.1


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [LTP] [PATCH 2/3] isofs.sh: be more quiet
  2014-03-21 13:43         ` Stanislav Kholmanskikh
                             ` (3 preceding siblings ...)
  2014-03-24 10:04           ` [LTP] [PATCH V2 4/4] Declare an iso9660 fs testcase based on isofs.sh Stanislav Kholmanskikh
@ 2014-03-27  6:15           ` Mike Frysinger
  2014-03-27 14:25             ` chrubis
  4 siblings, 1 reply; 16+ messages in thread
From: Mike Frysinger @ 2014-03-27  6:15 UTC (permalink / raw)
  To: Stanislav Kholmanskikh; +Cc: vasily.isaenko, ltp-list


[-- Attachment #1.1: Type: text/plain, Size: 1064 bytes --]

On Fri 21 Mar 2014 17:43:29 Stanislav Kholmanskikh wrote:
> On 03/21/2014 02:44 PM, Stanislav Kholmanskikh wrote:
> > I think that according to the patch the described behaviour is
> > absolutely expected. Therefore It would be better to leave "ls -lR" in
> > the test or insert a 'sleep' instead. In this case we would use no more
> > than 2 loop devices per iteration.
> 
> I suppose it would be a better solution (and without any waitings):
> 
> loop_dev=$(losetup --show -f isofs.iso)
> # do mount and other stuff
> # do umount
> while /bin/true; do
>      out=$(losetup -d "$loop_dev" 2>&1)
> 
>      if echo "$out" | grep -q -i "No such device"; then
>           break
>      fi
> done
> 
> This way we doesn't depend on asynchrony in the loop-driver code.

that might work.  certainly the current code, if it's trying to make the 
script "sleep" in hopes the device is no longer in use by udev/whatever, is 
also broken.

make sure to use LC_ALL=C though when running losetup so the localization 
doesn't screw up the grep.
-mike

[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 79 bytes --]

------------------------------------------------------------------------------

[-- Attachment #3: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [LTP] [PATCH 2/3] isofs.sh: be more quiet
  2014-03-27  6:15           ` [LTP] [PATCH 2/3] isofs.sh: be more quiet Mike Frysinger
@ 2014-03-27 14:25             ` chrubis
  0 siblings, 0 replies; 16+ messages in thread
From: chrubis @ 2014-03-27 14:25 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: vasily.isaenko, ltp-list

Hi!
> that might work.  certainly the current code, if it's trying to make the 
> script "sleep" in hopes the device is no longer in use by udev/whatever, is 
> also broken.

Last time I've seen this problem the offender was GNOME gvfsd-trash
process. There are even several bugreports for that.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2014-03-27 14:26 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-13 12:38 [LTP] Let's use isofs.sh as an ordinary test case Stanislav Kholmanskikh
2014-03-13 12:38 ` [LTP] [PATCH 1/3] isofs.sh: use $TMPDIR for temporary directory Stanislav Kholmanskikh
2014-03-13 20:55   ` Mike Frysinger
2014-03-17 14:39     ` Stanislav Kholmanskikh
2014-03-13 12:38 ` [LTP] [PATCH 2/3] isofs.sh: be more quiet Stanislav Kholmanskikh
2014-03-13 20:56   ` Mike Frysinger
2014-03-17 14:29     ` Stanislav Kholmanskikh
2014-03-21 10:44       ` Stanislav Kholmanskikh
2014-03-21 13:43         ` Stanislav Kholmanskikh
2014-03-24 10:04           ` [LTP] [PATCH V2 1/4] testscripts/isofs.sh: cleanup Stanislav Kholmanskikh
2014-03-24 10:04           ` [LTP] [PATCH V2 2/4] testscripts/isofs.sh: use the new shell interface Stanislav Kholmanskikh
2014-03-24 10:04           ` [LTP] [PATCH V2 3/4] testscripts/isofs.sh: removed some "unnecessary" steps Stanislav Kholmanskikh
2014-03-24 10:04           ` [LTP] [PATCH V2 4/4] Declare an iso9660 fs testcase based on isofs.sh Stanislav Kholmanskikh
2014-03-27  6:15           ` [LTP] [PATCH 2/3] isofs.sh: be more quiet Mike Frysinger
2014-03-27 14:25             ` chrubis
2014-03-13 12:38 ` [LTP] [RFC PATCH 3/3] Declare iso9660 fs testcase based on isofs.sh Stanislav Kholmanskikh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox