Skip to contentSkip to conversation

pTest-tcl fail fixed

PATCH In review Dengke Du 2 participants 3 messages Mar 1, 2016 – Mar 7, 2016

lore
Share & tools
lore

Dengke Du

author
#0 lore raw

cover pTest-tcl fail fixed

The following changes since commit 23056103c949b498c23b47579e8dd57ce78e6ed9:

uclibc: Do not use immediate expansion operator (2016-02-22 20:42:48 +0000)

are available in the git repository at:

git://git.openembedded.org/openembedded-core-contrib dengke/pTest-tcl-fail-fixed
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=dengke/pTest-tcl-fail-fixed

Dengke Du (1):
pTest-tcl fail fixed

 meta/recipes-core/initscripts/initscripts-1.0/hostname.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 1/1 pTest-tcl fail fixed

http.test httpold.test socket.test failed when run the pTest-tcl,because the tcl script "info hostname" in /usr/lib/tcl/ptest/tests/http.test on target fail. When run the "info hostname" get the hostname,but it can find the IP in the /etc/hosts, so it failed. We need to add the IP and hostname pair in the /etc/hosts. In order to add the IP and hostname pair in the /etc/hosts, we need to add the pair when the target start, so I add the "echo "127.0.0.1 cat /etc/hostname" >> /etc/hosts" to the hostname.sh in "meta/recipes-core/initscripts/initscripts-1.0/", when the system invoke the hostname.sh in "/etc/init.d/", it add the IP and hostname pair in the /etc/hosts.

---
 meta/recipes-core/initscripts/initscripts-1.0/hostname.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-core/initscripts/initscripts-1.0/hostname.sh +1 -1
index 95287cc..8866d87 100755
@@ -13,7 +13,7 @@ hostname -b -F /etc/hostname 2> /dev/null
 if [ $? -eq 0 ]; then
 	exit
 fi
-
+echo "127.0.0.1 `cat /etc/hostname`" >> /etc/hosts
 # Busybox hostname doesn't support -b so we need implement it on our own
 if [ -f /etc/hostname ];then
 	hostname `cat /etc/hostname`
Signature · 1 line
1.9.1
#2 lore raw
Quoted 11 lines · Dengke Du

http.test httpold.test socket.test failed when run the pTest-tcl,because the tcl script "info hostname" in /usr/lib/tcl/ptest/tests/http.test on target fail. When run the "info hostname" get the hostname,but it can find the IP in the /etc/hosts, so it failed. We need to add the IP and hostname pair in the /etc/hosts. In order to add the IP and hostname pair in the /etc/hosts, we need to add the pair when the target start, so I add the "echo "127.0.0.1 cat /etc/hostname" >> /etc/hosts" to the hostname.sh in "meta/recipes-core/initscripts/initscripts-1.0/", when the system invoke the hostname.sh in "/etc/init.d/", it add the IP and hostname pair in the /etc/hosts.

First, the shortlog should accurately reflect the change. You haven't fixed a ptest-tcl failure, you've added a missing host entry in /etc/hosts which had the side-effect of fixing a failure in tcl-ptest.

So what you've done is add a call to write "127.0.0.1 <hostname>" to
/etc/hosts on boot. On every boot. Every time that script runs a new entry will be written to /etc/hosts. If the hostname changes then hosts will contain incorrect entries. If / is read-only then this operation will fail.

Instead netbase should write the hostname entry at build time so the rootfs is correct when it is created, fixing the problem at source and ensuring it works with read-only rootfs. The problem you've now got to solve is getting the hostname from the base-files recipe, so clearly the hostname needs to be promoted to distro-level variable.

Ross