RHEL 9.0.0 Alpha bootstrap

The content of this branch was automatically imported from Fedora ELN
with the following as its source:
https://src.fedoraproject.org/rpms/beakerlib#4d7d2d6fd07ed9218ccb4cd1fa9ccc64f23fd62c
This commit is contained in:
Petr Šabata 2020-10-14 22:15:07 +02:00
parent fd272bccde
commit 5154da4209
19 changed files with 1054 additions and 0 deletions

4
.gitignore vendored
View File

@ -0,0 +1,4 @@
*.tar.gz
.project
*.orig
*.rej

View File

@ -0,0 +1,36 @@
From 4c95895113d549b5b3b84fe1282fb13d9f5823a0 Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@redhat.com>
Date: Fri, 29 May 2020 17:22:35 +0200
Subject: [PATCH 1/2] journal.sh: Count CPUs optimization
---
src/journal.sh | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/src/journal.sh b/src/journal.sh
index f7f2fbd..74dc525 100644
--- a/src/journal.sh
+++ b/src/journal.sh
@@ -872,15 +872,10 @@ __INTERNAL_CreateHeader(){
local line size
# CPU info
if [ -f "/proc/cpuinfo" ]; then
- local count=0
- local type="unknown"
- local cpu_regex="^model\sname.*: (.*)$"
- while read -r line; do
- if [[ "$line" =~ $cpu_regex ]]; then
- type="${BASH_REMATCH[1]}"
- let count++
- fi
- done < "/proc/cpuinfo"
+ local cpu_regex count type
+ cpu_regex="^model\sname.*: (.*)$"
+ count=$(grep -cE "$cpu_regex" /proc/cpuinfo)
+ type="$(grep -E -m 1 "$cpu_regex" /proc/cpuinfo | sed -r "s/$cpu_regex/\1/")"
__INTERNAL_WriteToMetafile hw_cpu -- "$count x $type"
__INTERNAL_LogText " CPUs : $count x $type" 2> /dev/null
fi
--
2.25.4

1
beakerlib-tmpfiles.conf Normal file
View File

@ -0,0 +1 @@
x /var/tmp/beakerlib-*

350
beakerlib.spec Normal file
View File

@ -0,0 +1,350 @@
Name: beakerlib
Summary: A shell-level integration testing library
Version: 1.20
Release: 1%{?dist}
License: GPLv2
BuildArch: noarch
URL: https://github.com/%{name}
Autoreq: 0
Requires: nfs-utils
Requires: /bin/bash
Requires: /bin/sh
Recommends: /usr/bin/python3
Recommends: /usr/bin/perl
Requires: grep
Requires: sed
Requires: iproute
Requires: coreutils
Requires: tar
Requires: gzip
Requires: util-linux
Requires: which
Requires: dnf-utils
Requires: /usr/bin/bc
Requires: /usr/bin/time
Requires: (wget or curl)
Suggests: wget
Recommends: python3-lxml
Recommends: /usr/bin/xmllint
Conflicts: beakerlib-redhat < 1-30
BuildRequires: /usr/bin/pod2man
BuildRequires: perl-generators
BuildRequires: util-linux
Source0: https://github.com/beakerlib/beakerlib/archive/%{name}-%{version}.tar.gz
Source1: %{name}-tmpfiles.conf
Patch0: bugzilla-links.patch
Patch1: python3.patch
%prep
%autosetup -p1
%build
make build
%install
%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}-%{version}}
%{!?_tmpfilesdir: %global _tmpfilesdir %{_prefix}/lib/tmpfiles.d/}
rm -rf $RPM_BUILD_ROOT
make PKGDOCDIR=%{_pkgdocdir} DESTDIR=$RPM_BUILD_ROOT install
mkdir -p $RPM_BUILD_ROOT/%{_tmpfilesdir}
install -m 0644 %{SOURCE1} $RPM_BUILD_ROOT/%{_tmpfilesdir}/%{name}.conf
%description
The BeakerLib project means to provide a library of various helpers, which
could be used when writing operating system level integration tests.
%files
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/xslt-templates
%dir %{_pkgdocdir}
%dir %{_pkgdocdir}/examples
%dir %{_pkgdocdir}/examples/*
%{_datadir}/%{name}/dictionary.vim
%{_datadir}/%{name}/*.sh
%{_datadir}/%{name}/xslt-templates/*
%{_bindir}/%{name}-*
%{_mandir}/man1/%{name}*1*
%doc %{_pkgdocdir}/*
%config %{_tmpfilesdir}/%{name}.conf
%package vim-syntax
Summary: Files for syntax highlighting BeakerLib tests in VIM editor
Requires: vim-common
BuildRequires: vim-common
%description vim-syntax
Files for syntax highlighting BeakerLib tests in VIM editor
%files vim-syntax
%{_datadir}/vim/vimfiles/after/ftdetect/beakerlib.vim
%{_datadir}/vim/vimfiles/after/syntax/beakerlib.vim
%changelog
* Thu Sep 10 2020 Dalibor Pospisil <dapospis@redhat.com> - 1.20-1
- Rebase to the laster upstream
- improvements to libraries search
- docs update
- some optimizations
- fixed pattern for mathing port or socket in rlWaitFor*
- log colorizing on all screen* terminals
- IFS fixes
- Use /etc/os-release in rlGetDistro*() (#35)
- support for curl 7.29.0
- prefer curl over wget
- silence status of service in rlService{Start,Stop,Restore} functions (#…
- TESTPACKAGE variable to force package name (#54)
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.18-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Tue Jun 9 2020 Dalibor Pospisil <dapospis@redhat.com> - 1.18-12
- optiomized CPU info gathering
- enhanced library search
- added missing dependencies on /usr/bin/bc and /usr/bin/time
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.18-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Wed Jul 24 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.18-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Mon Jun 3 2019 Dalibor Pospisil <dapospis@redhat.com> - 1.18-6
- fixed correct python checking, bz1715479
- fix unbound variables, issues #43
- fixed path to services state store
- fixed file submit to local patch is called outside test harness
- restore shell options in rlWatchdog, bz1713291
- correctly skip test version if there's no rpm source of it, bz1712495
* Thu May 9 2019 Dalibor Pospisil <dapospis@redhat.com> - 1.18-4
- show getopt parsing error (good for debugging)
- do not use -T option to submit command
* Fri Apr 5 2019 Dalibor Pospisil <dapospis@redhat.com> - 1.18-3
- rebase to beakerlib-1.18
- support for dnf/dnf download
- support direct systemctl call
- netstat replaced by ss
- ability to run without python (no journal.xml)
- better handling of reboots
- better handling of persistent data
- final report polishing
- better compatibility with old bash
- <prefix>LibraryDir variable pointing to the library directory for all imported libraries
- fallback to curl if wget is not available
- updated documentation
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.17-20
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Thu Oct 25 2018 Dalibor Pospisil <dapospis@redhat.com> - 1.17-19
- fixed meta file generation
- follow url redirection when using curl
- fixed checking for python interpreter
- weak dependency on python3
- handling of missing python
- fixed srpm fetching
- fallback to curl if wget is not available
- changed requirements structure
* Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.17-16
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Mon Jun 25 2018 Dalibor Pospisil <dapospis@redhat.com> - 1.17-15
- migrated to python3
- weak dependency of python3-lxml - without this the journal.xml just will not be generated
* Sat Feb 24 2018 Dalibor Pospisil <dapospis@redhat.com> - 1.17-13
- rlRun -s now waits for output logs to be flushed, bz1361246 + bz1416796
* Wed Feb 14 2018 Iryna Shcherbina <ishcherb@redhat.com> - 1.17-12
- Update Python 2 dependency declarations to new packaging standards
(See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)
* Fri Feb 09 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 1.17-11
- Escape macros in %%changelog
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.17-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Sat Feb 3 2018 Dalibor Pospisil <dapospis@redhat.com> - 1.17-9
- support rxvt terminal colors
- fixed persistent data load for bash version <= 4.1.2
- moved printing of final summray to rlJournalEnd
- extended coloring capabilities
- unified footer format
* Fri Jan 26 2018 Dalibor Pospisil <dapospis@redhat.com> - 1.17-7
- phase name sanitization (remove all weird characters)
- allow debug message to to only to console (speeds execution up in debug)
- allow to reboot inside of phase and continue there
- fixed persistent data loading
* Mon Dec 18 2017 Dalibor Pospisil <dapospis@redhat.com> - 1.17-6
- added missing dependecy
* Wed Dec 13 2017 Dalibor Pospisil <dapospis@redhat.com> - 1.17-5
- result file tweaks
- fixed ifs issue
- improved performance of journaling.py
- fixed computing the length of text text journal per phase
- use internal test name and do not touch TEST variable if empty
- omit human readable meta file comments in non-debug mode
- enable nested phases by default
* Fri Oct 20 2017 Dalibor Pospisil <dapospis@redhat.com> - 1.17-4
- updated dependecies set
* Wed Oct 18 2017 Dalibor Pospisil <dapospis@redhat.com> - 1.17-2
- completely reworked getting rpms
- bstor.py rewritten in pure bash
- some doc fixes
- completely rewritten journal
- extended test suite
- support for XSL transformation of journal.xml
- provided xunit.xsl
- libraries are now searched also in /usr/share/beakerlib-libraries
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.16-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Wed May 17 2017 Dalibor Pospisil <dapospis@redhat.com> - 1.16-3
- reworked rpm download function and fallbacks, bz1448510
- added links to bugzilla
* Fri Apr 21 2017 Dalibor Pospisil <dapospis@redhat.com> - 1.16-1
- added missing dependency
- updated links to beakerlib's new home, bz1436810
- added rlAssertLesser and rlAssertLesserOrEqual, bz1423488
- added rpm-handling functions rlFetchSrcForInstalled, rlRpmDownload, and rlRpmInstall
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.15-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Thu Jan 26 2017 Dalibor Pospisil <dapospis@redhat.com> - 1.15-1
- added rlIsCentOS similar to rlIsRHEL, bz1214190
- added missing dependencies, bz1391969
- make rlRun use internal variables with more unique name, bz1285804
- fix rlRun exitcodes while using various switches, bz1303900
- rlFileRestore now better distinquish betwwen various errorneous situations, bz1370453
- rlService* won't be blocked be less(1) while systemctl redirection is in place, bz1383303
- variable <libPrefix>LibraryDir variable is created for all imported libraries, holding the path to the library source, bz1074487
- all logging messages are now printed to stderr, bz1171881
- wildcard %%doc inclusion in spec, bz1206173
- prevent unbound variables, bz1228264
- new functions rlServiceEnabled/rlServiceDisable for enabling/disabling services, bz1234804
- updated documentation for rlImport -all, bz1246061
- rlAssertNotEquals now accept empty argument, bz1303618
- rlRun now uses better filename for output log, bz1314700
- fixed cosmetic discrepancy in log output, bz1374256
- added documentation reference for bkrdoc, bz843823
- added documentation of the testwatcher feature, bz1218169
- rlServiceRestore can restore all saved services in no parameter provided, bz494318
- rlCheckMount take mount options (ro/rw) into consideration, bz1191627
- added documentation for LOG_LEVEL variable, bz581816
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.11-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Thu Oct 29 2015 Dalibor Pospisil <dapospis@redhat.com> - 1.11-1
- fixed bugs 971347, 1076471, 1262888, 1216177, 1184414, 1192535, 1224345,
1211269, 1224362, 1205330, 1175513, 1211617, 1221352
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.10-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Wed Feb 4 2015 Dalibor Pospisil <dapospis@redhat.com> - 1.10-2
- remount if mounting already mounted mount point with options,
fixes bug 1173623
* Mon Dec 1 2014 Dalibor Pospisil <dapospis@redhat.com> - 1.10-1
- dropped support for rlSEBoolean functions
- fixed bugs 554280, 1003433, 1103137, 1105299, 1124440, 1124454, 1131934,
1131963, 1136206, 1155158, 1155234, 1158464, 1159191, and 1165265
* Thu Jul 17 2014 Dalibor Pospisil <dapospis@redhat.com> - 1.9-3
- reverted conditional phases support
* Wed Jul 2 2014 Dalibor Pospisil <dapospis@redhat.com> - 1.9-2
- bunch of fixes
* Tue Jun 17 2014 Dalibor Pospisil <dapospis@redhat.com> - 1.9-1
- rebase to upstream 1.9
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.8-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Tue Aug 20 2013 Petr Muller <muller@redhat.com> - 1.8-4
- Fix docdir usage to comply with Unversioned Docdirs
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.8-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Wed Jul 17 2013 Petr Pisar <ppisar@redhat.com> - 1.8-2
- Perl 5.18 rebuild
* Mon Jun 10 2013 Petr Muller <muller@redhat.com> - 1.8-1
- Update to new upstream version 1.8
* Thu May 09 2013 Petr Muller <muller@redhat.com> - 1.7-2
- Robustify journal to accept umlaut in distro release name
- Fix internal documentation
* Tue Apr 30 2013 Petr Muller <muller@redhat.com> - 1.7-1
- rebase to upstream 1.7
* Tue Mar 05 2013 Petr Muller <muller@redhat.com> - 1.6-3
- Build ceased to figure out pod2man dep automatically: fixed
* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
* Wed Jul 25 2012 Petr Muller <muller@redhat.com> - 1.6-1
- Updated to new upstream version
* Wed Jul 18 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Wed May 02 2012 Petr Muller <pmuller@redhat.com> - 1.5-1
- update to new upstream version
* Thu Jan 12 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
* Fri Jul 01 2011 Petr Muller <pmuller@redhat.com> - 1.4-1
- update to new upstream version
* Mon Feb 07 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
* Wed May 12 2010 Petr Muller <pmuller@redhat.com> - 1.3-1
- packaging fixes: permission fixes, added dep on python2,
- added examples as documentation files
* Thu Apr 29 2010 Petr Muller <pmuller@redhat.com> - 1.2-1
- packaging fixes: docdir change, specfile tweaks
- using consistently install -p everywhere
* Thu Apr 08 2010 Petr Muller <pmuller@redhat.com> - 1.2-0
- disable the testsuite and removed a 3rd party lib from the tree
* Mon Mar 22 2010 Petr Muller <pmuller@redhat.com> - 1.1-0
- packaging fixes
* Fri Feb 12 2010 Petr Muller <pmuller@redhat.com> - 1.0-3
- fixed bad path preventing tests from running
* Fri Feb 12 2010 Petr Muller <pmuller@redhat.com> - 1.0-2
- zillion of specfile tweaks for Fedora inclusion
- staf-rhts files were removed
- added a LICENSE file
- added a better package summary
- directory structure revamped
- improved rLDejaSum
* Wed Jan 27 2010 Petr Muller <pmuller@redhat.com> - 1.0-1
- genesis of the standalone BeakerLib

19
bugzilla-links.patch Normal file
View File

@ -0,0 +1,19 @@
diff --git a/src/beakerlib.sh b/src/beakerlib.sh
index 3355fa4..ceafc44 100644
--- a/src/beakerlib.sh
+++ b/src/beakerlib.sh
@@ -274,10 +274,14 @@ https://github.com/beakerlib/beakerlib/wiki/man
=item Issues list
+https://bugzilla.redhat.com/buglist.cgi?component=beakerlib&&order=bug_status%2Cassigned_to%2Cpriority
+
https://github.com/beakerlib/beakerlib/issues
=item Reporting issues
+https://bugzilla.redhat.com/enter_bug.cgi?product=Fedora&component=beakerlib
+
https://github.com/beakerlib/beakerlib/issues/new
=back

11
build-chain Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
first_branch=$(head -n 1 supported-releases)
current_branch=$(git rev-parse --abbrev-ref HEAD)
next_branch=$(grep -A 1 $current_branch supported-releases | tail -n 1)
[[ "$next_branch" == "$current_branch" ]] && next_branch=$first_branch
git merger master && \
git push && \
fedpkg build --nowait && \
git checkout $next_branch && \
[[ "$next_branch" != "$first_branch" ]] && exec ./build-chain

View File

@ -0,0 +1,50 @@
From b5d09cecf16d5473ac60ab2a47e0acc14e676781 Mon Sep 17 00:00:00 2001
From: Jakub Heger <jheger@redhat.com>
Date: Thu, 23 May 2019 12:48:15 +0200
Subject: [PATCH 2/8] testing.sh: improve shell option handling
rlWatchdog() sets -m option but didn't restore it. Can cause troubles in
rare conditions.
---
src/testing.sh | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/testing.sh b/src/testing.sh
index eceb402..44b77ca 100644
--- a/src/testing.sh
+++ b/src/testing.sh
@@ -962,6 +962,9 @@ Returns 0 if the command ends normally, without need to be killed.
=cut
rlWatchdog() {
+ # Save current shell options
+ local shell_options=$(set +o)
+
set -m
local command=$1
local timeout=$2
@@ -980,6 +983,8 @@ rlWatchdog() {
/bin/kill -- -$pidsleep
sleep 1
rm -f __INTERNAL_FINISHED __INTERNAL_TIMEOUT
+ # Restore previous shell options
+ eval "$shell_options"
return 0
elif [ -e __INTERNAL_TIMEOUT ]; then
rlLog "Command is still running, I am killing it with $killer"
@@ -992,10 +997,12 @@ rlWatchdog() {
/bin/kill -$killer -- -$pidcmd
sleep 1
rm -f __INTERNAL_FINISHED __INTERNAL_TIMEOUT
+ eval "$shell_options"
return 1
fi
sleep 1
done
+ eval "$shell_options"
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
2.21.0

View File

@ -0,0 +1,30 @@
From 84b54cb2ea9c3744f327d617f2797efd1f6ac617 Mon Sep 17 00:00:00 2001
From: Dalibor Pospisil <dapospis@redhat.com>
Date: Wed, 22 May 2019 11:10:38 +0200
Subject: [PATCH 1/8] do not masque exit code by 'local' directive
if a variable is set with an command output within local directive,
the exit code of that command gets lost and exit code of the 'local'
is used instead which is basically always 0.
---
src/journal.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/journal.sh b/src/journal.sh
index 128f9f2..2e8d616 100644
--- a/src/journal.sh
+++ b/src/journal.sh
@@ -810,8 +810,9 @@ __INTERNAL_CreateHeader(){
__INTERNAL_LogText " Test name : ${__INTERNAL_TEST_NAME}" 2> /dev/null
local test_version="${testversion:-$TESTVERSION}"
+ local test_rpm
# get number of itesm of BASH_SOURCE-1 to get last item of the array
- local test_rpm=$(rpm -qf ${BASH_SOURCE[$((${#BASH_SOURCE[@]}-1))]} 2> /dev/null) \
+ test_rpm=$(rpm -qf ${BASH_SOURCE[$((${#BASH_SOURCE[@]}-1))]} 2> /dev/null) \
&& test_version=$(rpm --qf "%{version}-%{release}" -q $test_rpm 2> /dev/null)
[[ -n "$test_version" ]] && {
--
2.21.0

View File

@ -0,0 +1,122 @@
From 6caca72e63add35ef066cca1dbeae6857ec34b2b Mon Sep 17 00:00:00 2001
From: Dalibor Pospisil <dapospis@redhat.com>
Date: Mon, 8 Jun 2020 17:11:51 +0200
Subject: [PATCH 2/2] enahanced library search
---
src/libraries.sh | 71 ++++++++++++++++++++++++++++++++++++++----------
1 file changed, 56 insertions(+), 15 deletions(-)
diff --git a/src/libraries.sh b/src/libraries.sh
index 2ccc02e..b40b513 100644
--- a/src/libraries.sh
+++ b/src/libraries.sh
@@ -98,7 +98,7 @@ __INTERNAL_rlLibraryTraverseUpwards() {
while [ "$DIRECTORY" != "/" ]
do
DIRECTORY="$( dirname $DIRECTORY )"
- if [ -d "$DIRECTORY/$COMPONENT" ]
+ if [[ -d "$DIRECTORY/$COMPONENT" || -d "$DIRECTORY/libs/$COMPONENT/$LIBRARY" ]]
then
local CANDIDATE="$DIRECTORY/$COMPONENT/Library/$LIBRARY/lib.sh"
@@ -114,6 +114,14 @@ __INTERNAL_rlLibraryTraverseUpwards() {
LIBFILE="$CANDIDATE"
break
fi
+
+ local CANDIDATE="$DIRECTORY/libs/$COMPONENT/$LIBRARY/lib.sh"
+ if [ -f "$CANDIDATE" ]
+ then
+ LIBFILE="$CANDIDATE"
+ break
+ fi
+
fi
done
}
@@ -139,6 +147,20 @@ __INTERNAL_rlLibrarySearchInRoot(){
return
fi
+ local CANDIDATE="$BEAKERLIB_LIBRARY_PATH/$COMPONENT/$LIBRARY/lib.sh"
+ if [ -f "$CANDIDATE" ]
+ then
+ LIBFILE="$CANDIDATE"
+ return
+ fi
+
+ local CANDIDATE="$BEAKERLIB_LIBRARY_PATH/libs/$COMPONENT/$LIBRARY/lib.sh"
+ if [ -f "$CANDIDATE" ]
+ then
+ LIBFILE="$CANDIDATE"
+ return
+ fi
+
rlLogDebug "rlImport: Library not found in $BEAKERLIB_LIBRARY_PATH"
}
@@ -151,16 +173,20 @@ __INTERNAL_rlLibrarySearch() {
if [ -n "$BEAKERLIB_LIBRARY_PATH" ]
then
- rlLogDebug "rlImport: BEAKERLIB_LIBRARY_PATH is set: trying to search in it"
-
- __INTERNAL_rlLibrarySearchInRoot "$COMPONENT" "$LIBRARY" "$BEAKERLIB_LIBRARY_PATH"
- if [ -n "$LIBFILE" ]
- then
- local VERSION="$(__INTERNAL_extractLibraryVersion "$LIBFILE" "$COMPONENT/$LIBRARY")"
- VERSION=${VERSION:+", version '$VERSION'"}
- rlLogInfo "rlImport: Found '$COMPONENT/$LIBRARY'$VERSION in BEAKERLIB_LIBRARY_PATH"
- return
- fi
+ rlLogDebug "rlImport: BEAKERLIB_LIBRARY_PATH='$BEAKERLIB_LIBRARY_PATH'"
+ local paths=( ${BEAKERLIB_LIBRARY_PATH//:/ } )
+ while [[ -n "$paths" ]]; do
+ rlLogDebug "$FUNCNAME(): trying $paths component of BEAKERLIB_LIBRARY_PATH"
+ __INTERNAL_rlLibrarySearchInRoot "$COMPONENT" "$LIBRARY" "$paths"
+ if [ -n "$LIBFILE" ]
+ then
+ local VERSION="$(__INTERNAL_extractLibraryVersion "$LIBFILE" "$COMPONENT/$LIBRARY")"
+ VERSION=${VERSION:+", version '$VERSION'"}
+ rlLogInfo "rlImport: Found '$COMPONENT/$LIBRARY'$VERSION in BEAKERLIB_LIBRARY_PATH"
+ return
+ fi
+ paths=( "${paths[@]:1}" )
+ done
else
rlLogDebug "rlImport: No BEAKERLIB_LIBRARY_PATH set: trying default"
fi
@@ -213,10 +239,25 @@ The library search mechanism is based on Beaker test hierarchy system, i.e.:
/component/type/test-name/test-file
-When test-file calls rlImport with 'foo/bar' parameter, the directory path
-is traversed upwards, and a check for presence of the test /foo/Library/bar/
-will be performed. This means this function needs to be called from
-the test hierarchy, not e.g. the /tmp directory.
+When test-file calls rlImport with 'foo/bar' parameter, the libraries are searched
+in following locations:
+these are the possible path prefixes
+
+ - colon-separated paths from $BEAKERLIB_LIBRARY_PATH
+ - /mnt/tests
+ - /usr/share/beakerlib-libraries
+
+the next component of the path is one of the following:
+
+ - /foo/Library/bar
+ - /*/foo/Library/bar
+ - /libs/foo/bar
+
+the directory path is then constructed as prefix/path/lib.sh
+If the library is still not found an upwards directory traversal is used, and a
+check for presence of the library in /foo/Library/bar/ or libs/foo/bar/ is to be
+performed. This means this function needs to be called from the test hierarchy,
+not e.g. the /tmp directory.
Once library is found, it is sourced and a verifier function is called.
The verifier function is cunstructed by composing the library prefix and
--
2.25.4

