public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] dhcpd_tests.sh: fix dhcpd.conf file paths
@ 2013-10-31  5:44 Simon Xu
  2013-10-31  8:44 ` Wanlong Gao
  0 siblings, 1 reply; 2+ messages in thread
From: Simon Xu @ 2013-10-31  5:44 UTC (permalink / raw)
  To: ltp-list

dhcpd_tests.sh only checks for /etc/dhcpd.conf, while in some distros the
path is /etc/dhcp/dhcpd.conf.
---
 testcases/network/dhcpd/dhcpd_tests.sh | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/testcases/network/dhcpd/dhcpd_tests.sh b/testcases/network/dhcpd/dhcpd_tests.sh
index 64c64e8..c00e549 100755
--- a/testcases/network/dhcpd/dhcpd_tests.sh
+++ b/testcases/network/dhcpd/dhcpd_tests.sh
@@ -42,7 +42,7 @@
 # Function:		init
 #
 # Description:	- Check if command dhcpd is available.
-#				- Check if /etc/dhcpd.conf is available.
+#               - Check if dhcpd.conf file is available.
 #               - Create temporary config file, for dhcpd.
 #               - alias ethX to ethX:1 with IP 10.1.1.12
 #
@@ -141,11 +141,18 @@ init()
 		return $RC
 	fi
 
-	if [ -f /etc/dhcpd.conf ]
+	if [ -f /etc/dhcpd.conf ]; then
+		DHCPD_CONF="/etc/dhcpd.conf"
+	elif [ -f /etc/dhcp/dhcpd.conf ]; then
+		DHCPD_CONF="/etc/dhcp/dhcpd.conf"
+	else
+		DHCPD_CONF=""
+	fi
+	if [ -n $DHCPD_CONF ]
 	then
 		RC1=0
-		mv /etc/dhcpd.conf $LTPTMP/dhcpd.conf > $LTPTMP/tst_dhcpd.err 2>&1 || RC=$?
-		mv $LTPTMP/tst_dhcpd.conf /etc/dhcpd.conf > $LTPTMP/tst_dhcpd.err 2>&1 \
+		mv $DHCPD_CONF $LTPTMP/dhcpd.conf > $LTPTMP/tst_dhcpd.err 2>&1 || RC=$?
+		mv $LTPTMP/tst_dhcpd.conf $DHCPD_CONF > $LTPTMP/tst_dhcpd.err 2>&1 \
 			|| RC1=$?
 		if [ $RC -ne 0 -o $RC1 -ne 0 ]
 		then
@@ -155,7 +162,7 @@ init()
 		fi
 	else
 		tst_brkm TBROK NULL \
-			"INIT: No /etc/dhcpd.conf file found."
+			"INIT: No dhcpd.conf file found."
 		return $(($RC+1))
 	fi
 
@@ -204,7 +211,7 @@ cleanup()
 
 	if [ -f $LTPTMP/dhcpd.conf ]
 	then
-		mv $LTPTMP/dhcpd.conf /etc/dhcpd.conf > $LTPTMP/tst_dhcpd.err 2>&1
+		mv $LTPTMP/dhcpd.conf $DHCPD_CONF > $LTPTMP/tst_dhcpd.err 2>&1
 	fi
 
 	/sbin/ifconfig | grep "${ETH_INTERFACE}:1" > $LTPTMP/tst_dhcpd.err 2>&1 || RC=$?
@@ -225,7 +232,7 @@ cleanup()
 #
 # Description	- Test basic functionality of dhcpd.
 #               - Test #1: dhcpd will serve IP addresses based on rules in
-#                 /etc/dhcpd.conf file.
+#                 dhcpd.conf file.
 #				- create dhcpd.conf file, server to listen to ethX/.../10.1.1.0
 #               - start dhcpd server
 #               - create expected output
@@ -241,7 +248,7 @@ test01()
 	TST_COUNT=1		# Test number.
 
 	tst_resm TINFO \
-	 "Test #1: dhcpd will serve IPaddr, rules in /etc/dhcpd.conf file."
+	 "Test #1: dhcpd will serve IPaddr, rules in dhcpd.conf file."
 
 	hwaddr=`ifconfig ${ETH_INTERFACE} | grep HWaddr | awk '{print $5}'` || RC=$?
 	if [ $RC -ne 0 ]
-- 
1.8.4


------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

end of thread, other threads:[~2013-10-31  8:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-31  5:44 [LTP] [PATCH] dhcpd_tests.sh: fix dhcpd.conf file paths Simon Xu
2013-10-31  8:44 ` Wanlong Gao

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