Skip to contentSkip to conversation

testscripts: make redirects happen in correct order

PATCH Superseded Wei Jiangang 3 participants 8 messages Sep 30, 2015 – Oct 7, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 testscripts: make redirects happen in correct order

It should redirect stdout to /dev/null firstly, then redirect stderr to whatever stdout currently points at.

---
 testscripts/ltpstress.sh   |  4 ++--
 testscripts/runEALtests.sh | 10 +++++-----
 2 files changed, 7 insertions(+), 7 deletions(-)
testscripts/ltpstress.sh +2 -2
index 39a5caf..1a16779 100755
@@ -265,10 +265,10 @@ fi
 ulimit -u unlimited
 
 if [ $PROC_NUM -gt 0 ];then
-  genload --vm $PROC_NUM --vm-bytes 1073741824 2>&1 1>/dev/null &
+  genload --vm $PROC_NUM --vm-bytes 1073741824 1>/dev/null 2>&1 &
 fi
 if [ $leftover_memsize -gt 0 ];then
-  genload --vm 1 --vm-bytes $(($leftover_memsize * 1024)) 2>&1 1>/dev/null &
+  genload --vm 1 --vm-bytes $(($leftover_memsize * 1024)) 1>/dev/null 2>&1 &
 fi
 
 if [ $NO_NETWORK -eq 0 ];then
testscripts/runEALtests.sh +5 -5
index bcd3f29..577be28 100755
@@ -84,7 +84,7 @@ fi
 while getopts cd:f:hi:l:m:Nnpqr:t:x arg
 do  case $arg in
     c)
-            $LTPROOT/../testcases/bin/genload --cpu 1 2>&1 1>/dev/null &
+            $LTPROOT/../testcases/bin/genload --cpu 1 1>/dev/null 2>&1 &
 	    GenLoad=1 ;;
 
     d)      # append $$ to TMP, as it is recursively
@@ -97,9 +97,9 @@ do  case $arg in
 
     i)
             bytesize=$(($OPTARG * 1024 * 1024))
-            $LTPROOT/../testcases/bin/genload --io 1 2>&1 1>/dev/null &
+            $LTPROOT/../testcases/bin/genload --io 1 1>/dev/null 2>&1 &
             $LTPROOT/../testcases/bin/genload --hdd 0 --hdd-bytes $bytesize \
-            2>&1 1>/dev/null &
+            1>/dev/null 2>&1 &
 	    GenLoad=1 ;;
 
     l)
@@ -125,7 +125,7 @@ do  case $arg in
     m)
             memsize=$(($OPTARG * 1024 * 1024))
 	    $LTPROOT/../testcases/bin/genload  --vm 0 --vm-bytes $memsize\
-            2>&1 1>/dev/null &
+            1>/dev/null 2>&1 &
 	    GenLoad=1;;
 
     N)	    run_netest=1;;
@@ -217,7 +217,7 @@ fi
 
 if [ $GenLoad -eq 1 ]
 then
-	killall -9 genload
+	killall -9 genload >/dev/null 2>&1
 fi
 
 if [ $NetPipe -eq 1 ]
Signature · 1 line
1.9.3
#1 lore raw

PATCH 2/2 cpuhotplug_hotplug.sh: do/done should be left-aligned

---
 testcases/kernel/hotplug/cpu_hotplug/include/cpuhotplug_hotplug.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/hotplug/cpu_hotplug/include/cpuhotplug_hotplug.sh +1 -1
index d9cf965..ad8675a 100644
@@ -28,7 +28,7 @@ migrate_irq()
     MASK=$((1<<${CPU}))
     IRQS=$2
     for irq in ${IRQS}
-      do
+    do
       echo $MASK > /proc/irq/${irq}/smp_affinity || \
         tst_resm TINFO "It is NOT permitted to change the IRQ $irq smp_affinity"
     done
Signature · 1 line
1.9.3
#2 lore raw

PATCH 2/2 cpuhotplug_hotplug.sh: do/done should be left-aligned

Hi!

testcases/kernel/hotplug/cpu_hotplug/include/cpuhotplug_hotplug.sh migrate_irq() · line 31

