Skip to contentSkip to conversation

kernel/io/disktest: cleanup upon failure occurs

PATCH Superseded Wei Jiangang 3 participants 12 messages Nov 24, 2015 – Nov 26, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 kernel/io/disktest: cleanup upon failure occurs

---
 testcases/kernel/io/disktest/dump.c | 2 ++
 testcases/kernel/io/disktest/main.c | 1 +
 2 files changed, 3 insertions(+)
testcases/kernel/io/disktest/dump.c +2 -0
index 615e8b4..d83e571 100644
@@ -192,12 +192,14 @@ int do_dump(child_args_t * args)
 		pMsg(ERR, args, "could not open %s.\n", args->device);
 		pMsg(ERR, args, "%s: Error = %u\n", args->device,
 		     GETLASTERROR());
+                FREE(buff);
 		return (-1);
 	}
 
 	TargetLBA = Seek(fd, args->start_lba * BLK_SIZE);
 	if (TargetLBA != (args->start_lba * (OFF_T) BLK_SIZE)) {
 		pMsg(ERR, args, "Could not seek to start position.\n");
+                FREE(buf);
 		CLOSE(fd);
 		return (-1);
 	}
testcases/kernel/io/disktest/main.c +1 -0
index 9484ec1..050ddea 100644
@@ -501,6 +501,7 @@ test_ll_t *run()
 			     &cleanArgs,
 			     "%s is not a regular file, could not be opened for reading, or was not found.",
 			     filespec);
+                        FREE(aFilespec);
 
 			return newTest;
 		}
Signature · 7 lines
1.9.3


-- 
This message has been scanned for viruses and
dangerous content by FCNIC, and is
believed to be clean.
#1 lore raw

PATCH 2/2 Fix the order between 2>&1 and >/dev/null

The 2>&1 has to be after >/dev/null.
PS, this patch fix the problem is as same as b85bb78.

---
 testcases/kernel/fs/acl/tacl_xattr.sh             |  2 +-
 testcases/kernel/fs/fs-bench/modaltr.sh           |  2 +-
 testcases/kernel/power_management/runpwtests03.sh |  4 +-
 testscripts/autofs1.sh                            | 10 ++---
 testscripts/autofs4.sh                            | 46 +++++++++++------------
 testscripts/exportfs.sh                           | 20 +++++-----
 tools/pounder21/libpounder.sh                     |  1 +
 7 files changed, 43 insertions(+), 42 deletions(-)
testcases/kernel/fs/acl/tacl_xattr.sh +1 -1
index 99f6a95..b42b665 100755
@@ -80,7 +80,7 @@ fi
 dd if=/dev/zero of=tacl/blkext2 bs=1k count=10240
 chmod 777 tacl/blkext2
 
-losetup /dev/loop0 tacl/blkext2 2>&1 > /dev/null
+losetup /dev/loop0 tacl/blkext2 >/dev/null 2>&1
 if [ $? != 0 ]
 then
 	echo ""
testcases/kernel/fs/fs-bench/modaltr.sh +1 -1
index 74bf59e..c4ea745 100755
@@ -89,7 +89,7 @@ modprobe $LOOP
 	echo "check wheather loopback device option is been compiled in the kernel"
 fi
 mkdir -p $BLOCK_DIR
-mknod $BLOCK_DIR/0 b 31 0 2>&1 > /dev/null
+mknod $BLOCK_DIR/0 b 31 0 >/dev/null 2>&1
 mount -t jffs2 $BLOCK_DIR/0 $MOUNT_DIR
 mount|grep $JFFS2
 	if [ $? -eq 0 ]; then
testcases/kernel/power_management/runpwtests03.sh +2 -2
index 7e9ac4b..d4ea88b 100755
@@ -35,7 +35,7 @@ check_cpufreq_sysfs_files() {
 			-name "*" -type f)
 		for files in ${cpufiles}
 		do
-			cat ${files} 2>&1 >/dev/null
+			cat ${files} >/dev/null 2>&1
 			if [ $? -ne 0 ] ; then
 				echo "${0}: FAIL: cat ${files}"
 				RC=1
@@ -83,7 +83,7 @@ change_freq() {
 	(( total_cpus-=1 ))
 
 	if ( echo ${available_govr} | grep -i "userspace" \
-		2>&1 >/dev/null ); then
+		>/dev/null 2>&1 ); then
 		for cpu in $(seq 0 "${total_cpus}" )
 		do
 			echo userspace > \
