[OE-core] [PATCH 1/1] pTest-tcl fail fixed

Burton, Ross ross.burton at intel.com
Mon Mar 7 17:42:07 UTC 2016


On 1 March 2016 at 09:37, Dengke Du <dengke.du at windriver.com> wrote:

> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openembedded.org/pipermail/openembedded-core/attachments/20160307/55bd787a/attachment-0002.html>


More information about the Openembedded-core mailing list