1#!/bin/sh 2# SPDX-License-Identifier: GPL-2.0-or-later 3# Copyright (c) 2020 Petr Vorel <pvorel@suse.cz> 4# Copyright (c) Köry Maincent <kory.maincent@bootlin.com> 2020 5# Copyright (c) Manoj Iyer <manjo@mail.utexas.edu> 2003 6# Copyright (c) Robbie Williamson <robbiew@us.ibm.com> 2001 7# Copyright (c) International Business Machines Corp., 2000 8 9TST_TESTFUNC="do_test" 10TST_NEEDS_CMDS="awk grep host hostname tail" 11 12 13do_test() 14{ 15 local lhost="${HOSTNAME:-$(hostname)}" 16 local addr 17 18 tst_res TINFO "test basic functionality of the host command" 19 tst_res TINFO "lhost: $lhost" 20 21 if addr=$(host $lhost); then 22 addr=$(echo "$addr" | grep address | tail -1 | awk '{print $NF}') 23 if [ -z "$addr" ]; then 24 tst_brk TFAIL "empty address" 25 fi 26 EXPECT_PASS host $addr \>/dev/null 27 else 28 tst_brk TFAIL "host $lhost on local machine failed" 29 fi 30} 31 32. tst_net.sh 33tst_run 34