1#! /bin/sh 2# Copyright (C) 2023 Red Hat, Inc. 3# This file is part of elfutils. 4# 5# This file is free software; you can redistribute it and/or modify 6# it under the terms of the GNU General Public License as published by 7# the Free Software Foundation; either version 3 of the License, or 8# (at your option) any later version. 9# 10# elfutils is distributed in the hope that it will be useful, but 11# WITHOUT ANY WARRANTY; without even the implied warranty of 12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13# GNU General Public License for more details. 14# 15# You should have received a copy of the GNU General Public License 16# along with this program. If not, see <http://www.gnu.org/licenses/>. 17 18. $srcdir/test-subr.sh 19 20# Test different command line combinations on the srcfiles binary itself. 21ET_EXEC="${abs_top_builddir}/src/srcfiles" 22ET_PID=$$ 23 24SRC_NAME="srcfiles.cxx" 25 26# Ensure the output contains the expected source file srcfiles.cxx 27testrun $ET_EXEC -e $ET_EXEC | grep $SRC_NAME > /dev/null 28 29for null_arg in --null ""; do 30 for verbose_arg in --verbose ""; do 31 testrun $ET_EXEC $null_arg $verbose_arg -p $ET_PID > /dev/null 32 33 # Ensure that the output contains srclines.cxx 34 cu_only=$(testrun $ET_EXEC $null_arg $verbose_arg -c -e $ET_EXEC) 35 default=$(testrun $ET_EXEC $null_arg $verbose_arg -e $ET_EXEC) 36 result1=$(echo "$cu_only" | grep "$SRC_NAME") 37 result2=$(echo "$default" | grep "$SRC_NAME") 38 39 if [ -z "$result1" ] || [ -z "$result2" ]; then 40 exit 1 41 fi 42 43 # Ensure that the output with the cu-only option contains less source files 44 if [ $(echo "$cu_only" | wc -m) -gt $(echo "$default" | wc -m) ]; then 45 exit 1 46 fi 47 done 48done 49