testscripts/autofs1.sh +5 -5
index 678b56f..324c4db 100755
@@ -199,16 +199,16 @@ fi
 
 echo "forcing error paths and conditions..."
 
-mkdir /AUTOFS/MEDIA/mydir 2>&1 > /dev/null
-rm -rf /AUTOFS 2>&1 > /dev/null
+mkdir /AUTOFS/MEDIA/mydir >/dev/null 2>&1
+rm -rf /AUTOFS >/dev/null 2>&1
 
 mkdir /AUTOFS/MEDIA/floppy/test
 cp /etc/auto.master /etc/auto.media /AUTOFS/MEDIA/floppy/test
 sync; sync
 echo "Resuming test, please wait..."
 sleep 60
-mkdir /AUTOFS/MEDIA/mydir 2>&1 > /dev/null
-rm -rf /AUTOFS            2>&1 > /dev/null
+mkdir /AUTOFS/MEDIA/mydir >/dev/null 2>&1
+rm -rf /AUTOFS >/dev/null 2>&1
 
 
 ##############################################################
@@ -234,7 +234,7 @@ sleep 60
 
 if [ -e  /AUTOFS/DISK/disk/test ]; then
   cd /AUTOFS/DISK/disk/test
-  umount /AUTOFS/DISK/disk/ 2>&1 > /dev/null
+  umount /AUTOFS/DISK/disk/ >/dev/null 2>&1
   if [ $? = 0 ]
     then
 	/etc/init.d/autofs stop
testscripts/autofs4.sh +23 -23

144 lines not on this page · raw message

testscripts/exportfs.sh +10 -10
index f5d5294..8afe017 100755
@@ -98,27 +98,27 @@ fi
 # Add code here.
 
 
-ping -c 2 -w 15 $NFS_SERVER 2>&1 >/dev/null
+ping -c 2 -w 15 $NFS_SERVER >/dev/null 2>&1
 if [ $? != 0 ]
 then
 	echo "FAILED: ping $NFS_SERVER failed"
 	exit 1
 fi
 
-rsh -n -l root $NFS_SERVER "ls -l /etc" 2>&1 >/dev/null
+rsh -n -l root $NFS_SERVER "ls -l /etc" >/dev/null 2>&1
 if [ $? != 0 ]
 then
 	echo "FAILED: rsh -n -l root $NFS_SERVER "ls -l /etc" failed"
 	exit 1
 fi
 
-rsh -n -l root $NFS_SERVER "rpm -q -a | grep $FS_TYPE" | grep $FS_TYPE 2>&1 > /dev/null
+rsh -n -l root $NFS_SERVER "rpm -q -a | grep $FS_TYPE" | grep $FS_TYPE >/dev/null 2>&1
 if [ $? != 0 ]
 then
-	rsh -n -l root $NFS_SERVER "grep $FS_TYPE /etc/filesystems" | grep $FS_TYPE 2>&1 > /dev/null
+	rsh -n -l root $NFS_SERVER "grep $FS_TYPE /etc/filesystems" | grep $FS_TYPE >/dev/null 2>&1
 	if [ $? != 0 ]
 	then
-		rsh -n -l root $NFS_SERVER "grep $FS_TYPE /proc/filesystems" | grep $FS_TYPE 2>&1 > /dev/null
+		rsh -n -l root $NFS_SERVER "grep $FS_TYPE /proc/filesystems" | grep $FS_TYPE >/dev/null 2>&1
 		if [ $? != 0 ]
 		then
 			echo "FAILED: $FS_TYPE package is not installed or loaded on $NFS_SERVER"
@@ -129,17 +129,17 @@ fi
 
 if [ "$FS_TYPE" = "reiserfs" ]
 then
-#	rsh -n -l root $NFS_SERVER "/sbin/mkfs -t $FS_TYPE --format 3.6 -f $REM_DISK_PART 2>&1 > /dev/null"
-	rsh -n -l root $NFS_SERVER "/sbin/mkfs -t $FS_TYPE -f $REM_DISK_PART --format 3.6 2>&1 > /dev/null"
-	echo "/sbin/mkfs -t $FS_TYPE --format 3.6 -f $REM_DISK_PART 2>&1 > /dev/null"
+#	rsh -n -l root $NFS_SERVER "/sbin/mkfs -t $FS_TYPE --format 3.6 -f $REM_DISK_PART >/dev/null 2>&1"
+	rsh -n -l root $NFS_SERVER "/sbin/mkfs -t $FS_TYPE -f $REM_DISK_PART --format 3.6 >/dev/null 2>&1"
+	echo "/sbin/mkfs -t $FS_TYPE --format 3.6 -f $REM_DISK_PART >/dev/null 2>&1"
 else
