Compare commits
No commits in common. "c8" and "c9s" have entirely different histories.
12
.gitignore
vendored
12
.gitignore
vendored
@ -1 +1,11 @@
|
||||
SOURCES/kabi-dw-eedfcbf.tar.gz
|
||||
/kabi-dw-2ef3f81.tar.gz
|
||||
/kabi-dw-e6af311.tar.gz
|
||||
/kabi-dw-a6bced6.tar.gz
|
||||
/kabi-dw-545535a.tar.gz
|
||||
/kabi-dw-b8863d0.tar.gz
|
||||
/kabi-dw-626d942.tar.gz
|
||||
/kabi-dw-6fbd644.tar.gz
|
||||
/kabi-dw-bd56a6004d5d409d7d03c386400da3f49a8c4c03.tar.gz
|
||||
/kabi-dw-9bc7003c12f15303d05e234e1fa884daeee700d4.tar.gz
|
||||
/kabi-dw-543ed656d009a4fc46a5a2b6ea60e0fd760865ec.tar.gz
|
||||
/kabi-dw-973fee0f575cc530347bac7f906e7967d4399735.tar.gz
|
||||
|
3
README.md
Normal file
3
README.md
Normal file
@ -0,0 +1,3 @@
|
||||
# kabi-dw
|
||||
|
||||
The [kabi-dw](https://github.com/skozina/kabi-dw) package is a tool to detect any changes in the ABI between the successive builds of the Linux kernel. This is done by dumping the DWARF type information (the .debug_info section) for the specific symbols into the text files and later comparing the text files.
|
@ -1,81 +0,0 @@
|
||||
%global commitdate 20230223
|
||||
%global commit eedfcbf9c60feedb532ad3d4d111ca93f7c32a26
|
||||
%global shortcommit %(c=%{commit}; echo ${c:0:7})
|
||||
|
||||
Name: kabi-dw
|
||||
Version: 0
|
||||
Release: 0.25.%{commitdate}git%{shortcommit}%{?dist}
|
||||
Summary: Detect changes in the ABI between kernel builds
|
||||
License: GPLv3+
|
||||
URL: https://github.com/skozina/%{name}
|
||||
Source0: %{name}-%{shortcommit}.tar.gz
|
||||
|
||||
BuildRequires: elfutils-devel
|
||||
BuildRequires: gcc
|
||||
BuildRequires: bison
|
||||
BuildRequires: flex
|
||||
BuildRequires: glib2-devel
|
||||
BuildRequires: redhat-rpm-config
|
||||
BuildRequires: make
|
||||
|
||||
%description
|
||||
The aim of kabi-dw is to detect any changes in the ABI between the successive
|
||||
builds of the Linux kernel. This is done by dumping the DWARF type information
|
||||
(the .debug_info section) for the specific symbols into the text files and
|
||||
later comparing the text files.
|
||||
|
||||
%prep
|
||||
%setup -q -n %{name}-%{commit}
|
||||
|
||||
%build
|
||||
#CFLAGS=$RPM_OPT_FLAGS LDFLAGS=$RPM_LD_FLAGS make debug
|
||||
%set_build_flags
|
||||
%make_build
|
||||
|
||||
%install
|
||||
install -dm 755 %{buildroot}%{_bindir}
|
||||
install -m 0755 %{name} %{buildroot}%{_bindir}/
|
||||
|
||||
%files
|
||||
%{_bindir}/%{name}
|
||||
%doc README.md
|
||||
%license COPYING
|
||||
|
||||
%changelog
|
||||
* Mon Jul 03 2023 Čestmír Kalina <ckalina@redhat.com> - 0-0.25.20230223giteedfcbf
|
||||
- Update to eedfcbf
|
||||
- Resolves: rhbz#2213162
|
||||
|
||||
* Wed Jun 10 2020 Cestmir Kalina <ckalina@redhat.com> - 0-0.10.20200515gitb52ac13
|
||||
- Upload Source0
|
||||
- Resolves RHBZ#1778928
|
||||
|
||||
* Tue Jun 09 2020 Cestmir Kalina <ckalina@redhat.com> - 0-0.9.20200515gitb52ac13
|
||||
- Update to b52ac13 to include latest upstream changes
|
||||
- Resolves RHBZ#1778928
|
||||
|
||||
* Wed Nov 21 2018 Jerome Marchand <jmarchan@redhat.com> - 0-0.8.20181112git6fbd644
|
||||
- Update to 6fbd644 to fix RHBZ 1642806
|
||||
|
||||
* Mon Mar 12 2018 Zamir SUN <zsun@fedoraproject.org> - 0-0.7.20180308gitb8863d0
|
||||
- Update to b8863d05565e91bd3fb40d9e9d562be081f09669
|
||||
- Fixes RHBZ#1543803
|
||||
|
||||
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.6.20180130git545535a
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
|
||||
|
||||
* Wed Jan 31 2018 Zamir SUN <zsun@fedoraproject.org> - 0-0.5-20180130git545535a
|
||||
- Update to upstream 545535ab2d5ea093074f5df5723901756d22f298
|
||||
- Fixes RHBZ#1538977
|
||||
|
||||
* Wed Jan 24 2018 Zamir SUN <zsun@fedoraproject.org> - 0-0.4.20171201gita6bced6
|
||||
- Update do upstream a6bced6ef7b263380ac0309bdbd4a98c6f9055eb
|
||||
|
||||
* Wed Jan 24 2018 Zamir SUN <zsun@fedoraproject.org> - 0-0.3.20171018gite6af311
|
||||
- Add libasan-devel per request
|
||||
|
||||
* Fri Oct 27 2017 Zamir SUN <zsun@fedoraproject.org> - 0-0.2.20171018gite6af311
|
||||
- Update to upstream e6af311e3182417f86742a5b1a78e488593f975a
|
||||
|
||||
* Mon Oct 16 2017 Zamir SUN <zsun@fedoraproject.org> - 0-0.1.20171012git2ef3f81
|
||||
- Initial package kabi-dw
|
35
fix-ns-on-ET_DYN.patch
Normal file
35
fix-ns-on-ET_DYN.patch
Normal file
@ -0,0 +1,35 @@
|
||||
--- kabi-dw-973fee0f575cc530347bac7f906e7967d4399735.orig/ksymtab.c 2022-01-10 16:09:27.000000000 +0100
|
||||
+++ kabi-dw-973fee0f575cc530347bac7f906e7967d4399735.new/ksymtab.c 2022-01-31 17:34:13.122000000 +0100
|
||||
@@ -155,6 +155,20 @@
|
||||
goto out;
|
||||
}
|
||||
|
||||
+ switch (ehdr->e_type) {
|
||||
+ case ET_EXEC:
|
||||
+ case ET_DYN:
|
||||
+ case ET_REL:
|
||||
+ break;
|
||||
+ default:
|
||||
+ printf("Unsupported object filetype of %s: %d\n", filename,
|
||||
+ ehdr->e_type);
|
||||
+ free(ehdr);
|
||||
+ (void) elf_end(elf);
|
||||
+ (void) close(fd);
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
/*
|
||||
* Get section index of the string table associated with the section
|
||||
* headers in the ELF file.
|
||||
@@ -427,7 +441,10 @@
|
||||
|
||||
name += strlen(STRTAB_NS_PREFIX);
|
||||
ns = (char *) ctx->ksymtab_raw;
|
||||
- ns += (ctx->e_type == ET_EXEC) ? value - ctx->sh_addr : value;
|
||||
+ if (ctx->e_type == ET_EXEC || ctx->e_type == ET_DYN)
|
||||
+ ns += value - ctx->sh_addr;
|
||||
+ else if (ctx->e_type == ET_REL)
|
||||
+ ns += value;
|
||||
|
||||
if (!strlen(ns))
|
||||
return;
|
7
gating.yaml
Normal file
7
gating.yaml
Normal file
@ -0,0 +1,7 @@
|
||||
--- !Policy
|
||||
product_versions:
|
||||
- rhel-9
|
||||
decision_context: osci_compose_gate
|
||||
rules:
|
||||
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}
|
||||
|
136
kabi-dw.spec
Normal file
136
kabi-dw.spec
Normal file
@ -0,0 +1,136 @@
|
||||
%global forgeurl https://github.com/skozina/kabi-dw
|
||||
%global commitdate 20220110
|
||||
%global commit 973fee0f575cc530347bac7f906e7967d4399735
|
||||
%global shortcommit %(c=%{commit}; echo ${c:0:7})
|
||||
|
||||
%forgemeta -i
|
||||
|
||||
Name: kabi-dw
|
||||
Version: 0
|
||||
Release: 0.24%{?dist}
|
||||
Summary: Detect changes in the ABI between kernel builds
|
||||
License: GPLv3+
|
||||
URL: %{forgeurl}
|
||||
Source0: %{forgesource}
|
||||
Patch0: fix-ns-on-ET_DYN.patch
|
||||
|
||||
BuildRequires: elfutils-devel
|
||||
BuildRequires: gcc
|
||||
BuildRequires: bison
|
||||
BuildRequires: flex
|
||||
BuildRequires: glib2-devel
|
||||
BuildRequires: redhat-rpm-config
|
||||
BuildRequires: make
|
||||
|
||||
%description
|
||||
The aim of kabi-dw is to detect any changes in the ABI between the successive
|
||||
builds of the Linux kernel. This is done by dumping the DWARF type information
|
||||
(the .debug_info section) for the specific symbols into the text files and
|
||||
later comparing the text files.
|
||||
|
||||
%prep
|
||||
%forgesetup
|
||||
%patch0 -p1
|
||||
|
||||
%build
|
||||
LDFLAGS+=" -pie "
|
||||
%ifarch x86_64
|
||||
CFLAGS+=" -fcf-protection=full "
|
||||
%endif
|
||||
CFLAGS+=" -fPIE -D_GLIBCXX_ASSERTIONS -fstack-clash-protection -g"
|
||||
%set_build_flags
|
||||
%make_build
|
||||
|
||||
%install
|
||||
install -dm 755 %{buildroot}%{_bindir}
|
||||
install -m 0755 %{name} %{buildroot}%{_bindir}/
|
||||
|
||||
%files
|
||||
%{_bindir}/%{name}
|
||||
%doc README.md
|
||||
%license COPYING
|
||||
|
||||
%changelog
|
||||
* Tue Jan 18 2022 Cestmir Kalina <ckalina@redhat.com> - 0.24
|
||||
- Fix annocheck failures
|
||||
- Fix osci tier0 test reference
|
||||
- Fix ET_DYN vmlinux namespace support
|
||||
- Resolves: rhbz#2038913
|
||||
- Resolves: rhbz#2045976
|
||||
- Resolves: rhbz#2038892
|
||||
|
||||
* Mon Jan 10 2022 Cestmir Kalina <ckalina@redhat.com> - 0.23
|
||||
- Add support for ET_EXEC
|
||||
- Add support for DW_TAG_restrict_type
|
||||
- Resolves: rhbz#1761409
|
||||
|
||||
* Mon Nov 22 2021 Cestmir Kalina <ckalina@redhat.com> - 0.22
|
||||
- Add support for symbol namespaces
|
||||
- Resolves: rhbz#1761409
|
||||
|
||||
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - Forge-specific packaging variables
|
||||
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
|
||||
Related: rhbz#1991688
|
||||
|
||||
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - Forge-specific packaging variables
|
||||
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
|
||||
|
||||
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - Packaging variables read or set by %forgemeta
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||
|
||||
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - Packaging variables read or set by %forgemeta
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
||||
|
||||
* Sun Feb 9 2020 Zamir SUN <zsun@fedoraproject.org> - 0-0.17.20191127gitbd56a60
|
||||
- Workaround "multiple definition of `yyin'"
|
||||
- Resolves https://bugzilla.redhat.com/show_bug.cgi?id=1799559
|
||||
|
||||
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - Packaging variables read or set by %forgemeta
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||
|
||||
* Wed Nov 27 2019 Zamir SUN <zsun@fedoraproject.org> - 0-0.15.20191127gitbd56a60
|
||||
- Update to bd56a60
|
||||
|
||||
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.14.20181112git6fbd644
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
||||
|
||||
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.13.20181112git6fbd644
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
||||
|
||||
* Fri Nov 16 2018 Zamir SUN <zsun@fedoraproject.org> - 0-0.12.20181112git6fbd644
|
||||
- Update to 6fbd644 to fix RHBZ 1642806
|
||||
|
||||
* Wed Sep 19 2018 Zamir SUN <zsun@fedoraproject.org> - 0-0.11.20180906git626d942
|
||||
- Fix the date in previous commit
|
||||
|
||||
* Wed Sep 19 2018 Zamir SUN <zsun@fedoraproject.org> - 0-0.10.20180906git626d942
|
||||
- Update to upstream 626d94295bc83e01ed98f4ecb76d7d499341f738
|
||||
|
||||
* Sun Jul 22 2018 Zamir SUN <zsun@fedoraproject.org> - 0-0.9.20180308gitb8863d0
|
||||
- Add gcc as BR.
|
||||
|
||||
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.8.20180308gitb8863d0
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
|
||||
|
||||
* Mon Mar 12 2018 Zamir SUN <zsun@fedoraproject.org> - 0-0.7.20180308gitb8863d0
|
||||
- Update to b8863d05565e91bd3fb40d9e9d562be081f09669
|
||||
- Fixes RHBZ#1543803
|
||||
|
||||
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.6.20180130git545535a
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
|
||||
|
||||
* Wed Jan 31 2018 Zamir SUN <zsun@fedoraproject.org> - 0-0.5-20180130git545535a
|
||||
- Update to upstream 545535ab2d5ea093074f5df5723901756d22f298
|
||||
- Fixes RHBZ#1538977
|
||||
|
||||
* Wed Jan 24 2018 Zamir SUN <zsun@fedoraproject.org> - 0-0.4.20171201gita6bced6
|
||||
- Update do upstream a6bced6ef7b263380ac0309bdbd4a98c6f9055eb
|
||||
|
||||
* Wed Jan 24 2018 Zamir SUN <zsun@fedoraproject.org> - 0-0.3.20171018gite6af311
|
||||
- Add libasan-devel per request
|
||||
|
||||
* Fri Oct 27 2017 Zamir SUN <zsun@fedoraproject.org> - 0-0.2.20171018gite6af311
|
||||
- Update to upstream e6af311e3182417f86742a5b1a78e488593f975a
|
||||
|
||||
* Mon Oct 16 2017 Zamir SUN <zsun@fedoraproject.org> - 0-0.1.20171012git2ef3f81
|
||||
- Initial package kabi-dw
|
1
sources
Normal file
1
sources
Normal file
@ -0,0 +1 @@
|
||||
SHA512 (kabi-dw-973fee0f575cc530347bac7f906e7967d4399735.tar.gz) = b62ccd892ad7c98ea9398f4f6a21a347bf064ded206843ff484a2adae8ce68428e325ae717e7fb4f50881644976c6a265d3b677cae4bdb264b88cab871bb4c37
|
93
tests/sanity/Makefile
Normal file
93
tests/sanity/Makefile
Normal file
@ -0,0 +1,93 @@
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Makefile of kabi-dw/sanity
|
||||
# Description: kabi-dw test
|
||||
#
|
||||
# 2019-04-01
|
||||
# Author: Čestmír Kalina <ckalina@redhat.com>
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#
|
||||
# Copyright (c) 2019 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.
|
||||
#
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
TENV=_env
|
||||
ifeq ($(PKG_TOP_DIR),)
|
||||
export PKG_TOP_DIR := $(shell p=$$PWD; while :; do \
|
||||
[ -e $$p/env.mk -o -z "$$p" ] && { echo $$p; break; }; p=$${p%/*}; done)
|
||||
export _TOP_DIR := $(shell p=$$PWD; while :; do \
|
||||
[ -d $$p/.git -o -z "$$p" ] && { echo $$p; break; }; p=$${p%/*}; done)
|
||||
-include $(PKG_TOP_DIR)/env.mk
|
||||
endif
|
||||
include $(TENV)
|
||||
ifeq ($(_TOP_DIR),)
|
||||
_TOP_DIR=/mnt/tests/$(TOPLEVEL_NAMESPACE)
|
||||
endif
|
||||
|
||||
export TESTVERSION=1.0
|
||||
|
||||
BUILT_FILES=
|
||||
|
||||
FILES=$(TENV) $(METADATA) Makefile common-tests.sh runtest.sh test-kabi-dw.sh testsuite.tar
|
||||
|
||||
.PHONY: all install download clean
|
||||
|
||||
run: $(FILES) build
|
||||
( set +o posix; . /usr/bin/rhts_environment.sh; \
|
||||
. /usr/share/beakerlib/beakerlib.sh; \
|
||||
. runtest.sh )
|
||||
|
||||
build: $(BUILT_FILES)
|
||||
test -x runtest.sh || chmod a+x runtest.sh
|
||||
|
||||
clean:
|
||||
rm -fr *~ $(BUILT_FILES)
|
||||
|
||||
include /usr/share/rhts/lib/rhts-make.include
|
||||
|
||||
$(METADATA): Makefile
|
||||
@echo "Owner: Čestmír Kalina <ckalina@redhat.com>" > $(METADATA)
|
||||
@echo "Name: $(TEST)" >> $(METADATA)
|
||||
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
|
||||
@echo "Path: $(TEST_DIR)" >> $(METADATA)
|
||||
@echo "Description: kabi-dw tests">> $(METADATA)
|
||||
@echo "Type: Regression" >> $(METADATA)
|
||||
@echo "TestTime: 1h" >> $(METADATA)
|
||||
@echo "RunFor: kabi-dw" >> $(METADATA)
|
||||
@echo "Requires: bash" >> $(METADATA)
|
||||
@echo "Requires: coreutils" >> $(METADATA)
|
||||
@echo "Requires: make" >> $(METADATA)
|
||||
@echo "Requires: kernel" >> $(METADATA)
|
||||
@echo "Requires: kmod" >> $(METADATA)
|
||||
@echo "Requires: grep" >> $(METADATA)
|
||||
@echo "Requires: tar" >> $(METADATA)
|
||||
@echo "Requires: findutils" >> $(METADATA)
|
||||
@echo "Requires: kernel-devel" >> $(METADATA)
|
||||
@echo "Requires: kernel-modules" >> $(METADATA)
|
||||
@echo "Requires: kernel-abi-stablelists" >> $(METADATA)
|
||||
@echo "Requires: xz" >> $(METADATA)
|
||||
@echo "Requires: bzip2" >> $(METADATA)
|
||||
@echo "Requires: gzip" >> $(METADATA)
|
||||
@echo "Requires: $(PACKAGE_NAME) rpm wget" >> $(METADATA)
|
||||
@echo "Priority: Normal" >> $(METADATA)
|
||||
@echo "License: GPLv2" >> $(METADATA)
|
||||
@echo "Confidential: no" >> $(METADATA)
|
||||
@echo "Destructive: no" >> $(METADATA)
|
||||
rhts-lint $(METADATA)
|
||||
|
||||
|
9
tests/sanity/_env
Normal file
9
tests/sanity/_env
Normal file
@ -0,0 +1,9 @@
|
||||
#This file was generated automatically,do not manually change it.
|
||||
export TOPLEVEL_NAMESPACE=kernel
|
||||
export PKG_NAMESPACE=kernel/general
|
||||
export RELATIVE_PATH=kabi-dw/sanity
|
||||
export PACKAGE=general
|
||||
export PACKAGE_NAME=general
|
||||
export PKG_LIST=
|
||||
export TEST=/kernel/general/kabi-dw/sanity
|
||||
|
148
tests/sanity/common-tests.sh
Normal file
148
tests/sanity/common-tests.sh
Normal file
@ -0,0 +1,148 @@
|
||||
if test -z "$MANUAL"
|
||||
then
|
||||
export COLOR_NC=
|
||||
export COLOR_WHITE=
|
||||
export COLOR_BLACK=
|
||||
export COLOR_BLUE=
|
||||
export COLOR_LIGHT_BLUE=
|
||||
export COLOR_GREEN=
|
||||
export COLOR_LIGHT_GREEN=
|
||||
export COLOR_CYAN=
|
||||
export COLOR_LIGHT_CYAN=
|
||||
export COLOR_RED=
|
||||
export COLOR_LIGHT_RED=
|
||||
export COLOR_PURPLE=
|
||||
export COLOR_LIGHT_PURPLE=
|
||||
export COLOR_BROWN=
|
||||
export COLOR_YELLOW=
|
||||
export COLOR_GRAY=
|
||||
export COLOR_LIGHT_GRAY=
|
||||
else
|
||||
export COLOR_NC='\e[0m'
|
||||
export COLOR_WHITE='\e[1;37m'
|
||||
export COLOR_BLACK='\e[0;30m'
|
||||
export COLOR_BLUE='\e[0;34m'
|
||||
export COLOR_LIGHT_BLUE='\e[1;34m'
|
||||
export COLOR_GREEN='\e[0;32m'
|
||||
export COLOR_LIGHT_GREEN='\e[1;32m'
|
||||
export COLOR_CYAN='\e[0;36m'
|
||||
export COLOR_LIGHT_CYAN='\e[1;36m'
|
||||
export COLOR_RED='\e[0;31m'
|
||||
export COLOR_LIGHT_RED='\e[1;31m'
|
||||
export COLOR_PURPLE='\e[0;35m'
|
||||
export COLOR_LIGHT_PURPLE='\e[1;35m'
|
||||
export COLOR_BROWN='\e[0;33m'
|
||||
export COLOR_YELLOW='\e[1;33m'
|
||||
export COLOR_GRAY='\e[0;30m'
|
||||
export COLOR_LIGHT_GRAY='\e[0;37m'
|
||||
fi
|
||||
|
||||
function pass()
|
||||
{
|
||||
if ! test -z "$MANUAL"
|
||||
then
|
||||
echo -en " $COLOR_GRAY$(printf "%0.s-" {1..35})"
|
||||
echo -en "[ ${COLOR_GREEN}PASS ]"
|
||||
echo -e "$COLOR_GRAY$(printf "%0.s-" {1..36})$COLOR_NC"
|
||||
else
|
||||
rlPass
|
||||
fi
|
||||
}
|
||||
|
||||
function fail()
|
||||
{
|
||||
if ! test -z "$MANUAL"
|
||||
then
|
||||
echo -en " $COLOR_GRAY$(printf "%0.s-" {1..35})"
|
||||
echo -en "[ ${COLOR_RED}FAIL ]"
|
||||
echo -e "$COLOR_GRAY$(printf "%0.s-" {1..36})$COLOR_NC"
|
||||
else
|
||||
rlFail
|
||||
fi
|
||||
}
|
||||
|
||||
function print_test_case()
|
||||
{
|
||||
if test -z "$MANUAL"
|
||||
then
|
||||
return 0
|
||||
fi
|
||||
echo
|
||||
local msg=" $COLOR_GRAY[${COLOR_BLUE}TEST $1$COLOR_GRAY]"
|
||||
eval msg="\$msg\$(printf "%0.s-" {1..$[80-${#msg}+${#COLOR_BLUE}+2*${#COLOR_GRAY}]})"
|
||||
echo -e "$msg$COLOR_NC"
|
||||
}
|
||||
|
||||
function print_description()
|
||||
{
|
||||
desc=()
|
||||
eval desc=\(\"\${DESCRIPTION_$1[@]}\"\)
|
||||
for desc_line in "${desc[@]}"
|
||||
do
|
||||
echo " $desc_line"
|
||||
done
|
||||
echo
|
||||
}
|
||||
|
||||
#
|
||||
# Perform a test
|
||||
#
|
||||
# $1 test function
|
||||
#
|
||||
function run_test()
|
||||
{
|
||||
rlPhaseStartTest "$1"
|
||||
|
||||
if test $# -eq 0 -o -z $1
|
||||
then
|
||||
rlFail "ERROR: Expected test name to be passed to run_test" \
|
||||
"function." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local stdout_log="$2"
|
||||
local stderr_log="$3"
|
||||
|
||||
if test -z $stdout_log -o ! -e $stdout_log
|
||||
then
|
||||
rlFail "ERROR: Test inconsistency, STDOUT log file missing or" \
|
||||
"non-existent." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z $stderr_log -o ! -e $stderr_log
|
||||
then
|
||||
rlFail "ERROR: Test inconsistency, STDERR log file missing or" \
|
||||
"non-existent." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo > $stdout_log
|
||||
echo > $stderr_log
|
||||
|
||||
print_test_case "$1"
|
||||
|
||||
$1 "$stdout_log" "$stderr_log"
|
||||
ret=$?
|
||||
|
||||
print_description "$1"
|
||||
|
||||
if test $ret -eq 0
|
||||
then
|
||||
pass
|
||||
else
|
||||
fail
|
||||
|
||||
echo "STDOUT {"
|
||||
cat $stdout_log
|
||||
echo "}"
|
||||
|
||||
echo "STDERR {"
|
||||
cat $stderr_log
|
||||
echo "}"
|
||||
|
||||
return 1
|
||||
fi
|
||||
|
||||
rlPhaseEnd
|
||||
}
|
131
tests/sanity/runtest.sh
Executable file
131
tests/sanity/runtest.sh
Executable file
@ -0,0 +1,131 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
function cleanup()
|
||||
{
|
||||
rlPhaseStartCleanup
|
||||
rm -rf "${TEMPFILES[@]}"
|
||||
rlPhaseEnd
|
||||
}
|
||||
trap cleanup 0 1 9 15
|
||||
|
||||
# --- Globals -----------------------------------------------------------------
|
||||
|
||||
SCRIPT_ROOT="$(dirname "$(realpath "${BASH_SOURCE[0]}")")"
|
||||
|
||||
# A list of temporary files; used by cleanup to delete on signals 0 1 9 15.
|
||||
TEMPFILES=()
|
||||
|
||||
# A list of dependencies to include.
|
||||
INCLUDES=()
|
||||
|
||||
# A list of files containing test definitions.
|
||||
# These are auto-discovered using test-*.sh pattern.
|
||||
TESTS_FILES=()
|
||||
|
||||
# A list of tests to run.
|
||||
# These are automatically added by test files.
|
||||
TESTS=()
|
||||
|
||||
# --- Initialization ----------------------------------------------------------
|
||||
|
||||
# Requires: restraint-rhts
|
||||
. /usr/bin/rhts-environment.sh || exit 1
|
||||
# Requires: beakerlib
|
||||
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
||||
|
||||
INCLUDES+=("$SCRIPT_ROOT/common-tests.sh")
|
||||
|
||||
TESTS_FILES+=("$SCRIPT_ROOT/test-"*".sh")
|
||||
|
||||
# --- bkr journal -------------------------------------------------------------
|
||||
|
||||
rlJournalStart
|
||||
|
||||
rlPhaseStartSetup
|
||||
|
||||
# --- Load dependencies -------------------------------------------------------
|
||||
|
||||
for path in ${INCLUDES[@]} ${TESTS_FILES[@]}
|
||||
do
|
||||
if ! test -r $path
|
||||
then
|
||||
rlFail "Path \`$path' does not exist or is not readable"
|
||||
exit 1
|
||||
fi
|
||||
source $path && {
|
||||
rlPass "File \`$(basename "$path")' loaded."
|
||||
} || {
|
||||
rlFail "Unable to load \`$path'."
|
||||
exit 1
|
||||
}
|
||||
done
|
||||
|
||||
# --- Temporary files ---------------------------------------------------------
|
||||
|
||||
echo ":: Initialization: Temporary files."
|
||||
|
||||
__stdout_log=$(mktemp -p /tmp kabidw-test-stdout.XXXXX)
|
||||
TEMPFILES+=("$__stdout_log")
|
||||
|
||||
__stderr_log=$(mktemp -p /tmp kabidw-test-stderr.XXXXX)
|
||||
TEMPFILES+=("$__stderr_log")
|
||||
|
||||
# --- Evaluate RPM-specific macros --------------------------------------------
|
||||
# This is required not to hardcode kabidw install location should %{_bindir} and
|
||||
# %{_datadir} be changed.
|
||||
|
||||
echo ":: Initialization: Evaluating RPM macros."
|
||||
|
||||
if test -z "$RPM_BIN_DIR"
|
||||
then
|
||||
RPM_BIN_DIR="$(rpm --eval '%{_bindir}')"
|
||||
echo " * RPM %{_bindir} determined as: $RPM_BIN_DIR"
|
||||
fi
|
||||
|
||||
if test -z "$RPM_DATA_DIR"
|
||||
then
|
||||
RPM_DATA_DIR="$(rpm --eval '%{_datadir}')"
|
||||
echo " * RPM %{_datadir} determined as: $RPM_DATA_DIR"
|
||||
fi
|
||||
|
||||
# --- Determine kabidw location --------------------------------------------------
|
||||
|
||||
if test -z "$KABI_DW_BIN"
|
||||
then
|
||||
KABI_DW_BIN="$RPM_BIN_DIR/kabi-dw"
|
||||
echo ":: kabidw path determined as: $KABI_DW_BIN"
|
||||
fi
|
||||
|
||||
rlPass "Initialization passed."
|
||||
|
||||
rlPhaseEnd
|
||||
|
||||
# --- Run tests ---------------------------------------------------------------
|
||||
|
||||
overall_status=0
|
||||
for test in ${TESTS[@]}
|
||||
do
|
||||
run_test $test "$__stdout_log" "$__stderr_log"
|
||||
if test $? -gt 0
|
||||
then
|
||||
overall_status=1
|
||||
fi
|
||||
done
|
||||
|
||||
rlPhaseStartTest
|
||||
|
||||
if test $overall_status -gt 0
|
||||
then
|
||||
rlFail "Some tests failed."
|
||||
exit 1
|
||||
else
|
||||
rlPass "All tests passed."
|
||||
fi
|
||||
echo
|
||||
|
||||
rlPhaseEnd
|
||||
|
||||
rlJournalPrintText
|
||||
|
||||
rlJournalEnd
|
||||
|
49
tests/sanity/test-kabi-dw.sh
Normal file
49
tests/sanity/test-kabi-dw.sh
Normal file
@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
TESTS+=(test_kabidw)
|
||||
|
||||
DESCRIPTION_test_kabidw=(
|
||||
"Invoke kabi-dw test suite."
|
||||
)
|
||||
|
||||
function test_kabidw()
|
||||
{
|
||||
local stdout_log="$1"
|
||||
local stderr_log="$2"
|
||||
shift 2
|
||||
|
||||
OLDCWD="$(pwd)"
|
||||
|
||||
tar xf testsuite.tar
|
||||
cd testsuite
|
||||
|
||||
make clean all KABI_DW="$KABI_DW_BIN" 2> $stderr_log | tee $stdout_log
|
||||
|
||||
# Strip away paths
|
||||
sed -i 's/^File:.*$//' $(find . -path "*/output/*" -type f -iname "*.txt")
|
||||
|
||||
comm -12 \
|
||||
<(find . -type d -iname "output" -exec dirname {} \; | sort | uniq) \
|
||||
<(find . -type d -iname "reference" -exec dirname {} \; | sort | uniq) \
|
||||
| xargs -I% bash -c '[[ $(grep -rh "^Version:" %/{output,reference}/ | sort | uniq | wc -l) != 1 ]] && { echo "[VERSION MISMATCH] Test Case: $(basename %)"; exit; } ; diff -qr %/{output,reference}/ || false'
|
||||
|
||||
if test $? -gt 0
|
||||
then
|
||||
echo
|
||||
echo "$? ERROR: failed with non-zero code."
|
||||
|
||||
echo "STDOUT {"
|
||||
cat $stdout_log
|
||||
echo "}"
|
||||
|
||||
echo "STDERR {"
|
||||
cat $stderr_log
|
||||
echo "}"
|
||||
|
||||
return 1
|
||||
fi
|
||||
|
||||
cd "$CWD"
|
||||
|
||||
return 0
|
||||
}
|
BIN
tests/sanity/testsuite.tar
Normal file
BIN
tests/sanity/testsuite.tar
Normal file
Binary file not shown.
18
tests/tests.yml
Normal file
18
tests/tests.yml
Normal file
@ -0,0 +1,18 @@
|
||||
- hosts: localhost
|
||||
tags:
|
||||
- classic
|
||||
roles:
|
||||
- role: standard-test-beakerlib
|
||||
tests:
|
||||
- sanity
|
||||
required_packages:
|
||||
- bash
|
||||
- coreutils
|
||||
- kernel
|
||||
- kernel-devel
|
||||
- kernel-modules
|
||||
- kernel-abi-stablelists
|
||||
- xz
|
||||
- bzip2
|
||||
- gzip
|
||||
|
Loading…
Reference in New Issue
Block a user