#!/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
#
#
#---------------------------------------------------------------------------
#Uncomment line below for debug output
#trace_logic=${trace_logic:-"set -x"}
$trace_logic

LDD=${LDD:=ldd}
TCID=ldd01
TST_TOTAL=1

. test.sh

do_test()
{

	export LD_LIBRARY_PATH="$LTP_DATAROOT:$LD_LIBRARY_PATH"
	LDDTESTFILE="$LTP_DATAROOT/lddfile.out"

	echo "  ASSERTION 1  "
	$LDD $LDDTESTFILE | grep -E "lddfile1.obj.so|lddfile2.obj.so|lddfile3.obj.so|lddfile4.obj.so|lddfile5.obj.so"
	if [ $? -eq 0 ]; then
		echo "ASSERTION #1 PASS"
	else
		echo "ASSERTION #1 FAIL"
		return 1
	fi

	echo " ASSERTION 2  "
	$LDD -v $LDDTESTFILE | grep -E "GLIBC|lddfile1.obj.so|lddfile2.obj.so|lddfile3.obj.so|lddfile4.obj.so|lddfile5.obj.so"
	if [ $? -eq 0 ]; then
		echo "ASSERTION #2 PASS"
	else
		echo "ASSERTION #2 FAIL"
		return 1
	fi

	echo "TEST PASSES"
	return 0
}
do_test