-#	rsh -n -l root $NFS_SERVER "/sbin/mkfs -t $FS_TYPE $REM_DISK_PART 2>&1 > /dev/null"
+#	rsh -n -l root $NFS_SERVER "/sbin/mkfs -t $FS_TYPE $REM_DISK_PART >/dev/null 2>&1"
 	QUIETFLAG=
 	if [ "$FS_TYPE" = "jfs" ]
 	then
 		QUIETFLAG="-q"
 	fi
-	rsh -n -l root $NFS_SERVER "/sbin/mkfs -t $FS_TYPE $QUIETFLAG $REM_DISK_PART 2>&1 > /dev/null"
+	rsh -n -l root $NFS_SERVER "/sbin/mkfs -t $FS_TYPE $QUIETFLAG $REM_DISK_PART >/dev/null 2>&1"
 	if [ $? != 0 ]
 	then
 		echo "FAILED: Could not /sbin/mkfs -t $FS_TYPE $REM_DISK_PART on $NFS_SERVER"
tools/pounder21/libpounder.sh +1 -0
index 21e4613..8e20c0f 100644
@@ -1,3 +1,4 @@
+#!/bin/sh
 # Common shell functions and variables that all pounder scripts can use.
 
 # Copyright (C) 2003-2006 IBM
Signature · 7 lines
1.9.3


-- 
This message has been scanned for viruses and
dangerous content by FCNIC, and is
believed to be clean.
#2 lore raw

PATCH v2 1/2 kernel/io/disktest: cleanup upon failure occurs

---
 testcases/kernel/io/disktest/dump.c | 2 ++
 testcases/kernel/io/disktest/main.c | 1 +
 2 files changed, 3 insertions(+)
testcases/kernel/io/disktest/dump.c +2 -0
index 615e8b4..e90eb12 100644
@@ -192,12 +192,14 @@ int do_dump(child_args_t * args)
 		pMsg(ERR, args, "could not open %s.\n", args->device);
 		pMsg(ERR, args, "%s: Error = %u\n", args->device,
 		     GETLASTERROR());
+		FREE(buff);
 		return (-1);
 	}
 
 	TargetLBA = Seek(fd, args->start_lba * BLK_SIZE);
 	if (TargetLBA != (args->start_lba * (OFF_T) BLK_SIZE)) {
 		pMsg(ERR, args, "Could not seek to start position.\n");
+		FREE(buf);
 		CLOSE(fd);
 		return (-1);
 	}
testcases/kernel/io/disktest/main.c +1 -0
index 9484ec1..c372b04 100644
@@ -501,6 +501,7 @@ test_ll_t *run()
 			     &cleanArgs,
 			     "%s is not a regular file, could not be opened for reading, or was not found.",
 			     filespec);
+			FREE(aFilespec);
 
 			return newTest;
 		}
Signature · 7 lines
1.9.3


-- 
This message has been scanned for viruses and
dangerous content by FCNIC, and is
believed to be clean.
#3 lore raw

PATCH v2 2/2 Fix the order between 2>&1 and >/dev/null

The 2>&1 has to be after >/dev/null.
PS, this patch fix the problem is as same as b85bb78.

---
 testcases/kernel/fs/acl/tacl_xattr.sh             |  2 +-
 testcases/kernel/fs/fs-bench/modaltr.sh           |  2 +-
 testcases/kernel/power_management/runpwtests03.sh |  4 +-
 testscripts/autofs1.sh                            | 10 ++---
 testscripts/autofs4.sh                            | 46 +++++++++++------------
 testscripts/exportfs.sh                           | 20 +++++-----
 tools/pounder21/libpounder.sh                     |  1 +
 7 files changed, 43 insertions(+), 42 deletions(-)
testcases/kernel/fs/acl/tacl_xattr.sh +1 -1
index 99f6a95..b42b665 100755
@@ -80,7 +80,7 @@ fi
 dd if=/dev/zero of=tacl/blkext2 bs=1k count=10240
 chmod 777 tacl/blkext2
 
-losetup /dev/loop0 tacl/blkext2 2>&1 > /dev/null
+losetup /dev/loop0 tacl/blkext2 >/dev/null 2>&1
 if [ $? != 0 ]
 then
 	echo ""
