[LTP] [PATCH 1/1] host01.sh: Allow to overwrite the default hostname

Petr Vorel pvorel@suse.cz
Fri Dec 11 08:15:45 CET 2020


Using hostname for test requires DNS setup.
Allow to set hostname (e.g. github.com) via $HOSTNAME in case host not
set. This restores the old behavior (the legacy API version used $RHOST).

Suggested-by: Petr Cervinka <pcervinka@suse.com>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/network/tcp_cmds/host/host01.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/network/tcp_cmds/host/host01.sh b/testcases/network/tcp_cmds/host/host01.sh
index 662afe8b4..e6d8d4d06 100755
--- a/testcases/network/tcp_cmds/host/host01.sh
+++ b/testcases/network/tcp_cmds/host/host01.sh
@@ -12,7 +12,7 @@ TST_NEEDS_CMDS="awk host hostname"
 
 do_test()
 {
-	local lhost="$(hostname)"
+	local lhost="${HOSTNAME:-$(hostname)}"
 	local addr
 
 	tst_res TINFO "test basic functionality of the host command"
-- 
2.29.2



More information about the ltp mailing list