#!/bin/sh
#
#   Copyright (c) International Business Machines  Corp., 2000
#
#   This program is free software;  you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; either version 2 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY;  without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
#   the GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program;  if not, write to the Free Software
#   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
#
#
#  FILE   : ldd01
#
#  PURPOSE: To test the basic functionality of the `ldd` command.
#
#  HISTORY:
#    06/01 Robbie Williamson (robbiew@us.ibm.com)
#     -Ported
#---------------------------------------------------------------------------

TST_ID=ldd01
TST_CNT=2
TST_SETUP=setup
TST_TESTFUNC=test
. tst_test.sh

LDD=${LDD:=ldd}

setup()
{
	export LD_LIBRARY_PATH="$TST_DATAROOT:$LD_LIBRARY_PATH"
	LDDTESTFILE="$TST_DATAROOT/lddfile.out"
}

test1()
{

	$LDD $LDDTESTFILE | grep -q -E "lddfile1.obj.so|lddfile2.obj.so|lddfile3.obj.so|lddfile4.obj.so|lddfile5.obj.so"
	if [ $? -eq 0 ]; then
		tst_res TPASS "Found lddfile*.obj.so"
	else
		tst_res TFAIL "Haven't found lddfile*.obj.so"
	fi
}

test2()
{
	$LDD -v $LDDTESTFILE | grep -q -E "GLIBC|lddfile1.obj.so|lddfile2.obj.so|lddfile3.obj.so|lddfile4.obj.so|lddfile5.obj.so"
	if [ $? -eq 0 ]; then
		tst_res TPASS "Found GLIBC"
	else
		tst_res TFAIL "Haven't found GLIBC"
	fi
}

tst_run