View File

@ -0,0 +1,50 @@
From 57ad9345c5fb4d893de7a969c7a83826c4476a93 Mon Sep 17 00:00:00 2001
From: Dalibor Pospisil <dapospis@redhat.com>
Date: Mon, 3 Jun 2019 16:39:42 +0200
Subject: [PATCH] fix unbound variables
---
src/beakerlib.sh | 6 ++++++
src/rpms.sh | 2 +-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/beakerlib.sh b/src/beakerlib.sh
index c123e3d..de54a63 100644
--- a/src/beakerlib.sh
+++ b/src/beakerlib.sh
@@ -31,6 +31,7 @@
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+__INTERNAL_SOURCED=${__INTERNAL_SOURCED-}
echo "${__INTERNAL_SOURCED}" | grep -qF -- " ${BASH_SOURCE} " && return || __INTERNAL_SOURCED+=" ${BASH_SOURCE} "
: <<'=cut'
@@ -410,6 +411,11 @@ export __INTERNAL_PERSISTENT_TMP=/var/tmp
test -f /etc/profile.d/cobbler.sh && . /etc/profile.d/cobbler.sh
set -e
+BEAKERLIB_DIR=${BEAKERLIB_DIR-}
+TESTID=${TESTID-}
+JOBID=${JOBID-}
+RECIPEID=${RECIPEID-}
+BEAKERLIB_JOURNAL=${BEAKERLIB_JOURNAL-}
export BEAKERLIB=${BEAKERLIB:-"/usr/share/beakerlib"}
. $BEAKERLIB/storage.sh
. $BEAKERLIB/infrastructure.sh
diff --git a/src/rpms.sh b/src/rpms.sh
index 144275c..3b55473 100644
--- a/src/rpms.sh
+++ b/src/rpms.sh
@@ -533,7 +533,7 @@ rlAssertRequired(){
}
-: <<=cut
+: <<'=cut'
=pod
=head2 Getting RPMs
--
2.21.0

