Compare commits

..

No commits in common. "77bc20b46500daf8cdff03e2c8ba65b78e09a936" and "28b9c3f17dbc9a476a785b08d0ca03f91f2804d4" have entirely different histories.

10 changed files with 245 additions and 144 deletions

BIN
1.18.1.tar.gz Normal file

Binary file not shown.

Binary file not shown.

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

View File

@ -1,93 +0,0 @@
From dcd5f6b38e895134bb24df4c8fa4a0fba3e0f381 Mon Sep 17 00:00:00 2001
From: yixiangzhike <yixiangzhike007@163.com>
Date: Mon, 29 May 2023 11:22:03 +0800
Subject: [PATCH] Adapt product feature to local release version
---
src/journal.sh | 6 +++++-
src/logging.sh | 10 +++++++++-
src/lsb_release | 4 ++++
src/test/loggingTest.sh | 6 +++++-
4 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/src/journal.sh b/src/journal.sh
index 62ce983..8ae06e6 100644
--- a/src/journal.sh
+++ b/src/journal.sh
@@ -874,7 +874,11 @@ __INTERNAL_CreateHeader(){
__INTERNAL_LogText " Test duration : " 2> /dev/null
# OS release
- local release=$(cat /etc/redhat-release)
+ if [ -e /etc/openEuler-release ]; then
+ local release=$(cat /etc/openEuler-release)
+ else
+ local release=$(cat /etc/redhat-release)
+ fi
[[ -n "$release" ]] && {
__INTERNAL_WriteToMetafile release -- "$release"
__INTERNAL_LogText " Distro : ${release}" 2> /dev/null
diff --git a/src/logging.sh b/src/logging.sh
index 738bef0..96455c7 100644
--- a/src/logging.sh
+++ b/src/logging.sh
@@ -881,7 +881,9 @@ on the RHEL-5-Client you will get release 5 and variant Client.
__INTERNAL_rlGetDistroVersion() {
local version=0
- if rpm -q redhat-release &>/dev/null; then
+ if rpm -q openEuler-release &>/dev/null; then
+ version=$( rpm -q --qf="%{VERSION}" openEuler-release )
+ elif rpm -q redhat-release &>/dev/null; then
version=$( rpm -q --qf="%{VERSION}" redhat-release )
elif rpm -q fedora-release &>/dev/null; then
version=$( rpm -q --qf="%{VERSION}" fedora-release )
@@ -905,6 +907,12 @@ rlGetDistroRelease() {
}
rlGetDistroVariant() {
local VARIANT
+ # openEuler has no Variant
+ if rpm -q openEuler-release &>/dev/null; then
+ echo $VARIANT
+ return 0
+ fi
+
VARIANT=$(__INTERNAL_rlGetOSReleaseItem VARIANT) && {
echo $VARIANT
return 0
diff --git a/src/lsb_release b/src/lsb_release
index 9d7afbc..8b04c75 100755
--- a/src/lsb_release
+++ b/src/lsb_release
@@ -72,7 +72,11 @@ INFO_LSB_DIR="lsb-release.d" # where to get LSB addon modules
INFO_DISTRIB_SUFFIX="release" # <distrib>-<suffix>
ALTERNATE_DISTRIB_FILE="/etc/debian_version" # for Debian [based distrib]
ALTERNATE_DISTRIB_NAME="Debian" # "
+if [ -e /etc/openEuler-release ]; then
+CHECKFIRST="/etc/openEuler-release" # check it before file search
+else
CHECKFIRST="/etc/redhat-release" # check it before file search
+fi
# Defines our exit codes
EXIT_STATUS="0" # default = Ok :)
diff --git a/src/test/loggingTest.sh b/src/test/loggingTest.sh
index a4bc588..a9de8f8 100644
--- a/src/test/loggingTest.sh
+++ b/src/test/loggingTest.sh
@@ -237,7 +237,11 @@ test_rlGetArch() {
test_rlGetDistroRelease() {
local out=$(rlGetDistroRelease)
assertTrue 'rlGetDistroRelease returns 0' "[ $? -eq 0 ]"
- if [ -e /etc/redhat-release ]
+ if [ -e /etc/openEuler-release ]
+ then
+ grep -q -i "$out" /etc/openEuler-release
+ assertTrue 'rlGetDistroRelease returns release which is in the /etc/openEuler-release' "[ $? -eq 0 ]"
+ elif [ -e /etc/redhat-release ]
then
grep -q -i "$out" /etc/redhat-release
assertTrue 'rlGetDistroRelease returns release which is in the /etc/redhat-release' "[ $? -eq 0 ]"
--
2.27.0

1
beakerlib-tmpfiles.conf Normal file
View File

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

View File

@ -1,7 +1,7 @@
Name: beakerlib
Summary: A shell-level integration testing library
Version: 1.29.3
Release: 3
Version: 1.18.1
Release: 1
License: GPLv2
BuildArch: noarch
URL: https://github.com/%{name}/%{name}
@ -23,9 +23,12 @@ Conflicts: beakerlib-redhat < 1-30
BuildRequires: /usr/bin/pod2man perl-generators util-linux
Source0: https://github.com/beakerlib/beakerlib/archive/%{version}.tar.gz
Source1: %{name}-tmpfiles.conf
Patch1: beakerlib-adapt-product-feature-to-local-release-version.patch
Patch2: perl-syntax-error.patch
Patch0: bugzilla-links.patch
Patch1: python3.patch
Patch2: Count-CPUs-optimization.patch
Patch3: enahanced-library-search.patch
%package_help
@ -41,11 +44,7 @@ make build
rm -rf $RPM_BUILD_ROOT
make PKGDOCDIR=%{_pkgdocdir} DESTDIR=$RPM_BUILD_ROOT install
mkdir -p $RPM_BUILD_ROOT/%{_tmpfilesdir}
touch ./beakerlib-tmpfiles.conf
cat >beakerlib-tmpfiles.conf<<EOF
x /var/tmp/beakerlib-*
EOF
install -m 0644 ./beakerlib-tmpfiles.conf $RPM_BUILD_ROOT/%{_tmpfilesdir}/%{name}.conf
install -m 0644 %{SOURCE1} $RPM_BUILD_ROOT/%{_tmpfilesdir}/%{name}.conf
%description
The BeakerLib project means to provide a library of various helpers, which
@ -75,23 +74,10 @@ Files for syntax highlighting BeakerLib tests in VIM editor
%files help
%{_mandir}/man1/%{name}*1*
%dir %{_pkgdocdir}
%dir %{_pkgdocdir}/examples
%dir %{_pkgdocdir}/examples/*
%doc %{_pkgdocdir}/*
%changelog
* Mon Nov 11 2024 xuguangmin <xuguangmin@kylinos.cn> - 1.29.3-3
- Fix the file "examples" being listed twice.
* Thu Nov 16 2023 zhangxianting <zhangxianting@uniontech.com> - 1.29.3-2
- fix modifying beakerlib deja summary execution
* Tue Oct 24 2023 xujing <xujing125@huawei.com> - 1.29.3-1
- update version to 1.29.3
* Mon Jun 12 2023 yixiangzhike <yixiangzhike007@163.com> - 1.18.1-3
- beakerlib adapt product feature to local release version
* Tue Jan 5 2021 Ge Wang <wangge20@huawei.com> - 1.18.1-2
- Modify Source file
* Sat Aug 1 2020 zhangxingliang <zhangxingliang3@huawei.com> - 1.18.1-1
- Package init

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

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

@ -1,27 +0,0 @@
From d4f649af8edfeceb9667b3ed8106705186989998 Mon Sep 17 00:00:00 2001
From: zhangxianting <zhangxianting@uniontech.com>
Date: Fri, 10 Nov 2023 12:29:20 +0800
Subject: [PATCH] perl syntax error
---
src/perl/deja-summarize | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/perl/deja-summarize b/src/perl/deja-summarize
index b2b105b..f7f7bf1 100755
--- a/src/perl/deja-summarize
+++ b/src/perl/deja-summarize
@@ -170,8 +170,8 @@ sub newResults {
# (fail or broken, or whatever).
sub isBad {
my ($b) = @_;
- for my $bad qw(fail brokentest kfail) {
- return 1 if ($b eq $bad);
+ for my $bad (qw(fail brokentest kfail)) {
+ return 1 if ($b eq $bad);
}
return 0;
}
--
2.27.0

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=$?