diff --git a/Regression/tar-testsuite/Makefile b/Regression/tar-testsuite/Makefile new file mode 100644 index 0000000..6d40a43 --- /dev/null +++ b/Regression/tar-testsuite/Makefile @@ -0,0 +1,63 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /CoreOS/tar/Regression/tar-testsuite +# Description: TAR testsuite +# Author: Branislav Blaskovic +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2012 Red Hat, Inc. All rights reserved. +# +# 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/tar/Regression/tar-testsuite +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: Branislav Blaskovic " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: TAR testsuite" >> $(METADATA) + @echo "Type: Regression" >> $(METADATA) + @echo "TestTime: 120m" >> $(METADATA) + @echo "RunFor: tar" >> $(METADATA) + @echo "Requires: tar rpm-build gcc dnf-plugins-core yum-utils" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/Regression/tar-testsuite/PURPOSE b/Regression/tar-testsuite/PURPOSE new file mode 100644 index 0000000..465b88d --- /dev/null +++ b/Regression/tar-testsuite/PURPOSE @@ -0,0 +1,3 @@ +PURPOSE of /CoreOS/tar/Regression/tar-testsuite +Description: TAR testsuite +Author: Branislav Blaskovic diff --git a/Regression/tar-testsuite/main.fmf b/Regression/tar-testsuite/main.fmf new file mode 100644 index 0000000..cb032c9 --- /dev/null +++ b/Regression/tar-testsuite/main.fmf @@ -0,0 +1,3 @@ +summary: run tar upstream testsuite +description: ssia +tier: 1 diff --git a/Regression/tar-testsuite/runtest.sh b/Regression/tar-testsuite/runtest.sh new file mode 100755 index 0000000..ca7fe5b --- /dev/null +++ b/Regression/tar-testsuite/runtest.sh @@ -0,0 +1,147 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/tar/Regression/tar-testsuite +# Description: TAR testsuite +# Author: Branislav Blaskovic +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2012, 2019 Red Hat, Inc. All rights reserved. +# +# 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 +. /usr/lib/beakerlib/beakerlib.sh + +PACKAGE="tar" +TESTUSER="tar-testsuite" + +install_build_deps() +{ + if rlIsFedora || rlIsRHEL '>7'; then + rlIsRHEL 8 && additional_repo='--enablerepo rhel-buildroot' + rlRun "dnf -y $additional_repo builddep $*" + else + # WARNING: yum-builddep doesn't work on RHEL5 as we would expect from + # modern RHEL/Fedora distributions. Only "package names" are accepted, + # not SRPMs or SPEC files. On RHEL6 this seems to work fine with SRPMs + # only. + rlRun "yum-builddep -y $*" + fi +} + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE + rlRun "useradd $TESTUSER" + rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" + rlRun "chmod -R 777 $TmpDir" + rlRun "pushd $TmpDir" + if rlIsRHEL 5; then + fix_rpm='echo %_topdir $HOME > $HOME/.rpmmacros' + rlRun "su - $TESTUSER -c '$fix_rpm'" + # on RHEL5, this isn't create automatically for some reason + rlRun "su - $TESTUSER -c 'mkdir \$HOME/BUILD'" + fi + rlPhaseEnd + + rlPhaseStartTest + + # Getting archive + rlFetchSrcForInstalled $PACKAGE + VERSION=`ls -1 *.src.rpm | head -1 | sed 's/tar-\([0-9.]*\).*src.rpm/\1/'` + RPM_NAME=`ls -1 *.src.rpm | head -1` + RPM_FULL_NAME=`readlink -f $RPM_NAME` + TOPDIR=$(su - "$TESTUSER" -c 'rpm --eval %_topdir') + SPECFILE=$TOPDIR/SPECS/tar.spec + BUILDDIR=$TOPDIR/BUILD/tar-$VERSION + + rlRun "chmod -R 777 $TmpDir" + + if [ -f "$RPM_NAME" ];then + # Extract SRPM + rlRun "su $TESTUSER -c \"rpm -i $RPM_FULL_NAME\"" + + # Print some info + rlLog "RPM name: $RPM_NAME" + rlLog "Version: $VERSION" + + # Dependencies + install_build_deps tar + + # Building + rlRun -s "su $TESTUSER -c \"rpmbuild -bc $SPECFILE\"" + rlRun "mv $rlRun_LOG $TmpDir/rpmbuild.log" + + # Using system /bin/tar for testsuite + wrapper='export PATH=/bin ; exec tar "$@"' + wrapper=`printf "%q" "$wrapper"` + rlRun "echo $wrapper > $BUILDDIR/src/tar" + + # Starting testsuite (as regular user) + rlLog "Starting testsuite!" + # we need 'make check' to build tools like 'genfile', etc. + rlRun -s "su $TESTUSER -c \"cd $BUILDDIR && make check\"" + rlRun "mv $rlRun_LOG $TmpDir/testsuite.log" + + print_stats () + { + # Grep fails from logs + while read line + do + echo "$line" | grep "[0-9]\{0,\}:.*FAILED (" && rlFail "$line" + done < $1 + + # Data from stderr + SKIPPED=`grep "[0-9]\{0,3\} tests were skipped" $1` + if [ `echo $SKIPPED | wc -l` -eq 1 ];then + rlLog "$SKIPPED" + fi + } + + print_stats "$TmpDir/testsuite.log" + + rlLog "Starting ROOT testsuite!" + # make check is not needed anymore + rlRun -s "cd $BUILDDIR/tests && ./testsuite" + rlRun "mv $rlRun_LOG $TmpDir/testsuite_root.log" + + print_stats "$TmpDir/testsuite_root.log" + + lines=`wc -l $BUILDDIR/src/tar` + rlAssertO "check that we did not remove the wrapper mistakenly" "$lines" + + else + + rlFail "No src RPM downloaded." + + fi + + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "cd $TmpDir" + rlBundleLogs "tar-testsuite-logs" "testsuite.log" "rpm-install.log" "rpmbuild.log" "yum-install.log" + rlRun "popd" + rlRun "userdel -r $TESTUSER" + rlRun "rm -rf $TmpDir" 0 "Removing tmp directory" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/Sanity/tar-using-remote-host-via-ssh/Makefile b/Sanity/tar-using-remote-host-via-ssh/Makefile new file mode 100644 index 0000000..f84e9a4 --- /dev/null +++ b/Sanity/tar-using-remote-host-via-ssh/Makefile @@ -0,0 +1,63 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /CoreOS/tar/Sanity/tar-using-remote-host-via-ssh +# Description: It would be nice to have also tested the default behaviour over ssh. +# Author: Petr Sklenar +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2013 Red Hat, Inc. All rights reserved. +# +# 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/tar/Sanity/tar-using-remote-host-via-ssh +export TESTVERSION=1.1 + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile + +.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: Petr Sklenar " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: It would be nice to have also tested the default behaviour over ssh." >> $(METADATA) + @echo "Type: Sanity" >> $(METADATA) + @echo "TestTime: 15m" >> $(METADATA) + @echo "RunFor: tar ssh" >> $(METADATA) + @echo "Requires: tar rmt ssh rsh" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/Sanity/tar-using-remote-host-via-ssh/PURPOSE b/Sanity/tar-using-remote-host-via-ssh/PURPOSE new file mode 100644 index 0000000..7dcfe50 --- /dev/null +++ b/Sanity/tar-using-remote-host-via-ssh/PURPOSE @@ -0,0 +1,3 @@ +PURPOSE of /CoreOS/tar/Sanity/tar-using-remote-host-via-ssh +Description: It would be nice to have also tested the default behaviour over ssh. +Author: Petr Sklenar diff --git a/Sanity/tar-using-remote-host-via-ssh/main.fmf b/Sanity/tar-using-remote-host-via-ssh/main.fmf new file mode 100644 index 0000000..0ba04f5 --- /dev/null +++ b/Sanity/tar-using-remote-host-via-ssh/main.fmf @@ -0,0 +1,3 @@ +summary: tar over ssh +description: ssia +tier: 1 diff --git a/Sanity/tar-using-remote-host-via-ssh/runtest.sh b/Sanity/tar-using-remote-host-via-ssh/runtest.sh new file mode 100755 index 0000000..6e2b53b --- /dev/null +++ b/Sanity/tar-using-remote-host-via-ssh/runtest.sh @@ -0,0 +1,100 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/tar/Sanity/tar-using-remote-host-via-ssh +# Description: It would be nice to have also tested the default behaviour over ssh. +# Author: Petr Sklenar +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2013 Red Hat, Inc. All rights reserved. +# +# 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="tar" + +rlJournalStart + +if rlIsRHEL 5 6; then + sshpath=`which ssh` + echo "DEBUG: ssh cmd $sshpath" + ssh_tar_option="--rsh-command=$sshpath" +else + # tar on Fedora and RHEL compile in /usr/bin/ssh as the default + # rsh implementation + ssh_tar_option= +fi + + rlPhaseStartSetup + rlAssertRpm $PACKAGE + rlAssertRpm rmt + rlFileBackup /etc/ssh/ssh_config \ + /root/.ssh/authorized_keys \ + /root/.ssh/config + rm -rf /tmp/mytarball.tar /tmp/tralalaa.petr + username=petr$RANDOM + conf=ssh_config + + echo 'Host localhost' >> /etc/ssh/ssh_config + echo ' UserKnownHostsFile /dev/null' >> /etc/ssh/ssh_config + echo ' StrictHostKeyChecking no' >> /etc/ssh/ssh_config + echo ' HostbasedAuthentication no' >> /etc/ssh/ssh_config + rlPhaseEnd + + rlPhaseStartTest + ssh_config=/root/.ssh/config + new_ssh_key="/root/.ssh/id_rsa_$username" + rlRun "useradd $username" + rlRun "echo $username | passwd --stdin $username" + homedir=`getent passwd $username | awk -F: '{print $6}'` + rlRun "ssh-keygen -t rsa -N '' -f '$new_ssh_key'" + mkdir /home/$username/.ssh + cat "$new_ssh_key".pub >> /home/$username/.ssh/authorized_keys + cat "$new_ssh_key".pub >> /root/.ssh/authorized_keys + chown -R "$username:$username" "/home/$username/.ssh" + chmod -R og-rwx "/home/$username/.ssh" + restorecon -R /home/$username/.ssh + echo "Host localhost" >> "$ssh_config" + echo " IdentityFile $new_ssh_key" >> "$ssh_config" + rlPhaseEnd + + rlPhaseStartTest + rlAssertNotExists /tmp/mytarball.tar + echo 'hello world' > tralalaa.petr + rlRun "tar $ssh_tar_option -c -f $username@localhost:/tmp/mytarball.tar tralalaa.petr" + rlAssertExists /tmp/mytarball.tar + rlPhaseEnd + + rlPhaseStartTest + rm -rf tralalaa.petr + rlRun "tar xvf /tmp/mytarball.tar" + rlRun "cat tralalaa.petr | grep 'hello world'" + rlPhaseEnd + + rlPhaseStartCleanup + rm -rf /tmp/mytarball.tar tralalaa.petr + userdel -r "$username" + rlLog "clean up" + rlFileRestore + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tar-testsuite/Makefile b/tar-testsuite/Makefile deleted file mode 100644 index 6d40a43..0000000 --- a/tar-testsuite/Makefile +++ /dev/null @@ -1,63 +0,0 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Makefile of /CoreOS/tar/Regression/tar-testsuite -# Description: TAR testsuite -# Author: Branislav Blaskovic -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2012 Red Hat, Inc. All rights reserved. -# -# 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/tar/Regression/tar-testsuite -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: Branislav Blaskovic " > $(METADATA) - @echo "Name: $(TEST)" >> $(METADATA) - @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) - @echo "Path: $(TEST_DIR)" >> $(METADATA) - @echo "Description: TAR testsuite" >> $(METADATA) - @echo "Type: Regression" >> $(METADATA) - @echo "TestTime: 120m" >> $(METADATA) - @echo "RunFor: tar" >> $(METADATA) - @echo "Requires: tar rpm-build gcc dnf-plugins-core yum-utils" >> $(METADATA) - @echo "Priority: Normal" >> $(METADATA) - @echo "License: GPLv2" >> $(METADATA) - @echo "Confidential: no" >> $(METADATA) - @echo "Destructive: no" >> $(METADATA) - - rhts-lint $(METADATA) diff --git a/tar-testsuite/PURPOSE b/tar-testsuite/PURPOSE deleted file mode 100644 index 465b88d..0000000 --- a/tar-testsuite/PURPOSE +++ /dev/null @@ -1,3 +0,0 @@ -PURPOSE of /CoreOS/tar/Regression/tar-testsuite -Description: TAR testsuite -Author: Branislav Blaskovic diff --git a/tar-testsuite/main.fmf b/tar-testsuite/main.fmf deleted file mode 100644 index cb032c9..0000000 --- a/tar-testsuite/main.fmf +++ /dev/null @@ -1,3 +0,0 @@ -summary: run tar upstream testsuite -description: ssia -tier: 1 diff --git a/tar-testsuite/runtest.sh b/tar-testsuite/runtest.sh deleted file mode 100755 index ca7fe5b..0000000 --- a/tar-testsuite/runtest.sh +++ /dev/null @@ -1,147 +0,0 @@ -#!/bin/bash -# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# runtest.sh of /CoreOS/tar/Regression/tar-testsuite -# Description: TAR testsuite -# Author: Branislav Blaskovic -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2012, 2019 Red Hat, Inc. All rights reserved. -# -# 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 -. /usr/lib/beakerlib/beakerlib.sh - -PACKAGE="tar" -TESTUSER="tar-testsuite" - -install_build_deps() -{ - if rlIsFedora || rlIsRHEL '>7'; then - rlIsRHEL 8 && additional_repo='--enablerepo rhel-buildroot' - rlRun "dnf -y $additional_repo builddep $*" - else - # WARNING: yum-builddep doesn't work on RHEL5 as we would expect from - # modern RHEL/Fedora distributions. Only "package names" are accepted, - # not SRPMs or SPEC files. On RHEL6 this seems to work fine with SRPMs - # only. - rlRun "yum-builddep -y $*" - fi -} - -rlJournalStart - rlPhaseStartSetup - rlAssertRpm $PACKAGE - rlRun "useradd $TESTUSER" - rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" - rlRun "chmod -R 777 $TmpDir" - rlRun "pushd $TmpDir" - if rlIsRHEL 5; then - fix_rpm='echo %_topdir $HOME > $HOME/.rpmmacros' - rlRun "su - $TESTUSER -c '$fix_rpm'" - # on RHEL5, this isn't create automatically for some reason - rlRun "su - $TESTUSER -c 'mkdir \$HOME/BUILD'" - fi - rlPhaseEnd - - rlPhaseStartTest - - # Getting archive - rlFetchSrcForInstalled $PACKAGE - VERSION=`ls -1 *.src.rpm | head -1 | sed 's/tar-\([0-9.]*\).*src.rpm/\1/'` - RPM_NAME=`ls -1 *.src.rpm | head -1` - RPM_FULL_NAME=`readlink -f $RPM_NAME` - TOPDIR=$(su - "$TESTUSER" -c 'rpm --eval %_topdir') - SPECFILE=$TOPDIR/SPECS/tar.spec - BUILDDIR=$TOPDIR/BUILD/tar-$VERSION - - rlRun "chmod -R 777 $TmpDir" - - if [ -f "$RPM_NAME" ];then - # Extract SRPM - rlRun "su $TESTUSER -c \"rpm -i $RPM_FULL_NAME\"" - - # Print some info - rlLog "RPM name: $RPM_NAME" - rlLog "Version: $VERSION" - - # Dependencies - install_build_deps tar - - # Building - rlRun -s "su $TESTUSER -c \"rpmbuild -bc $SPECFILE\"" - rlRun "mv $rlRun_LOG $TmpDir/rpmbuild.log" - - # Using system /bin/tar for testsuite - wrapper='export PATH=/bin ; exec tar "$@"' - wrapper=`printf "%q" "$wrapper"` - rlRun "echo $wrapper > $BUILDDIR/src/tar" - - # Starting testsuite (as regular user) - rlLog "Starting testsuite!" - # we need 'make check' to build tools like 'genfile', etc. - rlRun -s "su $TESTUSER -c \"cd $BUILDDIR && make check\"" - rlRun "mv $rlRun_LOG $TmpDir/testsuite.log" - - print_stats () - { - # Grep fails from logs - while read line - do - echo "$line" | grep "[0-9]\{0,\}:.*FAILED (" && rlFail "$line" - done < $1 - - # Data from stderr - SKIPPED=`grep "[0-9]\{0,3\} tests were skipped" $1` - if [ `echo $SKIPPED | wc -l` -eq 1 ];then - rlLog "$SKIPPED" - fi - } - - print_stats "$TmpDir/testsuite.log" - - rlLog "Starting ROOT testsuite!" - # make check is not needed anymore - rlRun -s "cd $BUILDDIR/tests && ./testsuite" - rlRun "mv $rlRun_LOG $TmpDir/testsuite_root.log" - - print_stats "$TmpDir/testsuite_root.log" - - lines=`wc -l $BUILDDIR/src/tar` - rlAssertO "check that we did not remove the wrapper mistakenly" "$lines" - - else - - rlFail "No src RPM downloaded." - - fi - - rlPhaseEnd - - rlPhaseStartCleanup - rlRun "cd $TmpDir" - rlBundleLogs "tar-testsuite-logs" "testsuite.log" "rpm-install.log" "rpmbuild.log" "yum-install.log" - rlRun "popd" - rlRun "userdel -r $TESTUSER" - rlRun "rm -rf $TmpDir" 0 "Removing tmp directory" - rlPhaseEnd -rlJournalPrintText -rlJournalEnd diff --git a/tar-using-remote-host-via-ssh/Makefile b/tar-using-remote-host-via-ssh/Makefile deleted file mode 100644 index f84e9a4..0000000 --- a/tar-using-remote-host-via-ssh/Makefile +++ /dev/null @@ -1,63 +0,0 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Makefile of /CoreOS/tar/Sanity/tar-using-remote-host-via-ssh -# Description: It would be nice to have also tested the default behaviour over ssh. -# Author: Petr Sklenar -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2013 Red Hat, Inc. All rights reserved. -# -# 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/tar/Sanity/tar-using-remote-host-via-ssh -export TESTVERSION=1.1 - -BUILT_FILES= - -FILES=$(METADATA) runtest.sh Makefile - -.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: Petr Sklenar " > $(METADATA) - @echo "Name: $(TEST)" >> $(METADATA) - @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) - @echo "Path: $(TEST_DIR)" >> $(METADATA) - @echo "Description: It would be nice to have also tested the default behaviour over ssh." >> $(METADATA) - @echo "Type: Sanity" >> $(METADATA) - @echo "TestTime: 15m" >> $(METADATA) - @echo "RunFor: tar ssh" >> $(METADATA) - @echo "Requires: tar rmt ssh rsh" >> $(METADATA) - @echo "Priority: Normal" >> $(METADATA) - @echo "License: GPLv2" >> $(METADATA) - @echo "Confidential: no" >> $(METADATA) - @echo "Destructive: no" >> $(METADATA) - - rhts-lint $(METADATA) diff --git a/tar-using-remote-host-via-ssh/PURPOSE b/tar-using-remote-host-via-ssh/PURPOSE deleted file mode 100644 index 7dcfe50..0000000 --- a/tar-using-remote-host-via-ssh/PURPOSE +++ /dev/null @@ -1,3 +0,0 @@ -PURPOSE of /CoreOS/tar/Sanity/tar-using-remote-host-via-ssh -Description: It would be nice to have also tested the default behaviour over ssh. -Author: Petr Sklenar diff --git a/tar-using-remote-host-via-ssh/main.fmf b/tar-using-remote-host-via-ssh/main.fmf deleted file mode 100644 index 0ba04f5..0000000 --- a/tar-using-remote-host-via-ssh/main.fmf +++ /dev/null @@ -1,3 +0,0 @@ -summary: tar over ssh -description: ssia -tier: 1 diff --git a/tar-using-remote-host-via-ssh/runtest.sh b/tar-using-remote-host-via-ssh/runtest.sh deleted file mode 100755 index 6e2b53b..0000000 --- a/tar-using-remote-host-via-ssh/runtest.sh +++ /dev/null @@ -1,100 +0,0 @@ -#!/bin/bash -# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# runtest.sh of /CoreOS/tar/Sanity/tar-using-remote-host-via-ssh -# Description: It would be nice to have also tested the default behaviour over ssh. -# Author: Petr Sklenar -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2013 Red Hat, Inc. All rights reserved. -# -# 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="tar" - -rlJournalStart - -if rlIsRHEL 5 6; then - sshpath=`which ssh` - echo "DEBUG: ssh cmd $sshpath" - ssh_tar_option="--rsh-command=$sshpath" -else - # tar on Fedora and RHEL compile in /usr/bin/ssh as the default - # rsh implementation - ssh_tar_option= -fi - - rlPhaseStartSetup - rlAssertRpm $PACKAGE - rlAssertRpm rmt - rlFileBackup /etc/ssh/ssh_config \ - /root/.ssh/authorized_keys \ - /root/.ssh/config - rm -rf /tmp/mytarball.tar /tmp/tralalaa.petr - username=petr$RANDOM - conf=ssh_config - - echo 'Host localhost' >> /etc/ssh/ssh_config - echo ' UserKnownHostsFile /dev/null' >> /etc/ssh/ssh_config - echo ' StrictHostKeyChecking no' >> /etc/ssh/ssh_config - echo ' HostbasedAuthentication no' >> /etc/ssh/ssh_config - rlPhaseEnd - - rlPhaseStartTest - ssh_config=/root/.ssh/config - new_ssh_key="/root/.ssh/id_rsa_$username" - rlRun "useradd $username" - rlRun "echo $username | passwd --stdin $username" - homedir=`getent passwd $username | awk -F: '{print $6}'` - rlRun "ssh-keygen -t rsa -N '' -f '$new_ssh_key'" - mkdir /home/$username/.ssh - cat "$new_ssh_key".pub >> /home/$username/.ssh/authorized_keys - cat "$new_ssh_key".pub >> /root/.ssh/authorized_keys - chown -R "$username:$username" "/home/$username/.ssh" - chmod -R og-rwx "/home/$username/.ssh" - restorecon -R /home/$username/.ssh - echo "Host localhost" >> "$ssh_config" - echo " IdentityFile $new_ssh_key" >> "$ssh_config" - rlPhaseEnd - - rlPhaseStartTest - rlAssertNotExists /tmp/mytarball.tar - echo 'hello world' > tralalaa.petr - rlRun "tar $ssh_tar_option -c -f $username@localhost:/tmp/mytarball.tar tralalaa.petr" - rlAssertExists /tmp/mytarball.tar - rlPhaseEnd - - rlPhaseStartTest - rm -rf tralalaa.petr - rlRun "tar xvf /tmp/mytarball.tar" - rlRun "cat tralalaa.petr | grep 'hello world'" - rlPhaseEnd - - rlPhaseStartCleanup - rm -rf /tmp/mytarball.tar tralalaa.petr - userdel -r "$username" - rlLog "clean up" - rlFileRestore - rlPhaseEnd -rlJournalPrintText -rlJournalEnd