testcases/kernel/fs/fs-bench/modaltr.sh +1 -1
index 74bf59e..c4ea745 100755
@@ -89,7 +89,7 @@ modprobe $LOOP
 	echo "check wheather loopback device option is been compiled in the kernel"
 fi
 mkdir -p $BLOCK_DIR
-mknod $BLOCK_DIR/0 b 31 0 2>&1 > /dev/null
+mknod $BLOCK_DIR/0 b 31 0 >/dev/null 2>&1
 mount -t jffs2 $BLOCK_DIR/0 $MOUNT_DIR
 mount|grep $JFFS2
 	if [ $? -eq 0 ]; then
testcases/kernel/power_management/runpwtests03.sh +2 -2
index 7e9ac4b..d4ea88b 100755
@@ -35,7 +35,7 @@ check_cpufreq_sysfs_files() {
 			-name "*" -type f)
 		for files in ${cpufiles}
 		do
-			cat ${files} 2>&1 >/dev/null
+			cat ${files} >/dev/null 2>&1
 			if [ $? -ne 0 ] ; then
 				echo "${0}: FAIL: cat ${files}"
 				RC=1
@@ -83,7 +83,7 @@ change_freq() {
 	(( total_cpus-=1 ))
 
 	if ( echo ${available_govr} | grep -i "userspace" \
-		2>&1 >/dev/null ); then
+		>/dev/null 2>&1 ); then
 		for cpu in $(seq 0 "${total_cpus}" )
 		do
 			echo userspace > \
testscripts/autofs1.sh +5 -5
index 678b56f..324c4db 100755
@@ -199,16 +199,16 @@ fi
 
 echo "forcing error paths and conditions..."
 
-mkdir /AUTOFS/MEDIA/mydir 2>&1 > /dev/null
-rm -rf /AUTOFS 2>&1 > /dev/null
+mkdir /AUTOFS/MEDIA/mydir >/dev/null 2>&1
+rm -rf /AUTOFS >/dev/null 2>&1
 
 mkdir /AUTOFS/MEDIA/floppy/test
 cp /etc/auto.master /etc/auto.media /AUTOFS/MEDIA/floppy/test
 sync; sync
 echo "Resuming test, please wait..."
 sleep 60
-mkdir /AUTOFS/MEDIA/mydir 2>&1 > /dev/null
-rm -rf /AUTOFS            2>&1 > /dev/null
+mkdir /AUTOFS/MEDIA/mydir >/dev/null 2>&1
+rm -rf /AUTOFS >/dev/null 2>&1
 
 
 ##############################################################
@@ -234,7 +234,7 @@ sleep 60
 
 if [ -e  /AUTOFS/DISK/disk/test ]; then
   cd /AUTOFS/DISK/disk/test
-  umount /AUTOFS/DISK/disk/ 2>&1 > /dev/null
+  umount /AUTOFS/DISK/disk/ >/dev/null 2>&1
   if [ $? = 0 ]
     then
 	/etc/init.d/autofs stop
testscripts/autofs4.sh +23 -23

144 lines not on this page · raw message

testscripts/exportfs.sh +10 -10
index f5d5294..8afe017 100755
@@ -98,27 +98,27 @@ fi
 # Add code here.
 
 
-ping -c 2 -w 15 $NFS_SERVER 2>&1 >/dev/null
+ping -c 2 -w 15 $NFS_SERVER >/dev/null 2>&1
 if [ $? != 0 ]
 then
 	echo "FAILED: ping $NFS_SERVER failed"
 	exit 1
 fi
 
-rsh -n -l root $NFS_SERVER "ls -l /etc" 2>&1 >/dev/null
+rsh -n -l root $NFS_SERVER "ls -l /etc" >/dev/null 2>&1
 if [ $? != 0 ]
 then
 	echo "FAILED: rsh -n -l root $NFS_SERVER "ls -l /etc" failed"
 	exit 1
 fi
 
-rsh -n -l root $NFS_SERVER "rpm -q -a | grep $FS_TYPE" | grep $FS_TYPE 2>&1 > /dev/null
+rsh -n -l root $NFS_SERVER "rpm -q -a | grep $FS_TYPE" | grep $FS_TYPE >/dev/null 2>&1
 if [ $? != 0 ]
 then
-	rsh -n -l root $NFS_SERVER "grep $FS_TYPE /etc/filesystems" | grep $FS_TYPE 2>&1 > /dev/null
+	rsh -n -l root $NFS_SERVER "grep $FS_TYPE /etc/filesystems" | grep $FS_TYPE >/dev/null 2>&1
 	if [ $? != 0 ]
 	then
