63133c7
#!/bin/bash
63133c7
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
63133c7
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
63133c7
#
63133c7
#   runtest.sh of /tools/gcc/Regression/bz1896093-Compiling-with-flto-auto-fails-if-make-is-not
63133c7
#   Description: Test for BZ#1896093 (Compiling with -flto=auto fails if make is not)
63133c7
#   Author: Alexandra Hájková <ahajkova@redhat.com>
63133c7
#
63133c7
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
63133c7
#
63133c7
#   Copyright (c) 2020 Red Hat, Inc.
63133c7
#
63133c7
#   This program is free software: you can redistribute it and/or
63133c7
#   modify it under the terms of the GNU General Public License as
63133c7
#   published by the Free Software Foundation, either version 2 of
63133c7
#   the License, or (at your option) any later version.
63133c7
#
63133c7
#   This program is distributed in the hope that it will be
63133c7
#   useful, but WITHOUT ANY WARRANTY; without even the implied
63133c7
#   warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
63133c7
#   PURPOSE.  See the GNU General Public License for more details.
63133c7
#
63133c7
#   You should have received a copy of the GNU General Public License
63133c7
#   along with this program. If not, see http://www.gnu.org/licenses/.
63133c7
#
63133c7
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
63133c7
63133c7
# Include Beaker environment
63133c7
. /usr/share/beakerlib/beakerlib.sh || exit 1
63133c7
63133c7
PACKAGE="gcc"
63133c7
63133c7
rlJournalStart
63133c7
    rlPhaseStartSetup
63133c7
        MAKE_WAS_PRESENT=false
63133c7
        rpm -q make &>/dev/null && MAKE_WAS_PRESENT=true
63133c7
        rlAssertRpm $PACKAGE
63133c7
        rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
63133c7
        rlRun "pushd $TmpDir"
63133c7
        rlRun "rpm -e --nodeps make" 0,1
63133c7
    rlPhaseEnd
63133c7
63133c7
    rlPhaseStartTest
63133c7
        echo "void main() { }" | gcc -x c -flto=auto - &> log
63133c7
        rlAssertNotGrep "lto-wrapper: fatal error: execvp: No such file or directory" log
63133c7
    rlPhaseEnd
63133c7
63133c7
    rlPhaseStartCleanup
63133c7
        if $MAKE_WAS_PRESENT; then
63133c7
            rpm -q make &>/dev/null || rlRun "yum -y install make"
63133c7
        fi
63133c7
        rlRun "popd"
63133c7
        rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
63133c7
    rlPhaseEnd
63133c7
rlJournalPrintText
63133c7
rlJournalEnd