1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0-or-later
3# Copyright (c) International Business Machines Corp., 2000
4# Author: Robbie Williamson <robbiew@us.ibm.com>
5#
6# test basic functionality of the `ldd` command.
7
8TST_CNT=2
9TST_SETUP=setup
10TST_TESTFUNC=test
11. tst_test.sh
12
13LDD=${LDD:=ldd}
14
15setup()
16{
17	export LD_LIBRARY_PATH="$TST_DATAROOT:$LD_LIBRARY_PATH"
18	LDDTESTFILE="$TST_DATAROOT/lddfile.out"
19}
20
21test1()
22{
23
24	$LDD $LDDTESTFILE | grep -q -E "lddfile1.obj.so|lddfile2.obj.so|lddfile3.obj.so|lddfile4.obj.so|lddfile5.obj.so"
25	if [ $? -eq 0 ]; then
26		tst_res TPASS "Found lddfile*.obj.so"
27	else
28		tst_res TFAIL "Haven't found lddfile*.obj.so"
29	fi
30}
31
32test2()
33{
34	$LDD -v $LDDTESTFILE | grep -q -E "GLIBC|lddfile1.obj.so|lddfile2.obj.so|lddfile3.obj.so|lddfile4.obj.so|lddfile5.obj.so"
35	if [ $? -eq 0 ]; then
36		tst_res TPASS "Found GLIBC"
37	else
38		tst_res TFAIL "Haven't found GLIBC"
39	fi
40}
41
42tst_run
43