-		rsh -n -l root $NFS_SERVER "grep $FS_TYPE /proc/filesystems" | grep $FS_TYPE 2>&1 > /dev/null
+		rsh -n -l root $NFS_SERVER "grep $FS_TYPE /proc/filesystems" | grep $FS_TYPE >/dev/null 2>&1
 		if [ $? != 0 ]
 		then
 			echo "FAILED: $FS_TYPE package is not installed or loaded on $NFS_SERVER"
@@ -129,17 +129,17 @@ fi
 
 if [ "$FS_TYPE" = "reiserfs" ]
 then
-#	rsh -n -l root $NFS_SERVER "/sbin/mkfs -t $FS_TYPE --format 3.6 -f $REM_DISK_PART 2>&1 > /dev/null"
-	rsh -n -l root $NFS_SERVER "/sbin/mkfs -t $FS_TYPE -f $REM_DISK_PART --format 3.6 2>&1 > /dev/null"
-	echo "/sbin/mkfs -t $FS_TYPE --format 3.6 -f $REM_DISK_PART 2>&1 > /dev/null"
+#	rsh -n -l root $NFS_SERVER "/sbin/mkfs -t $FS_TYPE --format 3.6 -f $REM_DISK_PART >/dev/null 2>&1"
+	rsh -n -l root $NFS_SERVER "/sbin/mkfs -t $FS_TYPE -f $REM_DISK_PART --format 3.6 >/dev/null 2>&1"
+	echo "/sbin/mkfs -t $FS_TYPE --format 3.6 -f $REM_DISK_PART >/dev/null 2>&1"
 else
-#	rsh -n -l root $NFS_SERVER "/sbin/mkfs -t $FS_TYPE $REM_DISK_PART 2>&1 > /dev/null"
+#	rsh -n -l root $NFS_SERVER "/sbin/mkfs -t $FS_TYPE $REM_DISK_PART >/dev/null 2>&1"
 	QUIETFLAG=
 	if [ "$FS_TYPE" = "jfs" ]
 	then
 		QUIETFLAG="-q"
 	fi
-	rsh -n -l root $NFS_SERVER "/sbin/mkfs -t $FS_TYPE $QUIETFLAG $REM_DISK_PART 2>&1 > /dev/null"
+	rsh -n -l root $NFS_SERVER "/sbin/mkfs -t $FS_TYPE $QUIETFLAG $REM_DISK_PART >/dev/null 2>&1"
 	if [ $? != 0 ]
 	then
 		echo "FAILED: Could not /sbin/mkfs -t $FS_TYPE $REM_DISK_PART on $NFS_SERVER"
tools/pounder21/libpounder.sh +1 -0
index 21e4613..8e20c0f 100644
@@ -1,3 +1,4 @@
+#!/bin/sh
 # Common shell functions and variables that all pounder scripts can use.
 
 # Copyright (C) 2003-2006 IBM
Signature · 7 lines
1.9.3


-- 
This message has been scanned for viruses and
dangerous content by FCNIC, and is
believed to be clean.
#4 lore raw

PATCH v2 2/2 Fix the order between 2>&1 and >/dev/null

Hi!

tools/pounder21/libpounder.sh line 4

Quoted 7 lines
tools/pounder21/libpounder.sh +1 -0
@@ -1,3 +1,4 @@
+#!/bin/sh
 # Common shell functions and variables that all pounder scripts can use.
 
 # Copyright (C) 2003-2006 IBM

Is there a reason to add the shebang here? And if there is, the change should be described in the git commit message.

The rest looks good.

Signature · 2 lines
Cyril Hrubis
[email protected]
#5 lore raw

PATCH v2 2/2 Fix the order between 2>&1 and >/dev/null

Quoted 11 lines · Cyril Hrubis

Hi!

tools/pounder21/libpounder.sh line 4

Quoted 7 lines
tools/pounder21/libpounder.sh +1 -0
@@ -1,3 +1,4 @@
+#!/bin/sh
 # Common shell functions and variables that all pounder scripts can use.
 
 # Copyright (C) 2003-2006 IBM

Is there a reason to add the shebang here? And if there is, the change should be described in the git commit message.

I will remove the shebang.

Quoted 6 lines

The rest looks good.

Signature · 2 lines
Cyril Hrubis
[email protected]
Signature · 2 lines
This message has been scanned for viruses and
dangerous content by Fujitsu, and is believed to be clean.
#6 lore raw

PATCH v3 1/2 kernel/io/disktest: cleanup upon failure occurs

