Skip to contentSkip to conversation

Make fs_inod script shell agnostic

PATCH In review Cristian Greco 2 participants 4 messages Feb 26, 2011 – Feb 27, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Make fs_inod script shell agnostic

Hi,

this patch will fix bashisms in fs_inod test script, i.e. it will be shell agnostic.

---
 testcases/kernel/fs/fs_inod/fs_inod |   28 ++++++++++++++--------------
 1 files changed, 14 insertions(+), 14 deletions(-)

Thanks,
--
Cristian Greco
GPG key ID: 0xCF4D32E4

testcases/kernel/fs/fs_inod/fs_inod +14 -14
index 39d7302..b7b6bd4 100755
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 #
 #
@@ -51,9 +51,9 @@
 #
 # RETURNS:              None.
 #=============================================================================
-function err_log
+err_log()
 {
-    let step_errors=$step_errors+1
+    step_errors=$(($step_errors+1))
 }
 
 
@@ -66,7 +66,7 @@ function err_log
 #
 # RETURNS: 		None.
 #=============================================================================
-function make_subdirs 
+make_subdirs ()
 {
     i=0;
     while [ "$i" -lt "$numsubdirs" ]; do
@@ -74,7 +74,7 @@ function make_subdirs
             echo "$0: mkdir dir$i"
             mkdir -p dir$i || echo "mkdir dir$i FAILED"
         }
-	let i="$i + 1"
+	i=$(($i + 1))
     done;
 } 
 
@@ -88,7 +88,7 @@ function make_subdirs
 #
 # RETURNS: 		None.
 #=============================================================================
-function touch_files 
+touch_files()
 {
     echo "$0: touch files [0-$numsubdirs]/file$numsubdirs[0-$numfiles]"
     j=0;
@@ -99,10 +99,10 @@ function touch_files
 
 	while [ "$k" -lt "$numfiles" ]; do  
 	    >file$j$k || err_log ">file$j$k FAILED"
-	    let k="$k + 1"
+	    k=$(($k + 1))
 	done
 
-	let j="$j + 1"
+	j=$(($j + 1))
 	cd ..
     done
 }
@@ -117,7 +117,7 @@ function touch_files
 #
 # RETURNS: 	None.
 #=============================================================================
-function rm_files 
+rm_files()
 {
     echo "$0: rm files [0-$numsubdirs]/file$numsubdirs[0-$numfiles]"
     j=0;
@@ -128,10 +128,10 @@ function rm_files
 
 	while [ "$k" -lt "$numfiles" ]; do  
 	    rm -f file$j$k || err_log "rm -f file$j$k FAILED"
-	    let k="$k + 1"
+	    k=$(($k + 1))
 	done
 
-	let j="$j + 1"
+	j=$(($j + 1))
 	cd ..
     done
 }
@@ -146,7 +146,7 @@ function rm_files
 #
 # RETURNS: 		None.
 #=============================================================================
