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