In reply to Wei Jiangang
---
 testcases/kernel/io/disktest/dump.c | 2 ++
 testcases/kernel/io/disktest/main.c | 1 +
 2 files changed, 3 insertions(+)
testcases/kernel/io/disktest/dump.c +2 -0
index 615e8b4..4c38311 100644
@@ -192,12 +192,14 @@ int do_dump(child_args_t * args)
 		pMsg(ERR, args, "could not open %s.\n", args->device);
 		pMsg(ERR, args, "%s: Error = %u\n", args->device,
 		     GETLASTERROR());
+		FREE(buff);
 		return (-1);
 	}
 
 	TargetLBA = Seek(fd, args->start_lba * BLK_SIZE);
 	if (TargetLBA != (args->start_lba * (OFF_T) BLK_SIZE)) {
 		pMsg(ERR, args, "Could not seek to start position.\n");
+		FREE(buff);
 		CLOSE(fd);
 		return (-1);
 	}
testcases/kernel/io/disktest/main.c +1 -0
index 9484ec1..c372b04 100644
@@ -501,6 +501,7 @@ test_ll_t *run()
 			     &cleanArgs,
 			     "%s is not a regular file, could not be opened for reading, or was not found.",
 			     filespec);
+			FREE(aFilespec);
 
 			return newTest;
 		}
Signature · 1 line
1.9.3
#7 lore raw

PATCH v3 2/2 fix the redirection order

The 2>&1 has to be after >/dev/null.
PS, this patch fix the problem is as same as b85bb78.

---
 testcases/kernel/fs/acl/tacl_xattr.sh             |  2 +-
 testcases/kernel/fs/fs-bench/modaltr.sh           |  2 +-
 testcases/kernel/power_management/runpwtests03.sh |  4 +-
 testscripts/autofs1.sh                            | 10 ++---
 testscripts/autofs4.sh                            | 46 +++++++++++------------
 testscripts/exportfs.sh                           | 20 +++++-----
 6 files changed, 42 insertions(+), 42 deletions(-)
testcases/kernel/fs/acl/tacl_xattr.sh +1 -1
index 99f6a95..b42b665 100755
@@ -80,7 +80,7 @@ fi
 dd if=/dev/zero of=tacl/blkext2 bs=1k count=10240
 chmod 777 tacl/blkext2
 
-losetup /dev/loop0 tacl/blkext2 2>&1 > /dev/null
+losetup /dev/loop0 tacl/blkext2 >/dev/null 2>&1
 if [ $? != 0 ]
 then
 	echo ""
testcases/kernel/fs/fs-bench/modaltr.sh +1 -1
index 74bf59e..c4ea745 100755
@@ -89,7 +89,7 @@ modprobe $LOOP
 	echo "check wheather loopback device option is been compiled in the kernel"
 fi
 mkdir -p $BLOCK_DIR
-mknod $BLOCK_DIR/0 b 31 0 2>&1 > /dev/null
+mknod $BLOCK_DIR/0 b 31 0 >/dev/null 2>&1
 mount -t jffs2 $BLOCK_DIR/0 $MOUNT_DIR
 mount|grep $JFFS2
 	if [ $? -eq 0 ]; then
testcases/kernel/power_management/runpwtests03.sh +2 -2
index 7e9ac4b..d4ea88b 100755
@@ -35,7 +35,7 @@ check_cpufreq_sysfs_files() {
 			-name "*" -type f)
 		for files in ${cpufiles}
 		do
-			cat ${files} 2>&1 >/dev/null
+			cat ${files} >/dev/null 2>&1
 			if [ $? -ne 0 ] ; then
 				echo "${0}: FAIL: cat ${files}"
 				RC=1
@@ -83,7 +83,7 @@ change_freq() {
 	(( total_cpus-=1 ))
 
 	if ( echo ${available_govr} | grep -i "userspace" \
-		2>&1 >/dev/null ); then
+		>/dev/null 2>&1 ); then
 		for cpu in $(seq 0 "${total_cpus}" )
 		do
 			echo userspace > \
testscripts/autofs1.sh +5 -5
index 678b56f..324c4db 100755
@@ -199,16 +199,16 @@ fi
 
 echo "forcing error paths and conditions..."
 
-mkdir /AUTOFS/MEDIA/mydir 2>&1 > /dev/null
-rm -rf /AUTOFS 2>&1 > /dev/null
+mkdir /AUTOFS/MEDIA/mydir >/dev/null 2>&1
+rm -rf /AUTOFS >/dev/null 2>&1
 
 mkdir /AUTOFS/MEDIA/floppy/test
 cp /etc/auto.master /etc/auto.media /AUTOFS/MEDIA/floppy/test
 sync; sync
 echo "Resuming test, please wait..."
 sleep 60
-mkdir /AUTOFS/MEDIA/mydir 2>&1 > /dev/null
-rm -rf /AUTOFS            2>&1 > /dev/null
+mkdir /AUTOFS/MEDIA/mydir >/dev/null 2>&1
+rm -rf /AUTOFS >/dev/null 2>&1
 
 
 ##############################################################
@@ -234,7 +234,7 @@ sleep 60
 
 if [ -e  /AUTOFS/DISK/disk/test ]; then
   cd /AUTOFS/DISK/disk/test
-  umount /AUTOFS/DISK/disk/ 2>&1 > /dev/null
+  umount /AUTOFS/DISK/disk/ >/dev/null 2>&1
   if [ $? = 0 ]
     then
 	/etc/init.d/autofs stop
testscripts/autofs4.sh +23 -23

144 lines not on this page · raw message

testscripts/exportfs.sh +10 -10
index f5d5294..8afe017 100755
@@ -98,27 +98,27 @@ fi
 # Add code here.
 
 
-ping -c 2 -w 15 $NFS_SERVER 2>&1 >/dev/null
+ping -c 2 -w 15 $NFS_SERVER >/dev/null 2>&1
 if [ $? != 0 ]
 then
 	echo "FAILED: ping $NFS_SERVER failed"
 	exit 1
 fi
 
-rsh -n -l root $NFS_SERVER "ls -l /etc" 2>&1 >/dev/null
+rsh -n -l root $NFS_SERVER "ls -l /etc" >/dev/null 2>&1
 if [ $? != 0 ]
 then
 	echo "FAILED: rsh -n -l root $NFS_SERVER "ls -l /etc" failed"
 	exit 1
 fi
 
-rsh -n -l root $NFS_SERVER "rpm -q -a | grep $FS_TYPE" | grep $FS_TYPE 2>&1 > /dev/null
+rsh -n -l root $NFS_SERVER "rpm -q -a | grep $FS_TYPE" | grep $FS_TYPE >/dev/null 2>&1
 if [ $? != 0 ]
 then
-	rsh -n -l root $NFS_SERVER "grep $FS_TYPE /etc/filesystems" | grep $FS_TYPE 2>&1 > /dev/null
+	rsh -n -l root $NFS_SERVER "grep $FS_TYPE /etc/filesystems" | grep $FS_TYPE >/dev/null 2>&1
 	if [ $? != 0 ]
 	then
-		rsh -n -l root $NFS_SERVER "grep $FS_TYPE /proc/filesystems" | grep $FS_TYPE 2>&1 > /dev/null
+		rsh -n -l root $NFS_SERVER "grep $FS_TYPE /proc/filesystems" | grep $FS_TYPE >/dev/null 2>&1
 		if [ $? != 0 ]
 		then
 			echo "FAILED: $FS_TYPE package is not installed or loaded on $NFS_SERVER"
@@ -129,17 +129,17 @@ fi
 
 if [ "$FS_TYPE" = "reiserfs" ]
 then
-#	rsh -n -l root $NFS_SERVER "/sbin/mkfs -t $FS_TYPE --format 3.6 -f $REM_DISK_PART 2>&1 > /dev/null"
-	rsh -n -l root $NFS_SERVER "/sbin/mkfs -t $FS_TYPE -f $REM_DISK_PART --format 3.6 2>&1 > /dev/null"
-	echo "/sbin/mkfs -t $FS_TYPE --format 3.6 -f $REM_DISK_PART 2>&1 > /dev/null"
+#	rsh -n -l root $NFS_SERVER "/sbin/mkfs -t $FS_TYPE --format 3.6 -f $REM_DISK_PART >/dev/null 2>&1"
+	rsh -n -l root $NFS_SERVER "/sbin/mkfs -t $FS_TYPE -f $REM_DISK_PART --format 3.6 >/dev/null 2>&1"
+	echo "/sbin/mkfs -t $FS_TYPE --format 3.6 -f $REM_DISK_PART >/dev/null 2>&1"
 else
-#	rsh -n -l root $NFS_SERVER "/sbin/mkfs -t $FS_TYPE $REM_DISK_PART 2>&1 > /dev/null"
+#	rsh -n -l root $NFS_SERVER "/sbin/mkfs -t $FS_TYPE $REM_DISK_PART >/dev/null 2>&1"
 	QUIETFLAG=
 	if [ "$FS_TYPE" = "jfs" ]
 	then
 		QUIETFLAG="-q"
 	fi