-function step1 
+step1 ()
 { 
     echo "=============================================="
     echo "MULTIPLE PROCESSES CREATING AND DELETING FILES"
@@ -199,7 +199,7 @@ function step1
 	rm_files &
 	pid1=$!
 
-	let i="$i + 1"
+	i=$(($i + 1))
     done
 
     # wait for all background processes to complete execution
@@ -244,7 +244,7 @@ function step1
          step$I
          if [ $? != 0 ]; then
             echo "step$I failed - see above errors"
-            let ERRORS=$ERRORS+$step_errors
+            ERRORS=$(($ERRORS+$step_errors))
          fi
     done   
 

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in Real-Time with Splunk. Collect, index and harness all the fast moving IT data generated by your applications, servers and devices whether physical, virtual or in the cloud. Deliver compliance at lower cost and gain new business insights. http://p.sf.net/sfu/splunk-dev2dev

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#1 lore raw
Quoted 4 lines · Cristian Greco

Hi,

this patch will fix bashisms in fs_inod test script, i.e. it will be shell agnostic.

The overall idea is sane, but we use the null operator with the arithmetic operand $(( )) to increment in LTP:

A=$(( $A + 1 ))' -> : $(( A += 1 ))'

Thanks,
-Garrett

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in Real-Time with Splunk. Collect, index and harness all the fast moving IT data generated by your applications, servers and devices whether physical, virtual or in the cloud. Deliver compliance at lower cost and gain new business insights. http://p.sf.net/sfu/splunk-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#2 lore raw

PATCH 1/1 Make fs_inod script shell agnostic

Hi Garrett,

find attached the modified patch.

---
 testcases/kernel/fs/fs_inod/fs_inod |   28 ++++++++++++++--------------
 1 files changed, 14 insertions(+), 14 deletions(-)

Thanks,
--
Cristian Greco
GPG key ID: 0xCF4D32E4

testcases/kernel/fs/fs_inod/fs_inod +14 -14
index 39d7302..b962dad 100755
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 #
 #
@@ -51,9 +51,9 @@
 #
 # RETURNS:              None.
 #=============================================================================
-function err_log
+err_log()
 {
-    let step_errors=$step_errors+1
+    : $((step_errors += 1))
 }
 
 
@@ -66,7 +66,7 @@ function err_log
 #
 # RETURNS: 		None.
 #=============================================================================
-function make_subdirs 
+make_subdirs ()
 {
     i=0;
     while [ "$i" -lt "$numsubdirs" ]; do
@@ -74,7 +74,7 @@ function make_subdirs
             echo "$0: mkdir dir$i"
             mkdir -p dir$i || echo "mkdir dir$i FAILED"
         }
-	let i="$i + 1"
+	: $((i += 1))
     done;
 } 
 
@@ -88,7 +88,7 @@ function make_subdirs
 #
 # RETURNS: 		None.
 #=============================================================================
-function touch_files 
+touch_files()
 {
     echo "$0: touch files [0-$numsubdirs]/file$numsubdirs[0-$numfiles]"
     j=0;
@@ -99,10 +99,10 @@ function touch_files
 
 	while [ "$k" -lt "$numfiles" ]; do  
 	    >file$j$k || err_log ">file$j$k FAILED"
-	    let k="$k + 1"
+	    : $((k += 1))
 	done
 
-	let j="$j + 1"
+	: $((j += 1))
 	cd ..
     done
 }
@@ -117,7 +117,7 @@ function touch_files
 #
 # RETURNS: 	None.
 #=============================================================================
-function rm_files 
+rm_files()
 {
     echo "$0: rm files [0-$numsubdirs]/file$numsubdirs[0-$numfiles]"
     j=0;
@@ -128,10 +128,10 @@ function rm_files
 
 	while [ "$k" -lt "$numfiles" ]; do  
 	    rm -f file$j$k || err_log "rm -f file$j$k FAILED"
-	    let k="$k + 1"
+	    : $((k += 1))
 	done
 
-	let j="$j + 1"
+	: $((j += 1))
 	cd ..
     done
 }
@@ -146,7 +146,7 @@ function rm_files
 #
 # RETURNS: 		None.
 #=============================================================================
-function step1 
+step1 ()
 { 
     echo "=============================================="
     echo "MULTIPLE PROCESSES CREATING AND DELETING FILES"
@@ -199,7 +199,7 @@ function step1
 	rm_files &
 	pid1=$!
 
-	let i="$i + 1"
+	: $((i += 1))
     done
 
     # wait for all background processes to complete execution
@@ -244,7 +244,7 @@ function step1
          step$I
          if [ $? != 0 ]; then
             echo "step$I failed - see above errors"
-            let ERRORS=$ERRORS+$step_errors
+            : $((ERRORS += step_errors))
          fi
     done   
 

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in Real-Time with Splunk. Collect, index and harness all the fast moving IT data generated by your applications, servers and devices whether physical, virtual or in the cloud. Deliver compliance at lower cost and gain new business insights. http://p.sf.net/sfu/splunk-dev2dev

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#3 lore raw
Quoted 3 lines · Cristian Greco

Hi Garrett,

find attached the modified patch.

Committed -- thanks!
-Garrett

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in Real-Time with Splunk. Collect, index and harness all the fast moving IT data generated by your applications, servers and devices whether physical, virtual or in the cloud. Deliver compliance at lower cost and gain new business insights. http://p.sf.net/sfu/splunk-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list