Quoted 10 lines
testcases/kernel/hotplug/cpu_hotplug/include/cpuhotplug_hotplug.sh +1 -1
index d9cf965..ad8675a 100644
@@ -28,7 +28,7 @@ migrate_irq()
     MASK=$((1<<${CPU}))
     IRQS=$2
     for irq in ${IRQS}
-      do
+    do

The rest of the file has for cycles with semicolon and do on the same line. Let's be consistent and change this one to the same style as well.

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

PATCH 1/2 testscripts: make redirects happen in correct order

In reply to Wei Jiangang

The patch set had been sent at 2015/09/21.
But no feedback received.
I'm afraid of them was flooded.
so send again.

Quoted 69 lines · Wei Jiangang

It should redirect stdout to /dev/null firstly, then redirect stderr to whatever stdout currently points at.

---
 testscripts/ltpstress.sh   |  4 ++--
 testscripts/runEALtests.sh | 10 +++++-----
 2 files changed, 7 insertions(+), 7 deletions(-)
testscripts/ltpstress.sh +2 -2
index 39a5caf..1a16779 100755
@@ -265,10 +265,10 @@ fi
 ulimit -u unlimited
 
 if [ $PROC_NUM -gt 0 ];then
-  genload --vm $PROC_NUM --vm-bytes 1073741824 2>&1 1>/dev/null &
+  genload --vm $PROC_NUM --vm-bytes 1073741824 1>/dev/null 2>&1 &
 fi
 if [ $leftover_memsize -gt 0 ];then
-  genload --vm 1 --vm-bytes $(($leftover_memsize * 1024)) 2>&1 1>/dev/null &
+  genload --vm 1 --vm-bytes $(($leftover_memsize * 1024)) 1>/dev/null 2>&1 &
 fi
 
 if [ $NO_NETWORK -eq 0 ];then
testscripts/runEALtests.sh +5 -5
index bcd3f29..577be28 100755
@@ -84,7 +84,7 @@ fi
 while getopts cd:f:hi:l:m:Nnpqr:t:x arg
 do  case $arg in
     c)
-            $LTPROOT/../testcases/bin/genload --cpu 1 2>&1 1>/dev/null &
+            $LTPROOT/../testcases/bin/genload --cpu 1 1>/dev/null 2>&1 &
 	    GenLoad=1 ;;
 
     d)      # append $$ to TMP, as it is recursively
@@ -97,9 +97,9 @@ do  case $arg in
 
     i)
             bytesize=$(($OPTARG * 1024 * 1024))
-            $LTPROOT/../testcases/bin/genload --io 1 2>&1 1>/dev/null &
+            $LTPROOT/../testcases/bin/genload --io 1 1>/dev/null 2>&1 &
             $LTPROOT/../testcases/bin/genload --hdd 0 --hdd-bytes $bytesize \
-            2>&1 1>/dev/null &
+            1>/dev/null 2>&1 &
 	    GenLoad=1 ;;
 
     l)
@@ -125,7 +125,7 @@ do  case $arg in
     m)
             memsize=$(($OPTARG * 1024 * 1024))
 	    $LTPROOT/../testcases/bin/genload  --vm 0 --vm-bytes $memsize\
-            2>&1 1>/dev/null &
+            1>/dev/null 2>&1 &
 	    GenLoad=1;;
 
     N)	    run_netest=1;;
@@ -217,7 +217,7 @@ fi
 
 if [ $GenLoad -eq 1 ]
 then
-	killall -9 genload
+	killall -9 genload >/dev/null 2>&1
 fi
 
 if [ $NetPipe -eq 1 ]
#4 lore raw

PATCH 1/2 testscripts: make redirects happen in correct order

In reply to Wei Jiangang

Hi!

testscripts/ltpstress.sh fi · line 268

Quoted 3 lines

if [ $PROC_NUM -gt 0 ];then

testscripts/ltpstress.sh +1 -1
-  genload --vm $PROC_NUM --vm-bytes 1073741824 2>&1 1>/dev/null &
+  genload --vm $PROC_NUM --vm-bytes 1073741824 1>/dev/null 2>&1 &

