Add CI tests using the standard test interface

This commit is contained in:
Serhii Turivnyi 2017-12-11 12:40:44 +02:00
parent f06f790764
commit 4ba5b3addc
7 changed files with 441 additions and 0 deletions

View File

@ -0,0 +1,261 @@
posix on
:: [ 12:25:31 ] :: [ WARNING ] :: POSIX mode detected and switched off
:: [ 12:25:31 ] :: [ WARNING ] :: POSIX mode detected and switched off
:: [ 12:25:31 ] :: [ WARNING ] :: Please fix your test to have /bin/bash shebang
:: [ 12:25:31 ] :: [ WARNING ] :: Please fix your test to have /bin/bash shebang
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [ LOG ] :: Setup
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
which-2.21-4.fc27.x86_64
:: [ PASS ] :: Checking for the presence of which rpm
:: [ 12:25:31 ] :: Package versions:
:: [ 12:25:31 ] :: Package versions:
:: [ 12:25:31 ] :: which-2.21-4.fc27.x86_64
:: [ 12:25:31 ] :: which-2.21-4.fc27.x86_64
:: [ BEGIN ] :: Creating tmp directory :: actually running 'TmpDir=$(mktemp -d)'
:: [ BEGIN ] :: Creating tmp directory :: actually running 'TmpDir=$(mktemp -d)'
:: [ PASS ] :: Creating tmp directory (Expected 0, got 0)
:: [ BEGIN ] :: Running 'pushd /tmp/tmp.cVaYqMMJWL'
:: [ BEGIN ] :: Running 'pushd /tmp/tmp.cVaYqMMJWL'
/tmp/tmp.cVaYqMMJWL /usr/local/bin/basic-functionality-test
:: [ PASS ] :: Command 'pushd /tmp/tmp.cVaYqMMJWL' (Expected 0, got 0)
:: [ BEGIN ] :: Running 'cp -p /bin/true /tmp/tmp.cVaYqMMJWL'
:: [ BEGIN ] :: Running 'cp -p /bin/true /tmp/tmp.cVaYqMMJWL'
:: [ PASS ] :: Command 'cp -p /bin/true /tmp/tmp.cVaYqMMJWL' (Expected 0, got 0)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [ LOG ] :: test --version
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [ BEGIN ] :: Running 'VERSION=$( rpm -q --qf '%{VERSION}' which )'
:: [ BEGIN ] :: Running 'VERSION=$( rpm -q --qf '%{VERSION}' which )'
:: [ PASS ] :: Command 'VERSION=$( rpm -q --qf '%{VERSION}' which )' (Expected 0, got 0)
:: [ BEGIN ] :: Running 'which --version'
:: [ BEGIN ] :: Running 'which --version'
GNU which v2.21, Copyright (C) 1999 - 2015 Carlo Wood.
GNU which comes with ABSOLUTELY NO WARRANTY;
This program is free software; your freedom to use, change
and distribute this program is protected by the GPL.
:: [ PASS ] :: Command 'which --version' (Expected 0, got 0)
:: [ PASS ] :: File '/var/tmp/rlRun_LOG.0WBy8LPp' should contain 'GNU which v2.21'
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [ LOG ] :: test locating the bash binary
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [ BEGIN ] :: Running 'which bash'
:: [ BEGIN ] :: Running 'which bash'
/bin/bash
:: [ PASS ] :: Command 'which bash' (Expected 0, got 0)
:: [ PASS ] :: File '/var/tmp/rlRun_LOG.eBwKSEjp' should contain '/bin/bash'
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [ LOG ] :: test an alias
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [ BEGIN ] :: Running 'echo 'alias foo=bar' > bashrc'
:: [ BEGIN ] :: Running 'echo 'alias foo=bar' > bashrc'
:: [ PASS ] :: Command 'echo 'alias foo=bar' > bashrc' (Expected 0, got 0)
:: [ BEGIN ] :: Running 'echo -e 'alias foo=true
which foo' | bash -i'
:: [ BEGIN ] :: Running 'echo -e 'alias foo=true
which foo' | bash -i'
[root@localhost tmp.cVaYqMMJWL]# alias foo=true
[root@localhost tmp.cVaYqMMJWL]# which foo
]0;root@localhost:/tmp/tmp.cVaYqMMJWL]0;root@localhost:/tmp/tmp.cVaYqMMJWLalias foo='true'
/bin/true
[root@localhost tmp.cVaYqMMJWL]# exit
]0;root@localhost:/tmp/tmp.cVaYqMMJWL:: [ PASS ] :: Command 'echo -e 'alias foo=true\nwhich foo' | bash -i' (Expected 0, got 0)
:: [ PASS ] :: File '/var/tmp/rlRun_LOG.W7TNYyLv' should contain 'alias foo='true''
:: [ PASS ] :: File '/var/tmp/rlRun_LOG.W7TNYyLv' should contain '/bin/true'
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [ LOG ] :: test non existing command
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [ BEGIN ] :: Running 'which foobar'
:: [ BEGIN ] :: Running 'which foobar'
which: no foobar in (/sbin:/bin:/usr/sbin:/usr/bin)
:: [ PASS ] :: Command 'which foobar' (Expected 1, got 1)
:: [ PASS ] :: File '/var/tmp/rlRun_LOG.qmmfZVfo' should contain 'no foobar in (/sbin:/bin:/usr/sbin:/usr/bin)'
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [ LOG ] :: test with customized PATH
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [ BEGIN ] :: Running 'bash -c 'export PATH=/tmp/tmp.cVaYqMMJWL:/sbin:/bin:/usr/sbin:/usr/bin; which true''
:: [ BEGIN ] :: Running 'bash -c 'export PATH=/tmp/tmp.cVaYqMMJWL:/sbin:/bin:/usr/sbin:/usr/bin; which true''
/tmp/tmp.cVaYqMMJWL/true
:: [ PASS ] :: Command 'bash -c 'export PATH=/tmp/tmp.cVaYqMMJWL:/sbin:/bin:/usr/sbin:/usr/bin; which true'' (Expected 0, got 0)
:: [ PASS ] :: File '/var/tmp/rlRun_LOG.1ondAtov' should contain '/tmp/tmp.cVaYqMMJWL/true'
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [ LOG ] :: test options -a / --all
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [ BEGIN ] :: Running 'bash -c 'export PATH=/tmp/tmp.cVaYqMMJWL:/sbin:/bin:/usr/sbin:/usr/bin; which -a true''
:: [ BEGIN ] :: Running 'bash -c 'export PATH=/tmp/tmp.cVaYqMMJWL:/sbin:/bin:/usr/sbin:/usr/bin; which -a true''
/tmp/tmp.cVaYqMMJWL/true
/bin/true
/usr/bin/true
:: [ PASS ] :: Command 'bash -c 'export PATH=/tmp/tmp.cVaYqMMJWL:/sbin:/bin:/usr/sbin:/usr/bin; which -a true'' (Expected 0, got 0)
:: [ PASS ] :: File '/var/tmp/rlRun_LOG.9pOxwvyK' should contain '/tmp/tmp.cVaYqMMJWL/true'
:: [ PASS ] :: File '/var/tmp/rlRun_LOG.9pOxwvyK' should contain '/bin/true'
:: [ BEGIN ] :: Running 'bash -c 'export PATH=/tmp/tmp.cVaYqMMJWL:/sbin:/bin:/usr/sbin:/usr/bin; which --all true''
:: [ BEGIN ] :: Running 'bash -c 'export PATH=/tmp/tmp.cVaYqMMJWL:/sbin:/bin:/usr/sbin:/usr/bin; which --all true''
/tmp/tmp.cVaYqMMJWL/true
/bin/true
/usr/bin/true
:: [ PASS ] :: Command 'bash -c 'export PATH=/tmp/tmp.cVaYqMMJWL:/sbin:/bin:/usr/sbin:/usr/bin; which --all true'' (Expected 0, got 0)
:: [ PASS ] :: File '/var/tmp/rlRun_LOG.SMe8bSin' should contain '/tmp/tmp.cVaYqMMJWL/true'
:: [ PASS ] :: File '/var/tmp/rlRun_LOG.SMe8bSin' should contain '/bin/true'
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [ LOG ] :: Cleanup
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [ BEGIN ] :: Running 'popd'
:: [ BEGIN ] :: Running 'popd'
/usr/local/bin/basic-functionality-test
:: [ PASS ] :: Command 'popd' (Expected 0, got 0)
:: [ BEGIN ] :: Removing tmp directory :: actually running 'rm -r /tmp/tmp.cVaYqMMJWL'
:: [ BEGIN ] :: Removing tmp directory :: actually running 'rm -r /tmp/tmp.cVaYqMMJWL'
:: [ PASS ] :: Removing tmp directory (Expected 0, got 0)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [ LOG ] :: TEST PROTOCOL
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [ LOG ] :: Package : unknown
:: [ LOG ] :: Installed : which-2.21-4.fc27.x86_64
:: [ LOG ] :: beakerlib RPM : beakerlib-1.16-4.fc27
:: [ LOG ] :: bl-redhat RPM : not installed
:: [ LOG ] :: Test started : 2017-12-11 12:25:31 EET
:: [ LOG ] :: Test finished : 2017-12-11 12:25:34 EET
:: [ LOG ] :: Test name : basic-functionality-test
:: [ LOG ] :: Distro : Fedora release 27 (Twenty Seven)
:: [ LOG ] :: Hostname : localhost.localdomain
:: [ LOG ] :: Architecture : x86_64
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [ LOG ] :: Test description
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
PURPOSE of /CoreOS/which/Sanity/basic-functionality-test
Description: tests basic functionality
Author: Karel Srot <ksrot@redhat.com>
tests following scenarios:
* test --version
* test locating the bash binary
* test an alias
* test non existing command
* test with customized PATH
* test options -a / --all
:: [ WARNING ] :: POSIX mode detected and switched off
:: [ WARNING ] :: Please fix your test to have /bin/bash shebang
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [ LOG ] :: Setup
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [ PASS ] :: Checking for the presence of which rpm
:: [ LOG ] :: Package versions:
:: [ LOG ] :: which-2.21-4.fc27.x86_64
:: [ PASS ] :: Creating tmp directory (Expected 0, got 0)
:: [ PASS ] :: Command 'pushd /tmp/tmp.cVaYqMMJWL' (Expected 0, got 0)
:: [ PASS ] :: Command 'cp -p /bin/true /tmp/tmp.cVaYqMMJWL' (Expected 0, got 0)
:: [ LOG ] :: Duration: 1s
:: [ LOG ] :: Assertions: 4 good, 0 bad
:: [ PASS ] :: RESULT: Setup
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [ LOG ] :: test --version
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [ PASS ] :: Command 'VERSION=$( rpm -q --qf '%{VERSION}' which )' (Expected 0, got 0)
:: [ PASS ] :: Command 'which --version' (Expected 0, got 0)
:: [ PASS ] :: File '/var/tmp/rlRun_LOG.0WBy8LPp' should contain 'GNU which v2.21'
:: [ LOG ] :: Duration: 0s
:: [ LOG ] :: Assertions: 3 good, 0 bad
:: [ PASS ] :: RESULT: test --version
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [ LOG ] :: test locating the bash binary
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [ PASS ] :: Command 'which bash' (Expected 0, got 0)
:: [ PASS ] :: File '/var/tmp/rlRun_LOG.eBwKSEjp' should contain '/bin/bash'
:: [ LOG ] :: Duration: 0s
:: [ LOG ] :: Assertions: 2 good, 0 bad
:: [ PASS ] :: RESULT: test locating the bash binary
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [ LOG ] :: test an alias
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [ PASS ] :: Command 'echo 'alias foo=bar' > bashrc' (Expected 0, got 0)
:: [ PASS ] :: Command 'echo -e 'alias foo=true\nwhich foo' | bash -i' (Expected 0, got 0)
:: [ PASS ] :: File '/var/tmp/rlRun_LOG.W7TNYyLv' should contain 'alias foo='true''
:: [ PASS ] :: File '/var/tmp/rlRun_LOG.W7TNYyLv' should contain '/bin/true'
:: [ LOG ] :: Duration: 0s
:: [ LOG ] :: Assertions: 4 good, 0 bad
:: [ PASS ] :: RESULT: test an alias
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [ LOG ] :: test non existing command
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [ PASS ] :: Command 'which foobar' (Expected 1, got 1)
:: [ PASS ] :: File '/var/tmp/rlRun_LOG.qmmfZVfo' should contain 'no foobar in (/sbin:/bin:/usr/sbin:/usr/bin)'
:: [ LOG ] :: Duration: 0s
:: [ LOG ] :: Assertions: 2 good, 0 bad
:: [ PASS ] :: RESULT: test non existing command
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [ LOG ] :: test with customized PATH
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [ PASS ] :: Command 'bash -c 'export PATH=/tmp/tmp.cVaYqMMJWL:/sbin:/bin:/usr/sbin:/usr/bin; which true'' (Expected 0, got 0)
:: [ PASS ] :: File '/var/tmp/rlRun_LOG.1ondAtov' should contain '/tmp/tmp.cVaYqMMJWL/true'
:: [ LOG ] :: Duration: 0s
:: [ LOG ] :: Assertions: 2 good, 0 bad
:: [ PASS ] :: RESULT: test with customized PATH
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [ LOG ] :: test options -a / --all
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [ PASS ] :: Command 'bash -c 'export PATH=/tmp/tmp.cVaYqMMJWL:/sbin:/bin:/usr/sbin:/usr/bin; which -a true'' (Expected 0, got 0)
:: [ PASS ] :: File '/var/tmp/rlRun_LOG.9pOxwvyK' should contain '/tmp/tmp.cVaYqMMJWL/true'
:: [ PASS ] :: File '/var/tmp/rlRun_LOG.9pOxwvyK' should contain '/bin/true'
:: [ PASS ] :: Command 'bash -c 'export PATH=/tmp/tmp.cVaYqMMJWL:/sbin:/bin:/usr/sbin:/usr/bin; which --all true'' (Expected 0, got 0)
:: [ PASS ] :: File '/var/tmp/rlRun_LOG.SMe8bSin' should contain '/tmp/tmp.cVaYqMMJWL/true'
:: [ PASS ] :: File '/var/tmp/rlRun_LOG.SMe8bSin' should contain '/bin/true'
:: [ LOG ] :: Duration: 1s
:: [ LOG ] :: Assertions: 6 good, 0 bad
:: [ PASS ] :: RESULT: test options -a / --all
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [ LOG ] :: Cleanup
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [ PASS ] :: Command 'popd' (Expected 0, got 0)
:: [ PASS ] :: Removing tmp directory (Expected 0, got 0)
:: [ LOG ] :: Duration: 0s
:: [ LOG ] :: Assertions: 2 good, 0 bad
:: [ PASS ] :: RESULT: Cleanup
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [ LOG ] :: basic-functionality-test
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [ LOG ] :: Phases: 8 good, 0 bad
:: [ PASS ] :: RESULT: basic-functionality-test
:: [ 12:25:34 ] :: JOURNAL XML: /var/tmp/beakerlib-3xyUzEH/journal.xml
:: [ 12:25:34 ] :: JOURNAL XML: /var/tmp/beakerlib-3xyUzEH/journal.xml
:: [ 12:25:34 ] :: JOURNAL TXT: /var/tmp/beakerlib-3xyUzEH/journal.txt
:: [ 12:25:34 ] :: JOURNAL TXT: /var/tmp/beakerlib-3xyUzEH/journal.txt

1
tests/artifacts/test.log Normal file
View File

@ -0,0 +1 @@
PASS basic-functionality-test

View File

@ -0,0 +1,64 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/which/Sanity/basic-functionality-test
# Description: tests basic functionality
# Author: Karel Srot <ksrot@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2017 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# 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, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/CoreOS/which/Sanity/basic-functionality-test
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
test -x runtest.sh || chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Karel Srot <ksrot@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: tests basic functionality" >> $(METADATA)
@echo "Type: Sanity" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: which" >> $(METADATA)
@echo "Requires: which" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Releases: -RHEL4 -RHELClient5 -RHELServer5" >> $(METADATA)
rhts-lint $(METADATA)

View File

@ -0,0 +1,11 @@
PURPOSE of /CoreOS/which/Sanity/basic-functionality-test
Description: tests basic functionality
Author: Karel Srot <ksrot@redhat.com>
tests following scenarios:
* test --version
* test locating the bash binary
* test an alias
* test non existing command
* test with customized PATH
* test options -a / --all

View File

@ -0,0 +1,90 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/which/Sanity/basic-functionality-test
# Description: tests basic functionality
# Author: Karel Srot <ksrot@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2017 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# 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, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/bin/rhts-environment.sh || exit 1
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="which"
TRUE_BINARY=/bin/true
BASHBIN=/bin/bash
rlIsRHEL 6 && TRUE_BINARY=/bin/true
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlRun "cp -p $TRUE_BINARY $TmpDir"
rlPhaseEnd
rlPhaseStartTest "test --version"
rlRun "VERSION=\$( rpm -q --qf '%{VERSION}' which )"
rlRun -s "which --version"
rlAssertGrep "GNU which v${VERSION}" $rlRun_LOG
rlPhaseEnd
rlPhaseStartTest "test locating the bash binary"
rlRun -s "which bash"
rlAssertGrep "$BASHBIN" $rlRun_LOG
rlPhaseEnd
rlPhaseStartTest "test an alias"
rlRun "echo 'alias foo=bar' > bashrc"
rlRun -s "echo -e 'alias foo=true\nwhich foo' | bash -i"
rlAssertGrep "alias foo='true'" $rlRun_LOG
rlAssertGrep "$TRUE_BINARY" $rlRun_LOG
rlPhaseEnd
rlPhaseStartTest "test non existing command"
rlRun -s "which foobar" 1
rlAssertGrep "no foobar in ($PATH)" $rlRun_LOG
rlPhaseEnd
rlPhaseStartTest "test with customized PATH"
rlRun -s "bash -c 'export PATH=$TmpDir:$PATH; which true'"
rlAssertGrep $TmpDir/true $rlRun_LOG
rlPhaseEnd
rlPhaseStartTest "test options -a / --all"
rlRun -s "bash -c 'export PATH=$TmpDir:$PATH; which -a true'"
rlAssertGrep $TmpDir/true $rlRun_LOG
rlAssertGrep $TRUE_BINARY $rlRun_LOG
rlRun -s "bash -c 'export PATH=$TmpDir:$PATH; which --all true'"
rlAssertGrep $TmpDir/true $rlRun_LOG
rlAssertGrep $TRUE_BINARY $rlRun_LOG
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

1
tests/tests.retry Normal file
View File

@ -0,0 +1 @@
localhost

13
tests/tests.yml Normal file
View File

@ -0,0 +1,13 @@
---
# Run tests in all contexts
- hosts: localhost
tags:
- classic
- container
- atomic
roles:
- role: standard-test-beakerlib
tests:
- basic-functionality-test
required_packages:
- which