173
getopt-errors.patch Normal file
View File

@ -0,0 +1,173 @@
From dbaa50c025dbfc3d8574e57ddbfa8e4cbf1b89d5 Mon Sep 17 00:00:00 2001
From: Dalibor Pospisil <dapospis@redhat.com>
Date: Sun, 28 Apr 2019 21:02:59 +0200
Subject: [PATCH 2/2] do not suppress getopt error
getopt was often used with -q option
now the stderr output is processed and logged as an error message
---
src/infrastructure.sh | 12 ++++++------
src/logging.sh | 2 +-
src/storage.sh | 2 +-
src/synchronisation.sh | 8 ++++----
src/testing.sh | 6 +++---
5 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/src/infrastructure.sh b/src/infrastructure.sh
index 4c76736..1c97205 100644
--- a/src/infrastructure.sh
+++ b/src/infrastructure.sh
@@ -219,7 +219,7 @@ Returns 0 if mounting the share was successful.
rlMount() {
local OPTIONS=''
- local GETOPT=$(getopt -q -o o: -- "$@"); eval set -- "$GETOPT"
+ local GETOPT=$(getopt -o o: -- "$@" 2> >(while read -r line; do rlLogError "$FUNCNAME: $line"; done)); eval set -- "$GETOPT"
while true; do
case $1 in
--) shift; break; ;;
@@ -288,7 +288,7 @@ options, 2 otherwise.
rlCheckMount() {
local MNTOPTS=''
- local GETOPT=$(getopt -q -o o: -- "$@"); eval set -- "$GETOPT"
+ local GETOPT=$(getopt -o o: -- "$@" 2> >(while read -r line; do rlLogError "$FUNCNAME: $line"; done)); eval set -- "$GETOPT"
while true; do
case $1 in
--) shift; break; ;;
@@ -383,7 +383,7 @@ the mountpoint uses all the given options.
rlAssertMount() {
local MNTOPTS=''
- local GETOPT=$(getopt -q -o o: -- "$@"); eval set -- "$GETOPT"
+ local GETOPT=$(getopt -o o: -- "$@" 2> >(while read -r line; do rlLogError "$FUNCNAME: $line"; done)); eval set -- "$GETOPT"
while true; do
case $1 in
--) shift; break; ;;
@@ -461,7 +461,7 @@ Returns 0 if success.
=cut
rlHash() {
- local GETOPT=$(getopt -q -o a: -l decode,algorithm:,stdin -- "$@"); eval set -- "$GETOPT"
+ local GETOPT=$(getopt -o a: -l decode,algorithm:,stdin -- "$@" 2> >(while read -r line; do rlLogError "$FUNCNAME: $line"; done)); eval set -- "$GETOPT"
local decode=0 alg="$rlHashAlgorithm" stdin=0
while true; do
case $1 in
@@ -637,7 +637,7 @@ rlFileBackup() {
local IFS
# getopt will cut off first long opt when no short are defined
- OPTS=$(getopt -o "." -l "clean,namespace:,no-missing-ok,missing-ok" -- "$@")
+ OPTS=$(getopt -o "." -l "clean,namespace:,no-missing-ok,missing-ok" -- "$@" 2> >(while read -r line; do rlLogError "$FUNCNAME: $line"; done))
[ $? -ne 0 ] && return 1
eval set -- "$OPTS"
@@ -813,7 +813,7 @@ rlFileRestore() {
local IFS
# getopt will cut off first long opt when no short are defined
- OPTS=$(getopt -o "n:" -l "namespace:" -- "$@")
+ OPTS=$(getopt -o "n:" -l "namespace:" -- "$@" 2> >(while read -r line; do rlLogError "$FUNCNAME: $line"; done))
[ $? -ne 0 ] && return 1
eval set -- "$OPTS"
diff --git a/src/logging.sh b/src/logging.sh
index e49dcb4..79df02b 100644
--- a/src/logging.sh
+++ b/src/logging.sh
@@ -487,7 +487,7 @@ rlFileSubmit -s '_' /etc/passwd -> etc_passwd
=cut
rlFileSubmit() {
- GETOPT=$(getopt -q -o s: -- "$@")
+ GETOPT=$(getopt -o s: -- "$@" 2> >(while read -r line; do rlLogError "$FUNCNAME: $line"; done))
eval set -- "$GETOPT"
SEPARATOR='-'
diff --git a/src/storage.sh b/src/storage.sh
index b3f7636..a1b4ae3 100644
--- a/src/storage.sh
+++ b/src/storage.sh
@@ -46,7 +46,7 @@ __INTERNAL_STORAGE_DEFAULT_NAMESPACE="GENERIC"
__INTERNAL_ST_OPTION_PARSER='
local namespace="$__INTERNAL_STORAGE_DEFAULT_NAMESPACE"
local section="$__INTERNAL_STORAGE_DEFAULT_SECTION"
- local GETOPT=$(getopt -o : -l namespace:,section: -- "$@") || return 126
+ local GETOPT=$(getopt -o : -l namespace:,section: -- "$@" 2> >(while read -r line; do rlLogError "$FUNCNAME: $line"; done)) || return 126
eval set -- "$GETOPT"
while true; do
case $1 in
diff --git a/src/synchronisation.sh b/src/synchronisation.sh
index 3c7c275..dcff59d 100644
--- a/src/synchronisation.sh
+++ b/src/synchronisation.sh
@@ -118,7 +118,7 @@ __INTERNAL_wait_for_cmd() {
shift 1
# that is the GNU extended getopt syntax!
- local TEMP=$(getopt -o t:p:m:d:r: -n '$routine_name' -- "$@")
+ local TEMP=$(getopt -o t:p:m:d:r: -n '$routine_name' -- "$@" 2> >(while read -r line; do rlLogError "$FUNCNAME: $line"; done))
if [[ $? != 0 ]] ; then
rlLogError "$routine_name: Can't parse command options, terminating..."
return 127
@@ -345,7 +345,7 @@ rlWaitForFile() {
local file=""
# that is the GNU extended getopt syntax!
- local TEMP=$(getopt -o t:p:d: -n 'rlWaitForFile' -- "$@")
+ local TEMP=$(getopt -o t:p:d: -n 'rlWaitForFile' -- "$@" 2> >(while read -r line; do rlLogError "$FUNCNAME: $line"; done))
if [[ $? != 0 ]] ; then
rlLogError "rlWaitForSocket: Can't parse command options, terminating..."
return 127
@@ -436,7 +436,7 @@ rlWaitForSocket(){
local field="5"
# that is the GNU extended getopt syntax!
- local TEMP=$(getopt -o t:p:d: --longoptions close,remote -n 'rlWaitForSocket' -- "$@")
+ local TEMP=$(getopt -o t:p:d: --longoptions close,remote -n 'rlWaitForSocket' -- "$@" 2> >(while read -r line; do rlLogError "$FUNCNAME: $line"; done))
if [[ $? != 0 ]] ; then
rlLogError "rlWaitForSocket: Can't parse command options, terminating..."
return 127
@@ -530,7 +530,7 @@ Signal used to kill the process, optional SIGTERM by default.
rlWait() {
# that is the GNU extended getopt syntax!
- local TEMP=$(getopt -o t:s: -n 'rlWait' -- "$@")
+ local TEMP=$(getopt -o t:s: -n 'rlWait' -- "$@" 2> >(while read -r line; do rlLogError "$FUNCNAME: $line"; done))
if [[ $? != 0 ]]; then
rlLogError "rlWait: Can't parse command options, terminating..."
return 128
diff --git a/src/testing.sh b/src/testing.sh
index e97bd01..eceb402 100644
--- a/src/testing.sh
+++ b/src/testing.sh
@@ -717,7 +717,7 @@ explain what are you doing here).
Returns the exit code of the command run. Asserts PASS when
command\'s exit status is in the list of expected exit codes.
-Note:
+Note:
=over
@@ -754,7 +754,7 @@ B<Warning:> using C<unbuffer> tool is now disabled because of bug 547686.
#'
rlRun() {
- local __INTERNAL_rlRun_GETOPT=$(getopt -q -o lcts -- "$@")
+ local __INTERNAL_rlRun_GETOPT=$(getopt -o lcts -- "$@" 2> >(while read -r line; do rlLogError "$FUNCNAME: $line"; done))
eval set -- "$__INTERNAL_rlRun_GETOPT"
local __INTERNAL_rlRun_DO_LOG=false
@@ -1194,7 +1194,7 @@ __INTERNAL_rlIsDistro(){
local whole="$(beakerlib-lsb_release -rs)"
local major="$(beakerlib-lsb_release -rs | cut -d '.' -f 1)"
local IFS
-
+
rlLogDebug "distro='$distro'"
rlLogDebug "major='$major'"
rlLogDebug "whole='$whole'"
--
2.17.2

View File

@ -0,0 +1,27 @@
From a8080d22f4d8c2c47781620078dca6d47f5439e9 Mon Sep 17 00:00:00 2001
From: Jakub Heger <jheger@redhat.com>
Date: Fri, 31 May 2019 13:11:39 +0200
Subject: [PATCH 5/8] logging.sh: fix __INTERNAL_FileSubmit argument
recently arguments were removed when calling __INTERNAL_FileSubmit
however the function used positional arguments which were now shifted
---
src/logging.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/logging.sh b/src/logging.sh
index 79df02b..22c34b8 100644
--- a/src/logging.sh
+++ b/src/logging.sh
@@ -137,7 +137,7 @@ __INTERNAL_LogText() {
}
__INTERNAL_FileSubmit() {
- local FILENAME="$4"
+ local FILENAME="$2"
local STORENAME="$__INTERNAL_PERSISTENT_TMP/BEAKERLIB_${TESTID}_STORED_$(basename $FILENAME)"
if [ -z "$TESTID" ]
then
--
2.21.0

View File

@ -0,0 +1,41 @@
From 01d3445a1798b20b4fd452c2fb7691b8dd35245c Mon Sep 17 00:00:00 2001
From: Dalibor Pospisil <dapospis@redhat.com>
Date: Sun, 28 Apr 2019 20:29:57 +0200
Subject: [PATCH 1/2] do not call submit_log command with -T option
the option -T was deprecated and the information is now gatheres via
RECIPETESTID environment variable
---
src/journal.sh | 2 +-
src/logging.sh | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/journal.sh b/src/journal.sh
index 8a91276..f556ba9 100644
--- a/src/journal.sh
+++ b/src/journal.sh
@@ -259,7 +259,7 @@ rlJournalEnd(){
if [ -n "$TESTID" ] ; then
__INTERNAL_JournalXMLCreate
- $BEAKERLIB_COMMAND_SUBMIT_LOG -T $TESTID -l $__INTERNAL_BEAKERLIB_JOURNAL \
+ $BEAKERLIB_COMMAND_SUBMIT_LOG -l $__INTERNAL_BEAKERLIB_JOURNAL \
|| rlLogError "rlJournalEnd: Submit wasn't successful"
else
[[ "$BEAKERLIB_JOURNAL" == "0" ]] || rlLog "JOURNAL XML: $__INTERNAL_BEAKERLIB_JOURNAL"
diff --git a/src/logging.sh b/src/logging.sh
index 70c4c92..e49dcb4 100644
--- a/src/logging.sh
+++ b/src/logging.sh
@@ -528,7 +528,7 @@ rlFileSubmit() {
BEAKERLIB_COMMAND_SUBMIT_LOG="$__INTERNAL_DEFAULT_SUBMIT_LOG"
fi
- $BEAKERLIB_COMMAND_SUBMIT_LOG -T "$TESTID" -l "$TMPDIR/$ALIAS"
+ $BEAKERLIB_COMMAND_SUBMIT_LOG -l "$TMPDIR/$ALIAS"
RETVAL=$?
fi
rm -rf $TMPDIR
--
2.17.2

57
python3.patch Normal file
View File

@ -0,0 +1,57 @@
diff -ur beakerlib-1.18.old/src/python/journal-compare.py beakerlib-1.18.new/src/python/journal-compare.py
--- beakerlib-1.18.old/src/python/journal-compare.py 2019-04-04 11:20:55.000000000 +0200
+++ beakerlib-1.18.new/src/python/journal-compare.py 2019-04-04 11:20:23.000000000 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# Copyright (c) 2006 Red Hat, Inc. All rights reserved. This copyrighted material
# is made available to anyone wishing to use, modify, copy, or
diff -ur beakerlib-1.18.old/src/python/journalling.py beakerlib-1.18.new/src/python/journalling.py
--- beakerlib-1.18.old/src/python/journalling.py 2019-04-04 11:20:55.000000000 +0200
+++ beakerlib-1.18.new/src/python/journalling.py 2019-04-04 11:20:27.000000000 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# Authors: Jakub Heger <jheger@redhat.com>
# Dalibor Pospisil <dapospis@redhat.com>
diff -ur beakerlib-1.18.old/src/python/rlMemAvg.py beakerlib-1.18.new/src/python/rlMemAvg.py
--- beakerlib-1.18.old/src/python/rlMemAvg.py 2019-04-04 11:20:55.000000000 +0200
+++ beakerlib-1.18.new/src/python/rlMemAvg.py 2019-04-04 11:20:30.000000000 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# Authors: Petr Muller <pmuller@redhat.com>
#
diff -ur beakerlib-1.18.old/src/python/rlMemPeak.py beakerlib-1.18.new/src/python/rlMemPeak.py
--- beakerlib-1.18.old/src/python/rlMemPeak.py 2019-04-04 11:20:55.000000000 +0200
+++ beakerlib-1.18.new/src/python/rlMemPeak.py 2019-04-04 11:20:33.000000000 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# Authors: Petr Muller <pmuller@redhat.com>
#
diff -ur beakerlib-1.18.old/src/python/testwatcher.py beakerlib-1.18.new/src/python/testwatcher.py
--- beakerlib-1.18.old/src/python/testwatcher.py 2019-04-04 11:20:55.000000000 +0200
+++ beakerlib-1.18.new/src/python/testwatcher.py 2019-04-04 11:20:36.000000000 +0200
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
#
# Authors: Jiri Jaburek <jjaburek@redhat.com>
#
diff -ur beakerlib-1.18.old/src/journal.sh beakerlib-1.18.new/src/journal.sh
--- beakerlib-1.18.old/src/journal.sh
+++ beakerlib-1.18.new/src/journal.sh
@@ -299,7 +299,7 @@ rlJournalEnd(){
__INTERNAL_JournalXMLCreate() {
local res=0
[[ "$BEAKERLIB_JOURNAL" == "0" ]] || {
- if which python &> /dev/null; then
+ if which python3 &> /dev/null; then
$__INTERNAL_JOURNALIST $__INTERNAL_XSLT --metafile \
"$__INTERNAL_BEAKERLIB_METAFILE" --journal "$__INTERNAL_BEAKERLIB_JOURNAL"
res=$?

View File

@ -0,0 +1,49 @@
From 96c657ea8ddc84203f624872c18765ccd1467743 Mon Sep 17 00:00:00 2001
From: Dalibor Pospisil <dapospis@redhat.com>
Date: Mon, 3 Jun 2019 16:42:28 +0200
Subject: [PATCH 8/8] generate correct path to the services state store
---
src/infrastructure.sh | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/infrastructure.sh b/src/infrastructure.sh
index 1c97205..1294b7c 100644
--- a/src/infrastructure.sh
+++ b/src/infrastructure.sh
@@ -984,8 +984,6 @@ __INTERNAL_SYSTEMCTL() {
systemctl --no-pager "$@"
}
-__INTERNAL_SERVICES_LIST="$BEAKERLIB_DIR/services_list"
-
rlServiceStart() {
# at least one service has to be supplied
if [ $# -lt 1 ]; then
@@ -997,6 +995,7 @@ rlServiceStart() {
local failed=0
# create file to store list of services, if it doesn't already exist
+ local __INTERNAL_SERVICES_LIST="$BEAKERLIB_DIR/services_list"
touch $__INTERNAL_SERVICES_LIST
local service
@@ -1092,6 +1091,7 @@ rlServiceStop() {
local failed=0
# create file to store list of services, if it doesn't already exist
+ local __INTERNAL_SERVICES_LIST="$BEAKERLIB_DIR/services_list"
touch $__INTERNAL_SERVICES_LIST
local service
@@ -1173,6 +1173,7 @@ original state; thus zero is returned when everything is OK.
rlServiceRestore() {
# create file to store list of services, if it doesn't already exist
+ local __INTERNAL_SERVICES_LIST="$BEAKERLIB_DIR/services_list"
touch $__INTERNAL_SERVICES_LIST
if [ $# -lt 1 ]; then
--
2.21.0

1
sources Normal file
View File

@ -0,0 +1 @@
SHA512 (beakerlib-1.20.tar.gz) = 0329c97aaaed25d513997c3985c3e54603f3887007494ecd41fc8aa3ec6223c131af088568bf1e073865f8e24e340d0d724578547200c70c091fad19d0d73436

6
supported-releases Normal file
View File

@ -0,0 +1,6 @@
master
f28
f27
f26
epel7
el6

16
tests/tests.yml Normal file
View File

@ -0,0 +1,16 @@
---
# Test to run in classic context
- hosts: localhost
roles:
- role: standard-test-beakerlib
tags:
- classic
repositories:
- repo: "https://src.fedoraproject.org/rpms/udica.git"
dest: "udica"
tests:
- udica/tests/sanity
required_packages:
- udica
- podman

11
update-chain Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
first_branch=$(head -n 1 supported-releases)
current_branch=$(git rev-parse --abbrev-ref HEAD)
next_branch=$(grep -A 1 $current_branch supported-releases | tail -n 1)
[[ "$next_branch" == "$current_branch" ]] && next_branch=$first_branch
git merge master && \
git push && \
fedpkg update && \
git checkout $next_branch && \
[[ "$next_branch" != "first_branch" ]] && exec ./update-chain