Add a new test checking the command substitution

This commit is contained in:
Petr Šplíchal 2020-03-26 10:11:29 +01:00
commit 071ea4dbcd
2 changed files with 50 additions and 0 deletions

4
substitution/main.fmf Normal file
View file

@ -0,0 +1,4 @@
summary: Verify correct $$ parsing in command substitution
description: |
Parsing commands break when using $$ in command substitution $(..).
Test for https://bugzilla.redhat.com/show_bug.cgi?id=1727952

46
substitution/runtest.sh Executable file
View file

@ -0,0 +1,46 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Author: Karel Volný <kvolny@redhat.com>
# Copyright (c) 2019 Red Hat, Inc.
#
# 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, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGES=${PACKAGES:-bash}
rlJournalStart
rlPhaseStartSetup
rlAssertRpm --all
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlPhaseEnd
rlPhaseStartTest
rlRun "touch testfile" 0 "Creating the test file"
rlRun -s "A=\$(awk -v p=\$\$ '{print \$0}' <testfile)" 0 "Running the reproducer"
rlAssertNotGrep "Usage" $rlRun_LOG
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd