Skip to contentSkip to conversation

network: Fix ip_tests error

PATCH In review Hushan Jia 2 participants 4 messages Sep 7, 2009 – Sep 9, 2009

lore
Share & tools
lore

Hushan Jia

author
#0 lore raw

PATCH 1/1 network: Fix ip_tests error

Hi,

This patch fix several errors of testcases/network/iproute/ip_test.sh case:

1. Teset #1:
ip01 0 TINFO : Test #1: changing mtu size of eth0:1 device.
/mnt/ltp/ltp-full-20090731/testcases/bin/ip_tests.sh: line 198: [: -eq: unary operator expected.

The output of
ifconfig eth0:1 | grep -i MTU | sed "s/^.*MTU://"
is like:
1500 Metric:1
so should print field 1 instead of field 5.

2. Test #4:
ip tools now print nud state as follows:
REACHABLE, STALE, FAILED, etc.

3. Test #3, #4, #5:
If delete entry successfully, grep will return 1, indicating test PASS, so return code RC should be set to 0.

Thanks& Regards,
Hushan

---

network: Fix ip_tests test case error

testcases/network/iproute/ip_tests.sh renamed from testcases/network/iproute/ip_tests.sh.orig +12 -4
@@ -194,7 +194,7 @@ test01()
  			"Test #1: ip command failed. Reason: "
  		return $RC
  	else
-		MTUSZ=`ifconfig eth0:1 | grep -i MTU | sed "s/^.*MTU://" | awk '{print $5}'`
+		MTUSZ=`ifconfig eth0:1 | grep -i MTU | sed "s/^.*MTU://" | awk '{print $1}'`
  		if [ $MTUSZ -eq 300 ]
  		then
  			tst_resm TPASS "Test #1: changing mtu size success"
@@ -310,7 +310,9 @@ test03()
  				tst_res TFAIL $LTPTMP/tst_ip.err \
  				"Test #3: ip addr del command failed. Reason: "
  				return $(($RC+1))
-		fi
+			else
+				RC=0
+			fi
  		
  		tst_resm TPASS \
  			"Test #3: ip addr command tests successful"
@@ -354,7 +356,7 @@ test04()
  		 "Test #4: ip neigh show - shows all neighbour entries in arp tables."
 
  		cat>  $LTPTMP/tst_ip.exp<<-EOF
-		127.0.0.1 dev lo lladdr 00:00:00:00:00:00 nud reachable
+		127.0.0.1 dev lo lladdr 00:00:00:00:00:00 REACHABLE
  		EOF
 
  		ip neigh show 127.0.0.1 | head -n1>$LTPTMP/tst_ip.out 2>&1 || RC=$?
@@ -384,12 +386,14 @@ test04()
  				"Test #4: ip neigh del command failed return = $RC. Reason: "
  			return $RC
  		else
-			ip neigh show | grep 127.0.0.1 grep -v "nud failed$">$LTPTMP/tst_ip.err 2>&1 || RC=$?
+			ip neigh show | grep 127.0.0.1 | grep -v " FAILED$">$LTPTMP/tst_ip.err 2>&1 || RC=$?
  			if [ $RC -eq 0 ]
  			then
  				tst_res TFAIL $LTPTMP/tst_ip.err \
  				"Test #4: 127.0.0.1 still listed in arp. ip cmd Error Message:"
  				return $(($RC+1))
+			else
+				RC=0
  			fi
  		fi
  		
@@ -482,6 +486,8 @@ test05()
  				tst_res TFAIL $LTPTMP/tst_ip.err \
  				"Test #5: route not deleted. ip route show:"
  				return $(($RC+1))
+			else
+				RC=0
  			fi
  		fi
  		
@@ -570,6 +576,8 @@ test06()
  				tst_res TFAIL $LTPTMP/tst_ip.err \
  				"Test #6: 66:66:00:00:00:66 is not deleted. Details:"
  				return $(($RC+1))
+			else
+				RC=0
  			fi
  		fi
  		

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#1 lore raw

This has to be remade as i have already applied your previous patch.

Regards--
Subrata

Quoted 100 lines · Hushan Jia

Hi,

This patch fix several errors of testcases/network/iproute/ip_test.sh case:

1. Teset #1:
ip01 0 TINFO : Test #1: changing mtu size of eth0:1 device.
/mnt/ltp/ltp-full-20090731/testcases/bin/ip_tests.sh: line 198: [: -eq: unary operator expected.

The output of
ifconfig eth0:1 | grep -i MTU | sed "s/^.*MTU://"
is like:
1500 Metric:1
so should print field 1 instead of field 5.

2. Test #4:
ip tools now print nud state as follows:
REACHABLE, STALE, FAILED, etc.

3. Test #3, #4, #5:
If delete entry successfully, grep will return 1, indicating test PASS, so return code RC should be set to 0.

Thanks& Regards,
Hushan

---

network: Fix ip_tests test case error

testcases/network/iproute/ip_tests.sh renamed from testcases/network/iproute/ip_tests.sh.orig +12 -5
@@ -194,7 +194,7 @@ test01()
  			"Test #1: ip command failed. Reason: "
  		return $RC
  	else
-		MTUSZ=`ifconfig eth0:1 | grep -i MTU | sed "s/^.*MTU://" | awk '{print $5}'`
+		MTUSZ=`ifconfig eth0:1 | grep -i MTU | sed "s/^.*MTU://" | awk '{print $1}'`
  		if [ $MTUSZ -eq 300 ]
  		then
  			tst_resm TPASS "Test #1: changing mtu size success"
@@ -310,7 +310,9 @@ test03()
  				tst_res TFAIL $LTPTMP/tst_ip.err \
  				"Test #3: ip addr del command failed. Reason: "
  				return $(($RC+1))
-		fi
+			else
+				RC=0
+			fi
 
  		tst_resm TPASS \
  			"Test #3: ip addr command tests successful"
@@ -354,7 +356,7 @@ test04()
  		 "Test #4: ip neigh show - shows all neighbour entries in arp tables."
 
  		cat>  $LTPTMP/tst_ip.exp<<-EOF
-		127.0.0.1 dev lo lladdr 00:00:00:00:00:00 nud reachable
+		127.0.0.1 dev lo lladdr 00:00:00:00:00:00 REACHABLE
  		EOF
 
  		ip neigh show 127.0.0.1 | head -n1>$LTPTMP/tst_ip.out 2>&1 || RC=$?
@@ -384,12 +386,14 @@ test04()
  				"Test #4: ip neigh del command failed return = $RC. Reason: "
  			return $RC
  		else
-			ip neigh show | grep 127.0.0.1 grep -v "nud failed$">$LTPTMP/tst_ip.err 2>&1 || RC=$?
+			ip neigh show | grep 127.0.0.1 | grep -v " FAILED$">$LTPTMP/tst_ip.err 2>&1 || RC=$?
  			if [ $RC -eq 0 ]
  			then
  				tst_res TFAIL $LTPTMP/tst_ip.err \
  				"Test #4: 127.0.0.1 still listed in arp. ip cmd Error Message:"
  				return $(($RC+1))
+			else
+				RC=0
  			fi
  		fi
 
@@ -482,6 +486,8 @@ test05()
  				tst_res TFAIL $LTPTMP/tst_ip.err \
  				"Test #5: route not deleted. ip route show:"
  				return $(($RC+1))
+			else
+				RC=0
  			fi
  		fi
 
@@ -570,6 +576,8 @@ test06()
  				tst_res TFAIL $LTPTMP/tst_ip.err \
  				"Test #6: 66:66:00:00:00:66 is not deleted. Details:"
  				return $(($RC+1))
+			else
+				RC=0
  			fi
  		fi
 
 
 
 
------------------------------------------------------------------------------
Quoted 8 lines

Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

author
#2 lore raw

Re: [LTP] [PATCH] network: Fix ip_tests error 2

Hi Subrata,
I have remade the patch based on the first ip_tests.sh patch, changes:

1. Test #4:
ip tools now print nud state as follows:
REACHABLE, STALE, FAILED, etc.

2. Test #3, #4, #5:
If delete entry succefully, grep will return 1, indicating test PASS, so return code RC should be set to 0.

Thanks& Regards,
Hushan

---
network: Fix iproute test case error 2

testcases/network/iproute/ip_tests.sh renamed from testcases/network/iproute/ip_tests.sh.orig +11 -3
@@ -310,7 +310,9 @@ test03()
  				tst_res TFAIL $LTPTMP/tst_ip.err \
  				"Test #3: ip addr del command failed. Reason: "
  				return $(($RC+1))
-		fi
+			else
+				RC=0
+			fi
  		
  		tst_resm TPASS \
  			"Test #3: ip addr command tests successful"
@@ -354,7 +356,7 @@ test04()
  		 "Test #4: ip neigh show - shows all neighbour entries in arp tables."
 
  		cat>  $LTPTMP/tst_ip.exp<<-EOF
-		127.0.0.1 dev lo lladdr 00:00:00:00:00:00 nud reachable
+		127.0.0.1 dev lo lladdr 00:00:00:00:00:00 REACHABLE
  		EOF
 
  		ip neigh show 127.0.0.1 | head -n1>$LTPTMP/tst_ip.out 2>&1 || RC=$?
@@ -384,12 +386,14 @@ test04()
  				"Test #4: ip neigh del command failed return = $RC. Reason: "
  			return $RC
  		else
-			ip neigh show | grep 127.0.0.1 grep -v "nud failed$">$LTPTMP/tst_ip.err 2>&1 || RC=$?
+			ip neigh show | grep 127.0.0.1 | grep -v " FAILED$">$LTPTMP/tst_ip.err 2>&1 || RC=$?
  			if [ $RC -eq 0 ]
  			then
  				tst_res TFAIL $LTPTMP/tst_ip.err \
  				"Test #4: 127.0.0.1 still listed in arp. ip cmd Error Message:"
  				return $(($RC+1))
+			else
+				RC=0
  			fi
  		fi
  		
@@ -482,6 +486,8 @@ test05()
  				tst_res TFAIL $LTPTMP/tst_ip.err \
  				"Test #5: route not deleted. ip route show:"
  				return $(($RC+1))
+			else
+				RC=0
  			fi
  		fi
  		
@@ -570,6 +576,8 @@ test06()
  				tst_res TFAIL $LTPTMP/tst_ip.err \
  				"Test #6: 66:66:00:00:00:66 is not deleted. Details:"
  				return $(($RC+1))
+			else
+				RC=0
  			fi
  		fi
  		

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#3 lore raw

Re: [LTP] [PATCH] network: Fix ip_tests error 2

Quoted 11 lines · Hushan Jia

Hi Subrata,
I have remade the patch based on the first ip_tests.sh patch, changes:

1. Test #4:
ip tools now print nud state as follows:
REACHABLE, STALE, FAILED, etc.

2. Test #3, #4, #5:
If delete entry succefully, grep will return 1, indicating test PASS, so return code RC should be set to 0.

Quoted 7 lines

Thanks& Regards,
Hushan

---
network: Fix iproute test case error 2

Sorry, this fail to apply too:

patching file testcases/network/iproute/ip_tests.sh Hunk #1 FAILED at 310.
Hunk #2 FAILED at 356.
Hunk #3 FAILED at 386.
Hunk #4 FAILED at 486.
Hunk #5 FAILED at 576.
5 out of 5 hunks FAILED -- saving rejects to file testcases/network/iproute/ip_tests.sh.rej

Regards--
Subrata

Quoted 51 lines
testcases/network/iproute/ip_tests.sh renamed from testcases/network/iproute/ip_tests.sh.orig +9 -3
@@ -310,7 +310,9 @@ test03()
  				tst_res TFAIL $LTPTMP/tst_ip.err \
  				"Test #3: ip addr del command failed. Reason: "
  				return $(($RC+1))
-		fi
+			else
+				RC=0
+			fi
 
  		tst_resm TPASS \
  			"Test #3: ip addr command tests successful"
@@ -354,7 +356,7 @@ test04()
  		 "Test #4: ip neigh show - shows all neighbour entries in arp tables."
 
  		cat>  $LTPTMP/tst_ip.exp<<-EOF
-		127.0.0.1 dev lo lladdr 00:00:00:00:00:00 nud reachable
+		127.0.0.1 dev lo lladdr 00:00:00:00:00:00 REACHABLE
  		EOF
 
  		ip neigh show 127.0.0.1 | head -n1>$LTPTMP/tst_ip.out 2>&1 || RC=$?
@@ -384,12 +386,14 @@ test04()
  				"Test #4: ip neigh del command failed return = $RC. Reason: "
  			return $RC
  		else
-			ip neigh show | grep 127.0.0.1 grep -v "nud failed$">$LTPTMP/tst_ip.err 2>&1 || RC=$?
+			ip neigh show | grep 127.0.0.1 | grep -v " FAILED$">$LTPTMP/tst_ip.err 2>&1 || RC=$?
  			if [ $RC -eq 0 ]
  			then
  				tst_res TFAIL $LTPTMP/tst_ip.err \
  				"Test #4: 127.0.0.1 still listed in arp. ip cmd Error Message:"
  				return $(($RC+1))
+			else
+				RC=0
  			fi
  		fi
 
@@ -482,6 +486,8 @@ test05()
  				tst_res TFAIL $LTPTMP/tst_ip.err \
  				"Test #5: route not deleted. ip route show:"
  				return $(($RC+1))
+			else
+				RC=0
  			fi
  		fi
 

testcases/network/iproute/ip_tests.sh test06() · line 583

Quoted 8 lines
testcases/network/iproute/ip_tests.sh renamed from testcases/network/iproute/ip_tests.sh.orig +2 -0
@@ -570,6 +576,8 @@ test06()
  				tst_res TFAIL $LTPTMP/tst_ip.err \
  				"Test #6: 66:66:00:00:00:66 is not deleted. Details:"
  				return $(($RC+1))
+			else
+				RC=0
  			fi
  		fi
 

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list