|
|
7f89380 |
#!/bin/bash
|
|
|
7f89380 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
7f89380 |
#
|
|
|
7f89380 |
# Copyright (c) 2008 Red Hat, Inc.
|
|
|
7f89380 |
#
|
|
|
7f89380 |
# This program is free software: you can redistribute it and/or
|
|
|
7f89380 |
# modify it under the terms of the GNU General Public License as
|
|
|
7f89380 |
# published by the Free Software Foundation, either version 2 of
|
|
|
7f89380 |
# the License, or (at your option) any later version.
|
|
|
7f89380 |
#
|
|
|
7f89380 |
# This program is distributed in the hope that it will be
|
|
|
7f89380 |
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
|
|
7f89380 |
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
7f89380 |
# PURPOSE. See the GNU General Public License for more details.
|
|
|
7f89380 |
#
|
|
|
7f89380 |
# You should have received a copy of the GNU General Public License
|
|
|
7f89380 |
# along with this program. If not, see http://www.gnu.org/licenses/.
|
|
|
7f89380 |
#
|
|
|
7f89380 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
7f89380 |
# Include rhts and rhtslib environment
|
|
|
7f89380 |
. /usr/share/beakerlib/beakerlib.sh
|
|
|
7f89380 |
|
|
|
7f89380 |
PACKAGES=${PACKAGES:-bash}
|
|
|
7f89380 |
SH_BIN=${SH_BIN:-bash}
|
|
|
7f89380 |
|
|
|
7f89380 |
rlJournalStart
|
|
|
7f89380 |
rlPhaseStartSetup "Init phase"
|
|
|
7f89380 |
rlAssertRpm --all
|
|
|
7f89380 |
if [ $SH_BIN == "zsh" ]; then
|
|
|
e26ecb9 |
ZSH_OPT="-i"
|
|
|
e26ecb9 |
# Without this there might be some issue when starting background
|
|
|
e26ecb9 |
echo "unsetopt monitor" >> /etc/zshrc
|
|
|
7f89380 |
else
|
|
|
e26ecb9 |
ZSH_OPT=""
|
|
|
7f89380 |
fi
|
|
|
7f89380 |
rlPhaseEnd
|
|
|
7f89380 |
|
|
|
7f89380 |
rlPhaseStartTest "Test of functions"
|
|
|
e26ecb9 |
rlRun "${SH_BIN} -c 'true'" 0 "True action"
|
|
|
7f89380 |
rlRun "${SH_BIN} -c pwd" 0 "Checking if ${SH_BIN} do pwd command"
|
|
|
7f89380 |
rlRun "${SH_BIN} -c unexistcommand3241" 127 "Checking if ${SH_BIN} return 127 if command doesnt exist"
|
|
|
7f89380 |
rm /tmp/unexistfile &>/dev/null
|
|
|
7f89380 |
rlRun "${SH_BIN} -c 'ls /tmp/unexistfile'" 2 "Checking if ${SH_BIN} return 2 if none file"
|
|
|
7f89380 |
rlRun "${SH_BIN} -c 'echo aba| sed s/a/b/g |grep -q bbb'" 0 "Checking pipes"
|
|
|
7f89380 |
TT=`mktemp`
|
|
|
7f89380 |
TEXT=sometihngverylong
|
|
|
7f89380 |
rlRun "${SH_BIN} -c 'echo $TEXT > $TT; cat $TT |grep -q $TEXT'" 0 "Checking redirecting to file"
|
|
|
7df36a0 |
if [ $SH_BIN != "dash" ]; then
|
|
|
7df36a0 |
rlRun " ${SH_BIN} -c 'let a=1+1;echo \$a|grep -q 2'" 0 "Checking 'let' arithmetic operation 1+1"
|
|
|
7df36a0 |
fi
|
|
|
7df36a0 |
rlRun "${SH_BIN} $ZSH_OPT -c 'sleep 100 & jobs > jobs.out; WC=\$(cat jobs.out|wc -l); [ \$WC -ge 1 ]'" 0 \
|
|
|
e26ecb9 |
"Checking process at background is running"
|
|
|
7f89380 |
USER=${SH_BIN}user
|
|
|
7f89380 |
rlRun "adduser -s /bin/${SH_BIN} $USER" 0,9 "Created user with ${SH_BIN} as default shell"
|
|
|
7f89380 |
rlRun "su -l $USER -c 'echo \$PATH'" 0 "Logged as previous created user and run echo PATH"
|
|
|
7f89380 |
rlPhaseEnd
|
|
|
7f89380 |
|
|
|
7f89380 |
rlPhaseStartCleanup "Cleaning up"
|
|
|
7f89380 |
rlRun "rm $TT" 0 "Checking delete of $TT"
|
|
|
7f89380 |
sleep 10
|
|
|
7f89380 |
rlRun "userdel $USER" 0 "Deleted user with ${SH_BIN} as default shell"
|
|
|
7f89380 |
rlPhaseEnd
|
|
|
7f89380 |
rlJournalPrintText
|
|
|
7f89380 |
rlJournalEnd
|