Can we also change the redirect to canonical form (>/dev/null 2>&1)?

Otherwise it looks fine to me.

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

PATCH v2 1/2 testscripts: make redirects happen in correct order

It should redirect stdout to /dev/null firstly, then redirect stderr to whatever stdout currently points at.

---
 testscripts/ltpstress.sh   |  4 ++--
 testscripts/runEALtests.sh | 10 +++++-----
 2 files changed, 7 insertions(+), 7 deletions(-)
testscripts/ltpstress.sh +2 -2
index 39a5caf..651d3da 100755
@@ -265,10 +265,10 @@ fi
 ulimit -u unlimited
 
 if [ $PROC_NUM -gt 0 ];then
-  genload --vm $PROC_NUM --vm-bytes 1073741824 2>&1 1>/dev/null &
+  genload --vm $PROC_NUM --vm-bytes 1073741824 >/dev/null 2>&1 &
 fi
 if [ $leftover_memsize -gt 0 ];then
-  genload --vm 1 --vm-bytes $(($leftover_memsize * 1024)) 2>&1 1>/dev/null &
+  genload --vm 1 --vm-bytes $(($leftover_memsize * 1024)) >/dev/null 2>&1 &
 fi
 
 if [ $NO_NETWORK -eq 0 ];then
testscripts/runEALtests.sh +5 -5
index bcd3f29..a70bfad 100755
@@ -84,7 +84,7 @@ fi
 while getopts cd:f:hi:l:m:Nnpqr:t:x arg
 do  case $arg in
     c)
-            $LTPROOT/../testcases/bin/genload --cpu 1 2>&1 1>/dev/null &
+            $LTPROOT/../testcases/bin/genload --cpu 1 >/dev/null 2>&1 &
 	    GenLoad=1 ;;
 
     d)      # append $$ to TMP, as it is recursively
@@ -97,9 +97,9 @@ do  case $arg in
 
     i)
             bytesize=$(($OPTARG * 1024 * 1024))
-            $LTPROOT/../testcases/bin/genload --io 1 2>&1 1>/dev/null &
+            $LTPROOT/../testcases/bin/genload --io 1 >/dev/null 2>&1 &
             $LTPROOT/../testcases/bin/genload --hdd 0 --hdd-bytes $bytesize \
-            2>&1 1>/dev/null &
+            >/dev/null 2>&1 &
 	    GenLoad=1 ;;
 
     l)
@@ -125,7 +125,7 @@ do  case $arg in
     m)
             memsize=$(($OPTARG * 1024 * 1024))
 	    $LTPROOT/../testcases/bin/genload  --vm 0 --vm-bytes $memsize\
-            2>&1 1>/dev/null &
+            >/dev/null 2>&1 &
 	    GenLoad=1;;
 
     N)	    run_netest=1;;
@@ -217,7 +217,7 @@ fi
 
 if [ $GenLoad -eq 1 ]
 then
-	killall -9 genload
+	killall -9 genload >/dev/null 2>&1
 fi
 
 if [ $NetPipe -eq 1 ]
Signature · 1 line
1.9.3
#6 lore raw

PATCH v2 2/2 cpuhotplug_hotplug.sh: change the style of for-loop

Let do and for cycles on same line by using semicolon.

---
 testcases/kernel/hotplug/cpu_hotplug/include/cpuhotplug_hotplug.sh | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
testcases/kernel/hotplug/cpu_hotplug/include/cpuhotplug_hotplug.sh +1 -2
index d9cf965..f23463b 100644
@@ -27,8 +27,7 @@ migrate_irq()
     CPU=${1#cpu}
     MASK=$((1<<${CPU}))
     IRQS=$2
-    for irq in ${IRQS}
-      do
+    for irq in ${IRQS}; do
       echo $MASK > /proc/irq/${irq}/smp_affinity || \
         tst_resm TINFO "It is NOT permitted to change the IRQ $irq smp_affinity"
     done
Signature · 1 line
1.9.3