-	rsh -n -l root $NFS_SERVER "/sbin/mkfs -t $FS_TYPE $QUIETFLAG $REM_DISK_PART 2>&1 > /dev/null"
+	rsh -n -l root $NFS_SERVER "/sbin/mkfs -t $FS_TYPE $QUIETFLAG $REM_DISK_PART >/dev/null 2>&1"
 	if [ $? != 0 ]
 	then
 		echo "FAILED: Could not /sbin/mkfs -t $FS_TYPE $REM_DISK_PART on $NFS_SERVER"
Signature · 1 line
1.9.3
#9 lore raw

PATCH v2 1/2 kernel/io/disktest: cleanup upon failure occurs

In reply to Wei Jiangang

Hi!

testcases/kernel/io/disktest/dump.c int do_dump(child_args_t * args) · line 202

Quoted 10 lines
testcases/kernel/io/disktest/dump.c +2 -0
 		pMsg(ERR, args, "%s: Error = %u\n", args->device,
 		     GETLASTERROR());
+		FREE(buff);
 		return (-1);
 	}
 
 	TargetLBA = Seek(fd, args->start_lba * BLK_SIZE);
 	if (TargetLBA != (args->start_lba * (OFF_T) BLK_SIZE)) {
 		pMsg(ERR, args, "Could not seek to start position.\n");
+		FREE(buf);

^
Should be buff

The code does not even compile after the change, can you please compile test your change to avoid typos like this one?

Signature · 2 lines
Cyril Hrubis
[email protected]
#10 lore raw

PATCH v2 1/2 kernel/io/disktest: cleanup upon failure occurs

Quoted 14 lines · Cyril Hrubis

Hi!

testcases/kernel/io/disktest/dump.c int do_dump(child_args_t * args) · line 202

Quoted 10 lines
testcases/kernel/io/disktest/dump.c +2 -0
 		pMsg(ERR, args, "%s: Error = %u\n", args->device,
 		     GETLASTERROR());
+		FREE(buff);
 		return (-1);
 	}
 
 	TargetLBA = Seek(fd, args->start_lba * BLK_SIZE);
 	if (TargetLBA != (args->start_lba * (OFF_T) BLK_SIZE)) {
 		pMsg(ERR, args, "Could not seek to start position.\n");
+		FREE(buf);

^
Should be buff

Quoted 2 lines

The code does not even compile after the change, can you please compile test your change to avoid typos like this one?

Ok, I will keep in mind your comment.
Thanks a lot.

Quoted 5 lines
Signature · 3 lines
-- 
Cyril Hrubis
[email protected]
Signature · 2 lines
This message has been scanned for viruses and
dangerous content by Fujitsu, and is believed to be clean.
#11 lore raw

PATCH 1/2 kernel/io/disktest: cleanup upon failure occurs

In reply to Wei Jiangang

Hi,

Sorry for that this patch has indent problem. Please ignore both of them.
I will resend v2.

Quoted 37 lines · Wei Jiangang
---
 testcases/kernel/io/disktest/dump.c | 2 ++
 testcases/kernel/io/disktest/main.c | 1 +
 2 files changed, 3 insertions(+)
testcases/kernel/io/disktest/dump.c +2 -0
index 615e8b4..d83e571 100644
@@ -192,12 +192,14 @@ int do_dump(child_args_t * args)
 		pMsg(ERR, args, "could not open %s.\n", args->device);
 		pMsg(ERR, args, "%s: Error = %u\n", args->device,
 		     GETLASTERROR());
+                FREE(buff);
 		return (-1);
 	}
 
 	TargetLBA = Seek(fd, args->start_lba * BLK_SIZE);
 	if (TargetLBA != (args->start_lba * (OFF_T) BLK_SIZE)) {
 		pMsg(ERR, args, "Could not seek to start position.\n");
+                FREE(buf);
 		CLOSE(fd);
 		return (-1);
 	}
testcases/kernel/io/disktest/main.c +1 -0
index 9484ec1..050ddea 100644
@@ -501,6 +501,7 @@ test_ll_t *run()
 			     &cleanArgs,
 			     "%s is not a regular file, could not be opened for reading, or was not found.",
 			     filespec);
+                        FREE(aFilespec);
 
 			return newTest;
 		}
Signature · 3 lines
This message has been scanned for viruses and
dangerous content by FCNIC, and is
believed to be clean.