Compare commits
No commits in common. "c8" and "c10s" have entirely different histories.
3
.gitignore
vendored
3
.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
SOURCES/ksc-1.9.tar.gz
|
/ksc-5955c6b.tar.gz
|
||||||
|
/ksc-869a25c.tar.gz
|
||||||
|
@ -1 +0,0 @@
|
|||||||
27f4308a73e4cfe85dbd122fb7e81b47395371e1 SOURCES/ksc-1.9.tar.gz
|
|
93
0001-manpage.patch
Normal file
93
0001-manpage.patch
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
diff --git a/data/ksc.conf b/data/ksc.conf
|
||||||
|
index 8ee4551..c4c53fc 100644
|
||||||
|
--- a/data/ksc.conf
|
||||||
|
+++ b/data/ksc.conf
|
||||||
|
@@ -1,6 +1,12 @@
|
||||||
|
+[global]
|
||||||
|
+user=user@example.com
|
||||||
|
+partner=none
|
||||||
|
+partnergroup=none
|
||||||
|
[bugzilla]
|
||||||
|
-user=user@redhat.com
|
||||||
|
-partner=partner-name
|
||||||
|
-partnergroup=partner-group
|
||||||
|
+enable=1
|
||||||
|
server=https://bugzilla.redhat.com/xmlrpc.cgi
|
||||||
|
-api_key=api_key
|
||||||
|
+api_key=API_KEY
|
||||||
|
+[mailing_list]
|
||||||
|
+enable=0
|
||||||
|
+smtp=smtp.example.com
|
||||||
|
+to=kabi-requests@redhat.com
|
||||||
|
diff --git a/ksc.1 b/ksc.1
|
||||||
|
index 078dd83..3c3ce86 100644
|
||||||
|
--- a/ksc.1
|
||||||
|
+++ b/ksc.1
|
||||||
|
@@ -139,12 +139,18 @@ partnergroup=none
|
||||||
|
.br
|
||||||
|
[bugzilla]
|
||||||
|
.br
|
||||||
|
+enable=1
|
||||||
|
+.br
|
||||||
|
server=https://bugzilla.redhat.com/xmlrpc.cgi
|
||||||
|
.br
|
||||||
|
api_key=API_KEY
|
||||||
|
.br
|
||||||
|
[mailing_list]
|
||||||
|
.br
|
||||||
|
+enable=1
|
||||||
|
+.br
|
||||||
|
+smtp=smtp.example.com
|
||||||
|
+.br
|
||||||
|
to=kabi-requests@redhat.com
|
||||||
|
|
||||||
|
Please replace the values above by your credentials.
|
||||||
|
@@ -153,7 +159,10 @@ Mandatory fields for any submission method: user, partner, partnergroup.
|
||||||
|
.br
|
||||||
|
Mandatory fields for Bugzilla submission method: server, api_key.
|
||||||
|
.br
|
||||||
|
-Mandatory fields for mailing list submission method: to.
|
||||||
|
+Mandatory fields for mailing list submission method: to, smtp.
|
||||||
|
+
|
||||||
|
+By default, Bugzilla (mailing list) submission method is auto-enabled
|
||||||
|
+(auto-disabled) and must be opted out (in).
|
||||||
|
|
||||||
|
Note that server must be a valid XML RPC Bugzilla link, user and to fields
|
||||||
|
must be valid e-mail addresses.
|
||||||
|
diff --git a/utils.py b/utils.py
|
||||||
|
index ce1a613..8038076 100644
|
||||||
|
--- a/utils.py
|
||||||
|
+++ b/utils.py
|
||||||
|
@@ -220,6 +220,7 @@ def getconfig(path='/etc/ksc.conf', mock=False, require_partner=False, verbose=T
|
||||||
|
|
||||||
|
# To be deprecated in the future:
|
||||||
|
result['bugzilla_enable'] = True
|
||||||
|
+ result['mailing_list_enable'] = False
|
||||||
|
|
||||||
|
cat = None
|
||||||
|
for line in lines:
|
||||||
|
@@ -305,10 +306,10 @@ def getconfig(path='/etc/ksc.conf', mock=False, require_partner=False, verbose=T
|
||||||
|
raise ConfigDeprecatedValueException(path, key, result[key])
|
||||||
|
|
||||||
|
if not (result['method'] & SubmissionMethod.BUGZILLA.value):
|
||||||
|
- conf["bugzilla_enable"] = False
|
||||||
|
+ result["bugzilla_enable"] = False
|
||||||
|
|
||||||
|
if not (result['method'] & SubmissionMethod.MAILING_LIST.value):
|
||||||
|
- conf["mailing_list_enable"] = False
|
||||||
|
+ result["mailing_list_enable"] = False
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
|
@@ -365,6 +366,11 @@ def sendmail(filename, arch, mock, conf, releasename, module, subcomponent,
|
||||||
|
Email ksc report.
|
||||||
|
"""
|
||||||
|
|
||||||
|
+ for field in [ "smtp", "user", "to" ]:
|
||||||
|
+ if field not in conf:
|
||||||
|
+ print(f"Could not send an email, '{field}' config field is missing.")
|
||||||
|
+ return
|
||||||
|
+
|
||||||
|
major, centos = get_major_release(releasename)
|
||||||
|
if not major:
|
||||||
|
print("Invalid releasename: Mail not sent.")
|
57
0002-c9s-notifications.patch
Normal file
57
0002-c9s-notifications.patch
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
diff --git a/ksc.py b/ksc.py
|
||||||
|
index 4652dde..a6dc9f3 100755
|
||||||
|
--- a/ksc.py
|
||||||
|
+++ b/ksc.py
|
||||||
|
@@ -631,12 +631,16 @@ class Ksc(object):
|
||||||
|
|
||||||
|
# Ignore undefined options in parser instead of throwing error
|
||||||
|
class IOptParse(OptionParser):
|
||||||
|
- def error(self, msg):
|
||||||
|
- pass
|
||||||
|
+ def _process_args(self, largs, rargs, values):
|
||||||
|
+ while rargs:
|
||||||
|
+ try:
|
||||||
|
+ OptionParser._process_args(self,largs,rargs,values)
|
||||||
|
+ except:
|
||||||
|
+ pass
|
||||||
|
|
||||||
|
parser = IOptParse()
|
||||||
|
- parser.add_option("-k", "--ko")
|
||||||
|
- opts, _ = parser.parse_args(commands[0:])
|
||||||
|
+ parser.add_option("-k", "--ko", action="append", dest="ko")
|
||||||
|
+ opts, _ = parser.parse_args(commands)
|
||||||
|
return opts.ko
|
||||||
|
except Exception:
|
||||||
|
return None
|
||||||
|
diff --git a/utils.py b/utils.py
|
||||||
|
index 8038076..b75e770 100644
|
||||||
|
--- a/utils.py
|
||||||
|
+++ b/utils.py
|
||||||
|
@@ -377,8 +377,12 @@ def sendmail(filename, arch, mock, conf, releasename, module, subcomponent,
|
||||||
|
return
|
||||||
|
|
||||||
|
body = f"Product: Red Hat Enterprise Linux {major}\n"
|
||||||
|
- body += f"Release: Centos Stream\n"
|
||||||
|
- body += f"Platform: {arch}\n"
|
||||||
|
+ if releasename and len(releasename):
|
||||||
|
+ body += f"Release: {releasename[0]}\n"
|
||||||
|
+ if centos:
|
||||||
|
+ body += "CentOS Stream: True\n"
|
||||||
|
+ if arch:
|
||||||
|
+ body += f"Platform: {arch}\n"
|
||||||
|
|
||||||
|
if 'group' in conf and conf['group'] != 'partner-group':
|
||||||
|
body += f"Partner Group: {conf['group']}\n"
|
||||||
|
@@ -387,7 +391,11 @@ def sendmail(filename, arch, mock, conf, releasename, module, subcomponent,
|
||||||
|
body += f"Partner: {conf['partner']}\n"
|
||||||
|
|
||||||
|
body += "\n"
|
||||||
|
- body += str(module) + "\n"
|
||||||
|
+ if module:
|
||||||
|
+ if type(module) is list:
|
||||||
|
+ body += ", ".join(module) + "\n"
|
||||||
|
+ else:
|
||||||
|
+ body += str(module) + "\n"
|
||||||
|
body += "\n"
|
||||||
|
body += "---\n"
|
||||||
|
body += "\n"
|
11
0003-cs-fix-invalid-escape.patch
Normal file
11
0003-cs-fix-invalid-escape.patch
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
--- a/utils.py
|
||||||
|
+++ b/utils.py
|
||||||
|
@@ -126,7 +126,7 @@
|
||||||
|
print('This tool needs to run on Red Hat Enterprise Linux')
|
||||||
|
return None
|
||||||
|
for rel in release:
|
||||||
|
- if re.match("\d.\d+",rel):
|
||||||
|
+ if re.match(r"\d+.\d+",rel):
|
||||||
|
return rel
|
||||||
|
print('This tool needs to run on Red Hat Enterprise Linux')
|
||||||
|
return None
|
@ -1,9 +0,0 @@
|
|||||||
diff -ru a/ksc b/ksc
|
|
||||||
--- a/ksc 2022-02-11 07:47:47.000000000 +0100
|
|
||||||
+++ b/ksc 2022-02-21 13:22:53.038431651 +0100
|
|
||||||
@@ -1,4 +1,4 @@
|
|
||||||
#!/bin/sh
|
|
||||||
export PYTHONPATH=/usr/share/ksc
|
|
||||||
-exec /usr/bin/python3 -tt /usr/share/ksc/ksc.py "$@"
|
|
||||||
+exec /usr/libexec/platform-python -tt /usr/share/ksc/ksc.py "$@"
|
|
||||||
|
|
208
SPECS/ksc.spec
208
SPECS/ksc.spec
@ -1,208 +0,0 @@
|
|||||||
Name: ksc
|
|
||||||
Version: 1.9
|
|
||||||
Release: 2%{?dist}
|
|
||||||
Summary: Kernel source code checker
|
|
||||||
Group: Development/Tools
|
|
||||||
AutoReqProv: no
|
|
||||||
License: GPLv2+
|
|
||||||
URL: https://github.com/RedHatOfficial/ksc
|
|
||||||
Source0: ksc-%{version}.tar.gz
|
|
||||||
BuildArch: noarch
|
|
||||||
%{?__python3:Requires: %{__python3}}
|
|
||||||
Requires: (kernel-abi-whitelists or kernel-abi-stablelists)
|
|
||||||
Requires: kmod
|
|
||||||
Requires: binutils
|
|
||||||
Requires: kernel-devel
|
|
||||||
Requires: python3-magic
|
|
||||||
Requires: python3-requests
|
|
||||||
BuildRequires: python3-devel
|
|
||||||
BuildRequires: python3-setuptools
|
|
||||||
Patch0: Replace-python3-with-platform-python.patch
|
|
||||||
|
|
||||||
%description
|
|
||||||
A kernel module source code checker to find usage of non whitelist symbols
|
|
||||||
|
|
||||||
%prep
|
|
||||||
%setup -q
|
|
||||||
%patch0 -p1
|
|
||||||
|
|
||||||
%build
|
|
||||||
%py3_build
|
|
||||||
|
|
||||||
%install
|
|
||||||
%{__python3} setup.py install -O1 --root %{buildroot}
|
|
||||||
install -D ksc.1 %{buildroot}%{_mandir}/man1/ksc.1
|
|
||||||
|
|
||||||
%files
|
|
||||||
%license COPYING
|
|
||||||
%doc README PKG-INFO
|
|
||||||
%{_bindir}/ksc
|
|
||||||
%{_datadir}/ksc
|
|
||||||
%{_mandir}/man1/ksc.*
|
|
||||||
%config(noreplace) %{_sysconfdir}/ksc.conf
|
|
||||||
%{python3_sitelib}/ksc-%{version}*.egg-info
|
|
||||||
|
|
||||||
%changelog
|
|
||||||
* Mon Feb 21 2022 Čestmír Kalina <ckalina@redhat.com> - 1.9-2
|
|
||||||
- Resolves: #2043450 ksc: Support Authorization header in bugzilla API
|
|
||||||
- Use platform-python in place of python3
|
|
||||||
* Fri Feb 11 2022 Čestmír Kalina <ckalina@redhat.com> - 1.9-1
|
|
||||||
- Resolves: #2043450 ksc: Support Authorization header in bugzilla API
|
|
||||||
- Rebase to latest ksc release
|
|
||||||
* Mon May 17 2021 Čestmír Kalina <ckalina@redhat.com> - 1.8-3
|
|
||||||
- Resolves: #1954340 ksc: i18n issues,
|
|
||||||
- Add release to Source0
|
|
||||||
* Tue Jan 05 2021 Čestmír Kalina <ckalina@redhat.com> - 1.7-1
|
|
||||||
- Resolves: #1886901 Avoid divisive language
|
|
||||||
- Resolves: #1912506 File bugs with Tracking keyword by default
|
|
||||||
* Wed Nov 06 2019 Čestmír Kalina <ckalina@redhat.com> - 1.6-2
|
|
||||||
- Resolves: #1729039 Extend ksc output to include environment metadata
|
|
||||||
- (OSCI) Add kmod to Makefile-generated Requires
|
|
||||||
* Wed Nov 06 2019 Čestmír Kalina <ckalina@redhat.com> - 1.6-1
|
|
||||||
- Resolves: #1729039 Extend ksc output to include environment metadata
|
|
||||||
- Add modinfo vermagic field to the output.
|
|
||||||
- Add kmod (provides modinfo) to requires.
|
|
||||||
* Thu Nov 29 2018 Čestmír Kalina <ckalina@redhat.com> - 1.5-1
|
|
||||||
- Resolves: #1647528 ksc add feature to copy justifications between ksc...
|
|
||||||
- Resolves: #1648026 ksc add a non-processed .ko file
|
|
||||||
- Resolves: #1647974 piped input causes ksc to fail when asking for user input
|
|
||||||
- Add support for justification carry over.
|
|
||||||
- Add support for symbol filtering using -K.
|
|
||||||
- Fix input problems when piping through to ksc.
|
|
||||||
- Extend manpage with EXAMPLES section.
|
|
||||||
- Version bump fo 1.5.
|
|
||||||
|
|
||||||
* Tue Nov 06 2018 Cestmir Kalina <ckalina@redhat.com> - 1.4-1
|
|
||||||
- Resolves: #1643187 ksc manpage lies -k can only be specified once
|
|
||||||
- Resolves: #1645335 FILE is shown in ksc man page but no explain or effect
|
|
||||||
- Support for multiple -k arguments added
|
|
||||||
- Man page reworded to match ksc behaviour
|
|
||||||
|
|
||||||
* Tue Oct 30 2018 Cestmir Kalina <ckalina@redhat.com> - 1.3-1
|
|
||||||
- Resolves: #1642134 Error restrict bugs to groups without permission while
|
|
||||||
trying to submit RHEL8 symbols
|
|
||||||
- New ksc reports will no longer be submitted under redhat bugzilla group.
|
|
||||||
- At least one bugzilla group must be specified by a ksc user, otherwise ksc
|
|
||||||
will terminate with an error.
|
|
||||||
- Version bump to 1.3
|
|
||||||
|
|
||||||
* Tue Oct 23 2018 Cestmir Kalina <ckalina@redhat.com> - 1.2-1
|
|
||||||
- Version bump to resolve RPMDiff blockers.
|
|
||||||
- Related: #1641485
|
|
||||||
|
|
||||||
* Mon Oct 22 2018 Cestmir Kalina <ckalina@redhat.com> - 1.1-5
|
|
||||||
- Fix ksc report type error when executing against a no-exist file
|
|
||||||
- Resolves: #1641485
|
|
||||||
|
|
||||||
* Wed Oct 10 2018 Cestmir Kalina <ckalina@redhat.com> - 1.1-4
|
|
||||||
- Fix Requires so that rhpkg build does not fail when invoked.
|
|
||||||
- Related: #1619153
|
|
||||||
|
|
||||||
* Tue Oct 09 2018 Cestmir Kalina <ckalina@redhat.com> - 1.1-3
|
|
||||||
- Bump version to 1.1
|
|
||||||
- Related: #1633691
|
|
||||||
- Resolves: #1637594
|
|
||||||
|
|
||||||
* Tue Oct 09 2018 Cestmir Kalina <ckalina@redhat.com> - 1.1-1
|
|
||||||
- Replace the Python interpreter path to RHEL8 compliant path.
|
|
||||||
- Related: #1633691
|
|
||||||
- Resolves: #1637594
|
|
||||||
|
|
||||||
* Thu Sep 20 2018 Tomas Orsava <torsava@redhat.com> - 1.0-2
|
|
||||||
- Require the Python interpreter directly instead of using the package name
|
|
||||||
- Related: rhbz#1619153
|
|
||||||
|
|
||||||
* Fri Sep 7 2018 Cestmir Kalina <ckalina@redhat.com> - 1.0-1
|
|
||||||
- Resolves: #1623321
|
|
||||||
|
|
||||||
* Mon Jun 4 2018 Stanislav Kozina <skozina@redhat.com> - 0.9.24-1
|
|
||||||
- Remove options -d and --internal
|
|
||||||
|
|
||||||
* Wed May 2 2018 Petr Oros <poros@redhat.com> - 0.9.23-1
|
|
||||||
- Port for python 3
|
|
||||||
|
|
||||||
* Wed Dec 13 2017 Martin Lacko <mlacko@redhat.com> - 0.9.22-1
|
|
||||||
- Resolves: #1524779
|
|
||||||
|
|
||||||
* Tue Dec 5 2017 Martin Lacko <mlacko@redhat.com> - 0.9.21-1
|
|
||||||
- Resolves: #1520224
|
|
||||||
|
|
||||||
* Tue Nov 28 2017 Martin Lacko <mlacko@redhat.com> - 0.9.20-1
|
|
||||||
- Resolves: #1502930
|
|
||||||
|
|
||||||
* Tue Nov 7 2017 Stanislav Kozina <skozina@redhat.com> - 0.9.19-1
|
|
||||||
- Resolves: #1432864
|
|
||||||
- Resolves: #1500383
|
|
||||||
- Resolves: #1502930
|
|
||||||
- Resolves: #1503526
|
|
||||||
- Resolves: #1503603
|
|
||||||
- Resolves: #1503964
|
|
||||||
- Resolves: #1499249
|
|
||||||
- Resolves: #1441455
|
|
||||||
- Resolves: #1481310
|
|
||||||
- Resolves: #1456140
|
|
||||||
|
|
||||||
* Mon Sep 5 2016 Stanislav Kozina <skozina@redhat.com> - 0.9.18-1
|
|
||||||
- Resolves: #1373120
|
|
||||||
|
|
||||||
* Mon Aug 15 2016 Stanislav Kozina <skozina@redhat.com> - 0.9.17-1
|
|
||||||
- Add -y option to provide path to the Module.symvers file
|
|
||||||
- Resolves: #1366929
|
|
||||||
- Resolves: #1366952
|
|
||||||
|
|
||||||
* Fri Jul 15 2016 Stanislav Kozina <skozina@redhat.com> - 0.9.16-3
|
|
||||||
- Fix requires
|
|
||||||
- Resolves: #1356905
|
|
||||||
|
|
||||||
* Wed May 04 2016 Stanislav Kozina <skozina@redhat.com> - 0.9.16-1
|
|
||||||
- embed python-bugzilla interface to get rid of the package dependency
|
|
||||||
- Resolves: #1332810
|
|
||||||
|
|
||||||
* Tue Apr 26 2016 Stanislav Kozina <skozina@redhat.com> - 0.9.15-1
|
|
||||||
- always load whitelist file from kernel-abi-whitelists package, remove the attached files
|
|
||||||
- always load Module.symvers file from kernel-devel package, remove attached files
|
|
||||||
- use python-bugzilla instead of private bz_xmlrpc package
|
|
||||||
- Resolves: #1328384
|
|
||||||
- Resolves: #906664
|
|
||||||
- Resolves: #906659
|
|
||||||
- Resolves: #1272348
|
|
||||||
|
|
||||||
* Tue Feb 25 2014 Jiri Olsa <jolsa@redhat.com> - 0.9.11-1
|
|
||||||
- Resolves: #1066162
|
|
||||||
|
|
||||||
* Fri Jan 10 2014 Jiri Olsa <jolsa@redhat.com> - 0.9.10-1
|
|
||||||
- Resolves: #1051506
|
|
||||||
|
|
||||||
* Fri Jan 10 2014 Jiri Olsa <jolsa@redhat.com> - 0.9.9-2
|
|
||||||
- added binutils cpp file dependencies
|
|
||||||
- Resolves: #1051411
|
|
||||||
|
|
||||||
* Thu Jan 09 2014 Jiri Olsa <jolsa@redhat.com> - 0.9.9-1
|
|
||||||
- updating to version 0.9.9
|
|
||||||
- Resolves: #881654
|
|
||||||
- Resolves: #1028410
|
|
||||||
- Resolves: #1045025
|
|
||||||
- Resolves: #1045368
|
|
||||||
- Resolves: #1045388
|
|
||||||
|
|
||||||
* Fri Dec 27 2013 Daniel Mach <dmach@redhat.com> - 0.9.8-2
|
|
||||||
- Mass rebuild 2013-12-27
|
|
||||||
|
|
||||||
* Mon Nov 18 2013 Jiri Olsa <jolsa@redhat.com> - 0.9.8-1
|
|
||||||
- updating to version 0.9.8
|
|
||||||
- Resolves: #1028410
|
|
||||||
|
|
||||||
* Tue Aug 20 2013 Jiri Olsa <jolsa@redhat.com> - 0.9.5-1
|
|
||||||
- updating to version 0.9.5
|
|
||||||
|
|
||||||
* Fri Nov 30 2012 Jiri Olsa <jolsa@redhat.com> - 0.9.3-3
|
|
||||||
- removing kabi-whitelists dependency
|
|
||||||
|
|
||||||
* Fri Nov 30 2012 Jiri Olsa <jolsa@redhat.com> - 0.9.3-2
|
|
||||||
- spec file updates
|
|
||||||
|
|
||||||
* Fri Nov 30 2012 Jiri Olsa <jolsa@redhat.com> - 0.9.3-1
|
|
||||||
- new version with license info updated
|
|
||||||
|
|
||||||
* Tue Nov 20 2012 Jiri Olsa <jolsa@redhat.com> - 0.9.2-1
|
|
||||||
- initial
|
|
7
gating.yaml
Normal file
7
gating.yaml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
--- !Policy
|
||||||
|
product_versions:
|
||||||
|
- rhel-*
|
||||||
|
decision_context: osci_compose_gate
|
||||||
|
rules:
|
||||||
|
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}
|
||||||
|
|
100
ksc.spec
Normal file
100
ksc.spec
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
%global forgeurl https://github.com/RedHatOfficial/ksc
|
||||||
|
%global commitdate 20230109
|
||||||
|
%global commit 869a25c7de8ed880a72f66ae4f3e8407f1aa4114
|
||||||
|
%global shortcommit %(c=%{commit}; echo ${c:0:7})
|
||||||
|
|
||||||
|
%{?python_enable_dependency_generator}
|
||||||
|
%forgemeta -i
|
||||||
|
|
||||||
|
Name: ksc
|
||||||
|
Version: 1.12
|
||||||
|
Release: 7%{?dist}
|
||||||
|
Summary: Kernel source code checker
|
||||||
|
Group: Development/Tools
|
||||||
|
AutoReqProv: no
|
||||||
|
License: GPL-2.0-or-later
|
||||||
|
URL: https://github.com/RedHatOfficial/ksc
|
||||||
|
BuildArch: noarch
|
||||||
|
Requires: kmod
|
||||||
|
Requires: binutils
|
||||||
|
Requires: kernel-devel
|
||||||
|
Requires: python3-requests
|
||||||
|
BuildRequires: python3-devel
|
||||||
|
BuildRequires: python3-setuptools
|
||||||
|
Source0: https://github.com/RedHatOfficial/ksc/archive/%{commit}/%{name}-%{shortcommit}.tar.gz
|
||||||
|
Patch0: 0001-manpage.patch
|
||||||
|
Patch1: 0002-c9s-notifications.patch
|
||||||
|
Patch2: 0003-cs-fix-invalid-escape.patch
|
||||||
|
|
||||||
|
%description
|
||||||
|
A kernel module source code checker to find usage of select symbols
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%forgesetup
|
||||||
|
# Fix build with setuptools 62.1
|
||||||
|
# https://github.com/RedHatOfficial/ksc/issues/3
|
||||||
|
sed -i "15i packages=[]," setup.py
|
||||||
|
%patch0 -p1
|
||||||
|
%patch1 -p1
|
||||||
|
%patch2 -p1
|
||||||
|
|
||||||
|
%build
|
||||||
|
%py3_build
|
||||||
|
|
||||||
|
%install
|
||||||
|
%py3_install
|
||||||
|
install -D ksc.1 %{buildroot}%{_mandir}/man1/ksc.1
|
||||||
|
|
||||||
|
%files
|
||||||
|
%license COPYING
|
||||||
|
%doc README PKG-INFO
|
||||||
|
%{_bindir}/ksc
|
||||||
|
%{_datadir}/ksc
|
||||||
|
%{_mandir}/man1/ksc.*
|
||||||
|
%config(noreplace) %{_sysconfdir}/ksc.conf
|
||||||
|
%{python3_sitelib}/ksc-%{version}*.egg-info
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Mon Nov 18 2024 Čestmír Kalina <ckalina@redhat.com> - 1.12-7
|
||||||
|
- Resolves: RHEL-65759
|
||||||
|
|
||||||
|
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - Packaging variables read or set by %forgemeta
|
||||||
|
- Bump release for October 2024 mass rebuild:
|
||||||
|
Resolves: RHEL-64018
|
||||||
|
|
||||||
|
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - Packaging variables read or set by %forgemeta
|
||||||
|
- Bump release for June 2024 mass rebuild
|
||||||
|
|
||||||
|
* Tue May 28 2024 Čestmír Kalina <ckalina@redhat.com> - 1.12-4
|
||||||
|
- Resolves: JIRA: https://issues.redhat.com/browse/RHEL-35791
|
||||||
|
- Update to the latest ksc
|
||||||
|
|
||||||
|
* Thu Jan 25 2024 Fedora Release Engineering <releng@fedoraproject.org> - Packaging variables read or set by %forgemeta
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
||||||
|
|
||||||
|
* Sun Jan 21 2024 Fedora Release Engineering <releng@fedoraproject.org> - Packaging variables read or set by %forgemeta
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
||||||
|
|
||||||
|
* Mon Jun 19 2023 Čestmír Kalina <ckalina@redhat.com> - 1.7-8
|
||||||
|
- Migrate license to SPDX
|
||||||
|
|
||||||
|
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - Packaging variables read or set by %forgemeta
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
|
||||||
|
|
||||||
|
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - Packaging variables read or set by %forgemeta
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
|
||||||
|
|
||||||
|
* Tue Jun 21 2022 Lumír Balhar <lbalhar@redhat.com> - 1.7-5
|
||||||
|
- Fix compatibility with newer setuptools
|
||||||
|
|
||||||
|
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - Packaging variables read or set by %forgemeta
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
|
||||||
|
|
||||||
|
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - Packaging variables read or set by %forgemeta
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
|
||||||
|
|
||||||
|
* Tue Jun 01 2021 Zamir SUN <sztsian@gmail.com> - 1.7-2
|
||||||
|
- Add python3-requests into Requires
|
||||||
|
|
||||||
|
* Tue Jan 05 2021 Čestmír Kalina <ckalina@redhat.com> - 1.7-1
|
||||||
|
- Initial Fedora commit.
|
1
sources
Normal file
1
sources
Normal file
@ -0,0 +1 @@
|
|||||||
|
SHA512 (ksc-869a25c.tar.gz) = 85c287b19d914e44ded15c11a45b49c8574a2b42dfbccc8a3f8e110fd1e51ef9cc1a21e25610620e62a8c2c51f2548693f61d912c8f93e3e88b0debcd56a70bb
|
78
tests/README.md
Normal file
78
tests/README.md
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
# README
|
||||||
|
|
||||||
|
The following test cases will be considered as a part of `ksc` gating.
|
||||||
|
|
||||||
|
## Installation issues
|
||||||
|
|
||||||
|
1. Check whether Module.symvers has been installed
|
||||||
|
1. Check whether kabi-stablelists package has been installed
|
||||||
|
1. Python Bugzilla interface has been installed
|
||||||
|
1. Expect error when nm is not found in $PATH.
|
||||||
|
|
||||||
|
## Valid uses of `ksc`
|
||||||
|
|
||||||
|
List of tests:
|
||||||
|
|
||||||
|
1. No external symbol required
|
||||||
|
1. Whitelisted symbol use only
|
||||||
|
1. Non-whitelisted symbol use only
|
||||||
|
1. Mixed whitelisted and non-whitelisted symbol use
|
||||||
|
1. Mixed whitelisted and non-whitelisted symbol use with multiple -k arguments
|
||||||
|
1. `ksc` called on 8139, crc32_generic, xor
|
||||||
|
|
||||||
|
Testing will be done as follows:
|
||||||
|
|
||||||
|
1. If applicable, try and build a kernel module usecase.
|
||||||
|
1. Pass kernel module(s) to ksc, record output.
|
||||||
|
1. Using the kabi-tools ksc parser [1], parse ksc output.
|
||||||
|
1. Using the nm tool, uname -i and kabi-whitelist, indepedently compose
|
||||||
|
the dictionary that ksc parser produces on ksc output.
|
||||||
|
1. Check for match.
|
||||||
|
|
||||||
|
Note that this series of tests checks both ksc valid functionality as well as
|
||||||
|
syntax requirements (indeed, should syntax of a ksc report be significantly
|
||||||
|
changed, ksc parser would produce different results).
|
||||||
|
|
||||||
|
[1] http://git.engineering.redhat.com/git/users/ckalina/kabi-greylists-devel.git/tree/src/greylists/ksc.py
|
||||||
|
|
||||||
|
## Submission tests
|
||||||
|
|
||||||
|
Partner RHBZ is used for this purpose.
|
||||||
|
|
||||||
|
1. All of the 'Valid uses of `ksc`' test cases (called w/ -k) will be re-tested
|
||||||
|
here as well to test immediate submission after generating.
|
||||||
|
1. Use any ksc-reports.txt to test submission onto partner RHBZ; in particular
|
||||||
|
test:
|
||||||
|
- failure on invalid product
|
||||||
|
- failure on invalid RHBZ credentials (username, password)
|
||||||
|
- failure on invalid RHBZ API key
|
||||||
|
- correct submission (using the gating-embedded bugzilla-cli tool to
|
||||||
|
download and check details of bug and attachments).
|
||||||
|
|
||||||
|
## Further tests include:
|
||||||
|
|
||||||
|
1. Check whether justification carry-over works within the same ko file.
|
||||||
|
1. Check whether justification carry-over does not happen when different ko
|
||||||
|
file is used.
|
||||||
|
|
||||||
|
## Invalid uses of `ksc`
|
||||||
|
|
||||||
|
1. Expect error when argument arity is not expected (e.g., $ ksc -k, w/o a ko
|
||||||
|
file provided)
|
||||||
|
1. Expect error when passing non-kernel module as a kernel module (-k)
|
||||||
|
1. Expect error when passing a file w/o read permissions (e.g., kernel module,
|
||||||
|
Module.symvers, ...)
|
||||||
|
1. Expect error when passing a non-existent file (e.g., kernel module, ...)
|
||||||
|
1. Expect error when passing a malformed kernel module.
|
||||||
|
1. Expect error when passing a malformed Module.symvers.
|
||||||
|
1. Expect error when passing a ksc-report.txt as a source of justifications.
|
||||||
|
|
||||||
|
## Compatibility Tests
|
||||||
|
|
||||||
|
1. Verify that no options were removed from -h/--help.
|
||||||
|
1. Verify that no options were removed from manpage.
|
||||||
|
|
||||||
|
## Test known bugs
|
||||||
|
|
||||||
|
1. EOFError when piping through ksc
|
||||||
|
|
89
tests/sanity/Makefile
Normal file
89
tests/sanity/Makefile
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
#
|
||||||
|
# Makefile of ksc/sanity
|
||||||
|
# Description: ksc 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-symbols.sh common-tests.sh runtest.sh test-ksc-elf.sh test-ksc-exec.sh test-ksc-help.sh test-ksc-invalid-file.sh test-ksc-man.sh
|
||||||
|
|
||||||
|
.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: ksc tests">> $(METADATA)
|
||||||
|
@echo "Type: Regression" >> $(METADATA)
|
||||||
|
@echo "TestTime: 1h" >> $(METADATA)
|
||||||
|
@echo "RunFor: ksc" >> $(METADATA)
|
||||||
|
@echo "Requires: bash" >> $(METADATA)
|
||||||
|
@echo "Requires: coreutils" >> $(METADATA)
|
||||||
|
@echo "Requires: kernel" >> $(METADATA)
|
||||||
|
@echo "Requires: kmod" >> $(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)
|
||||||
|
|
||||||
|
|
78
tests/sanity/README.md
Normal file
78
tests/sanity/README.md
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
# README
|
||||||
|
|
||||||
|
The following test cases will be considered as a part of `ksc` gating.
|
||||||
|
|
||||||
|
## Installation issues
|
||||||
|
|
||||||
|
1. Check whether Module.symvers has been installed
|
||||||
|
1. Check whether kabi-stablelists package has been installed
|
||||||
|
1. Python Bugzilla interface has been installed
|
||||||
|
1. Expect error when nm is not found in $PATH.
|
||||||
|
|
||||||
|
## Valid uses of `ksc`
|
||||||
|
|
||||||
|
List of tests:
|
||||||
|
|
||||||
|
1. No external symbol required
|
||||||
|
1. Whitelisted symbol use only
|
||||||
|
1. Non-stablelisted symbol use only
|
||||||
|
1. Mixed stablelisted and non-stablelisted symbol use
|
||||||
|
1. Mixed stablelisted and non-stablelisted symbol use with multiple -k arguments
|
||||||
|
1. `ksc` called on 8139, crc32_generic, xor
|
||||||
|
|
||||||
|
Testing will be done as follows:
|
||||||
|
|
||||||
|
1. If applicable, try and build a kernel module usecase.
|
||||||
|
1. Pass kernel module(s) to ksc, record output.
|
||||||
|
1. Using the kabi-tools ksc parser [1], parse ksc output.
|
||||||
|
1. Using the nm tool, uname -i and kabi-stablelist, indepedently compose
|
||||||
|
the dictionary that ksc parser produces on ksc output.
|
||||||
|
1. Check for match.
|
||||||
|
|
||||||
|
Note that this series of tests checks both ksc valid functionality as well as
|
||||||
|
syntax requirements (indeed, should syntax of a ksc report be significantly
|
||||||
|
changed, ksc parser would produce different results).
|
||||||
|
|
||||||
|
[1] http://git.engineering.redhat.com/git/users/ckalina/kabi-greylists-devel.git/tree/src/greylists/ksc.py
|
||||||
|
|
||||||
|
## Submission tests
|
||||||
|
|
||||||
|
Partner RHBZ is used for this purpose.
|
||||||
|
|
||||||
|
1. All of the 'Valid uses of `ksc`' test cases (called w/ -k) will be re-tested
|
||||||
|
here as well to test immediate submission after generating.
|
||||||
|
1. Use any ksc-reports.txt to test submission onto partner RHBZ; in particular
|
||||||
|
test:
|
||||||
|
- failure on invalid product
|
||||||
|
- failure on invalid RHBZ credentials (username, password)
|
||||||
|
- failure on invalid RHBZ API key
|
||||||
|
- correct submission (using the gating-embedded bugzilla-cli tool to
|
||||||
|
download and check details of bug and attachments).
|
||||||
|
|
||||||
|
## Further tests include:
|
||||||
|
|
||||||
|
1. Check whether justification carry-over works within the same ko file.
|
||||||
|
1. Check whether justification carry-over does not happen when different ko
|
||||||
|
file is used.
|
||||||
|
|
||||||
|
## Invalid uses of `ksc`
|
||||||
|
|
||||||
|
1. Expect error when argument arity is not expected (e.g., $ ksc -k, w/o a ko
|
||||||
|
file provided)
|
||||||
|
1. Expect error when passing non-kernel module as a kernel module (-k)
|
||||||
|
1. Expect error when passing a file w/o read permissions (e.g., kernel module,
|
||||||
|
Module.symvers, ...)
|
||||||
|
1. Expect error when passing a non-existent file (e.g., kernel module, ...)
|
||||||
|
1. Expect error when passing a malformed kernel module.
|
||||||
|
1. Expect error when passing a malformed Module.symvers.
|
||||||
|
1. Expect error when passing a ksc-report.txt as a source of justifications.
|
||||||
|
|
||||||
|
## Compatibility Tests
|
||||||
|
|
||||||
|
1. Verify that no options were removed from -h/--help.
|
||||||
|
1. Verify that no options were removed from manpage.
|
||||||
|
|
||||||
|
## Test known bugs
|
||||||
|
|
||||||
|
1. EOFError when piping through ksc
|
||||||
|
|
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=ksc/sanity
|
||||||
|
export PACKAGE=general
|
||||||
|
export PACKAGE_NAME=general
|
||||||
|
export PKG_LIST=
|
||||||
|
export TEST=/kernel/general/ksc/sanity
|
||||||
|
|
65
tests/sanity/common-symbols.sh
Normal file
65
tests/sanity/common-symbols.sh
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Get all symbols from ksc result's nonstablelisted sections
|
||||||
|
function ksc_report_symbols_nonstablelisted() {
|
||||||
|
sed -n 's/^.*(\([^)]*\))$/\1/p' ~/ksc-result.txt \
|
||||||
|
| sort \
|
||||||
|
| uniq
|
||||||
|
}
|
||||||
|
|
||||||
|
# Get all symbols from ksc result's stablelisted sections
|
||||||
|
function ksc_report_symbols_stablelisted() {
|
||||||
|
sed -n '/^\[WHITELISTUSAGE\]$/,/^\[NONWHITELISTUSAGE\]$/p' \
|
||||||
|
~/ksc-result.txt \
|
||||||
|
| grep -v '^\[' \
|
||||||
|
| sort \
|
||||||
|
| uniq
|
||||||
|
}
|
||||||
|
|
||||||
|
# Get all symbols from ksc result
|
||||||
|
function ksc_report_symbols_all() {
|
||||||
|
{
|
||||||
|
ksc_report_symbols_stablelisted
|
||||||
|
ksc_report_symbols_nonstablelisted
|
||||||
|
} | sort | uniq
|
||||||
|
}
|
||||||
|
|
||||||
|
# Get undefined symbols in all argument-provided ko files
|
||||||
|
function ko_get_undefined() {
|
||||||
|
echo -e ${@/%/\\n} \
|
||||||
|
| xargs -I KO nm -u KO \
|
||||||
|
| awk '{print $(NF);}' \
|
||||||
|
| sort \
|
||||||
|
| uniq
|
||||||
|
}
|
||||||
|
|
||||||
|
# Get defined symbols in all argument-provided ko files
|
||||||
|
function ko_get_defined() {
|
||||||
|
echo -e ${@/%/\\n} \
|
||||||
|
| xargs -I KO nm --defined-only KO \
|
||||||
|
| awk '{print $(NF);}' \
|
||||||
|
| sort \
|
||||||
|
| uniq
|
||||||
|
}
|
||||||
|
|
||||||
|
# Get all undefined symbols for the group; i.e., symbols defined in one
|
||||||
|
# ko and undefined in another will be ignored; this captures ksc behaviour
|
||||||
|
# when used w/ multiple -k options.
|
||||||
|
function ko_get_group_undefined() {
|
||||||
|
comm -23 <(ko_get_undefined "$@") <(ko_get_defined "$@")
|
||||||
|
}
|
||||||
|
|
||||||
|
# Get all symbols present in kABI stablelist
|
||||||
|
function kabi_stablelists_symbols() {
|
||||||
|
grep -h '^[[:space:]]' /lib/modules/kabi-current/* \
|
||||||
|
| tr -d '\t' \
|
||||||
|
| sort \
|
||||||
|
| uniq
|
||||||
|
}
|
||||||
|
|
||||||
|
# Get all symbols present in Module.symvers
|
||||||
|
function get_module_symvers_symbols() {
|
||||||
|
awk '{print $2;}' /usr/src/kernels/$(uname -r)/Module.symvers \
|
||||||
|
| sort \
|
||||||
|
| uniq
|
||||||
|
}
|
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
|
||||||
|
}
|
179
tests/sanity/runtest.sh
Executable file
179
tests/sanity/runtest.sh
Executable file
@ -0,0 +1,179 @@
|
|||||||
|
#!/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=()
|
||||||
|
|
||||||
|
# The following can be overriden to force a particular setting.
|
||||||
|
|
||||||
|
# RPM_BIN_DIR is not defined
|
||||||
|
# RPM_DATA_DIR is not defined
|
||||||
|
# KSC_BIN is not defined
|
||||||
|
# MOD_PATH is not defined
|
||||||
|
# MANUAL is not defined
|
||||||
|
|
||||||
|
# --- Initialization ----------------------------------------------------------
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo " :: ksc Gating for RHEL"
|
||||||
|
echo
|
||||||
|
|
||||||
|
# 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")
|
||||||
|
INCLUDES+=("$SCRIPT_ROOT/common-symbols.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 ksc-test-stdout.XXXXX)
|
||||||
|
TEMPFILES+=("$__stdout_log")
|
||||||
|
|
||||||
|
__stderr_log=$(mktemp -p /tmp ksc-test-stderr.XXXXX)
|
||||||
|
TEMPFILES+=("$__stderr_log")
|
||||||
|
|
||||||
|
# --- Evaluate RPM-specific macros --------------------------------------------
|
||||||
|
# This is required not to hardcode ksc 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 ksc location --------------------------------------------------
|
||||||
|
|
||||||
|
if test -z "$KSC_BIN"
|
||||||
|
then
|
||||||
|
KSC_BIN="$RPM_BIN_DIR/ksc"
|
||||||
|
echo ":: ksc path determined as: $KSC_BIN"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test -z "$MOD_PATH"
|
||||||
|
then
|
||||||
|
if [[ -L /lib && -d /lib ]]; then
|
||||||
|
MOD_PATH=/usr/lib/modules/$(uname -r)/
|
||||||
|
else
|
||||||
|
MOD_PATH=/lib/modules/$(uname -r)/
|
||||||
|
fi
|
||||||
|
echo ":: Module path determined as: $MOD_PATH"
|
||||||
|
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
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
# -- Future tests: pylint/flake8 on the python source itself
|
||||||
|
|
||||||
|
# First, we need to detect whether or not $KSC_BIN is a shell launcher or
|
||||||
|
# the python script itself. As of this moment, $KSC_BIN is a shell launcher,
|
||||||
|
# however, currently there is no real reason for that and might be changed
|
||||||
|
# in the future. To prepare for this alternative, and to be backwards compat
|
||||||
|
# if the change occurs, detect whether $KSC_BIN is the python executable script
|
||||||
|
# or a shell launcher and obtain path to the python script in the latter case.
|
||||||
|
|
||||||
|
KSC_PY=""
|
||||||
|
case $(file "$KSC_BIN" | awk -F'[,:] ' '{print $2;}') in
|
||||||
|
"POSIX shell script")
|
||||||
|
# We're dealing with a launcher, get the python script itself
|
||||||
|
KSC_PY="$(grep -o "[^ ]*ksc.py" "$KSC_BIN")"
|
||||||
|
;;
|
||||||
|
"Python script")
|
||||||
|
# We're dealing with a python script
|
||||||
|
KSC_PY="$KSC_BIN"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# TODO: Call flake8/pylint here
|
||||||
|
|
177
tests/sanity/test-ksc-elf.sh
Normal file
177
tests/sanity/test-ksc-elf.sh
Normal file
@ -0,0 +1,177 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# ksc gating
|
||||||
|
#
|
||||||
|
# verify that ksc launcher is marked executable
|
||||||
|
#
|
||||||
|
|
||||||
|
SYMBOL_CHECKS=()
|
||||||
|
|
||||||
|
SYMBOL_CHECKS+=(symbol_check_1)
|
||||||
|
DESCRIPTION_symbol_check_1=(
|
||||||
|
"Verify that all symbols in stablelisted and nonstablelisted sections"
|
||||||
|
"of the just produced ksc-report.txt are marked as undefined by nm,"
|
||||||
|
"discounting symbols defined within the set of modules used."
|
||||||
|
)
|
||||||
|
function symbol_check_1() {
|
||||||
|
test -z "$(comm -13 <(ksc_report_symbols_all) \
|
||||||
|
<(ko_get_group_undefined))"
|
||||||
|
return $?
|
||||||
|
}
|
||||||
|
|
||||||
|
SYMBOL_CHECKS+=(symbol_check_2)
|
||||||
|
DESCRIPTION_symbol_check_2=(
|
||||||
|
"Verify that all symbols in stablelisted and nonstablelisted sections"
|
||||||
|
"of the just produced ksc-report.txt come from Module.symvers only."
|
||||||
|
)
|
||||||
|
function symbol_check_2() {
|
||||||
|
test -z "$(comm -23 <(ksc_report_symbols_all) \
|
||||||
|
<(get_module_symvers_symbols))"
|
||||||
|
return $?
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
SYMBOL_CHECKS+=(symbol_check_3)
|
||||||
|
DESCRIPTION_symbol_check_3=(
|
||||||
|
"Verify that all stablelisted symbols are present on kabi stablelist."
|
||||||
|
)
|
||||||
|
function symbol_check_3() {
|
||||||
|
test -z "$(comm -13 <(kabi_stablelists_symbols) \
|
||||||
|
<(ksc_report_symbols_stablelisted))"
|
||||||
|
return $?
|
||||||
|
}
|
||||||
|
|
||||||
|
function find_ko()
|
||||||
|
{
|
||||||
|
if test -z $1
|
||||||
|
then
|
||||||
|
# TODO ERRROR
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local count=$1
|
||||||
|
local matches=()
|
||||||
|
|
||||||
|
if test $count -gt 0
|
||||||
|
then
|
||||||
|
matches+=($(
|
||||||
|
find "$MOD_PATH" -type f -iname "*.ko*" \
|
||||||
|
| head -n $count \
|
||||||
|
| xargs -I MATCH bash -c '
|
||||||
|
case $(echo MATCH | grep -P "\.ko($|\.[^.]+$)") in
|
||||||
|
.ko.xz) unxz MATCH;;
|
||||||
|
.ko.bz2) bzip2 -d MATCH;;
|
||||||
|
.ko.gz) gunzip MATCH;;
|
||||||
|
*) echo MATCH; exit 0;;
|
||||||
|
esac;
|
||||||
|
echo MATCH | sed "s/\.[^.]*$//g";'
|
||||||
|
))
|
||||||
|
fi
|
||||||
|
|
||||||
|
# make sure some matches were found
|
||||||
|
if test ${#matches[@]} -eq 0
|
||||||
|
then
|
||||||
|
echo "No modules found." >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# and that they are in fact readable
|
||||||
|
for match in ${matches[@]}
|
||||||
|
do
|
||||||
|
if test -z $match -o ! -r $match
|
||||||
|
then
|
||||||
|
# TODO ERRROR
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo ${matches[@]}
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function common_ksc_elf_ko()
|
||||||
|
{
|
||||||
|
local test_name="$1"
|
||||||
|
local stdout_log="$2"
|
||||||
|
local stderr_log="$3"
|
||||||
|
local count="$4"
|
||||||
|
shift 4
|
||||||
|
|
||||||
|
local ko=($(find_ko $count))
|
||||||
|
|
||||||
|
eval DESCRIPTION_$test_name+=\(\"\"\)
|
||||||
|
eval DESCRIPTION_$test_name+=\(\"Test used the following modules:\"\)
|
||||||
|
[ ${#ko[@]} -gt 0 ] || { echo "ERROR: No module found in MOD_PATH=$MOD_PATH."; exit 1; }
|
||||||
|
for mod in ${ko[@]}
|
||||||
|
do
|
||||||
|
mod_rel="$(realpath --relative-to="$MOD_PATH" $ko)"
|
||||||
|
eval DESCRIPTION_$test_name+=\(\"\${mod_rel/\#/ - }\"\)
|
||||||
|
done
|
||||||
|
|
||||||
|
rm -f ~/ksc-result.txt
|
||||||
|
"$KSC_BIN" ${ko[@]/#/-k } >> $stdout_log 2>> $stderr_log
|
||||||
|
|
||||||
|
if test $? -gt 0
|
||||||
|
then
|
||||||
|
echo
|
||||||
|
echo "ERROR: $KSC_BIN returned w/ non-zero return code when" \
|
||||||
|
"presented w/ valid kernel module."
|
||||||
|
|
||||||
|
echo "STDOUT {"
|
||||||
|
cat $stdout_log
|
||||||
|
echo "}"
|
||||||
|
|
||||||
|
echo "STDERR {"
|
||||||
|
cat $stderr_log
|
||||||
|
echo "}"
|
||||||
|
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test ! -s ~/ksc-result.txt
|
||||||
|
then
|
||||||
|
echo
|
||||||
|
echo "ERROR: ~/ksc-result.txt was not created or is empty."
|
||||||
|
|
||||||
|
echo "STDOUT {"
|
||||||
|
cat $stdout_log
|
||||||
|
echo "}"
|
||||||
|
|
||||||
|
echo "STDERR {"
|
||||||
|
cat $stderr_log
|
||||||
|
echo "}"
|
||||||
|
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
TESTS+=(test_ksc_elf_ko_single ${SYMBOL_CHECKS[@]})
|
||||||
|
|
||||||
|
DESCRIPTION_test_ksc_elf_ko_single=(
|
||||||
|
"Verify that ksc processes valid ELF kernel module. This amounts to"
|
||||||
|
"checking that ~/ksc-result.txt is created and that ksc terminates"
|
||||||
|
"w/ non-zero error code."
|
||||||
|
)
|
||||||
|
|
||||||
|
function test_ksc_elf_ko_single()
|
||||||
|
{
|
||||||
|
common_ksc_elf_ko test_ksc_elf_ko_single $@ 1
|
||||||
|
return $?
|
||||||
|
}
|
||||||
|
|
||||||
|
TESTS+=(test_ksc_elf_ko_mul)
|
||||||
|
|
||||||
|
DESCRIPTION_test_ksc_elf_ko_mul=(
|
||||||
|
"Verify that ksc processes multiple valid ELF kernel modules. This"
|
||||||
|
"amounts to checking that ~/ksc-result.txt is created and that ksc"
|
||||||
|
"terminates w/ non-zero error code."
|
||||||
|
)
|
||||||
|
|
||||||
|
function test_ksc_elf_ko_mul()
|
||||||
|
{
|
||||||
|
common_ksc_elf_ko test_ksc_elf_ko_mul $@ 2
|
||||||
|
return $?
|
||||||
|
}
|
30
tests/sanity/test-ksc-exec.sh
Normal file
30
tests/sanity/test-ksc-exec.sh
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
#
|
||||||
|
# ksc gating
|
||||||
|
#
|
||||||
|
# verify that ksc is executable
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
TESTS+=(test_ksc_executable)
|
||||||
|
|
||||||
|
DESCRIPTION_test_ksc_executable=(
|
||||||
|
"Verify that ksc is executable."
|
||||||
|
)
|
||||||
|
|
||||||
|
function test_ksc_executable()
|
||||||
|
{
|
||||||
|
local stdout_log="$1"
|
||||||
|
local stderr_log="$2"
|
||||||
|
shift 2
|
||||||
|
|
||||||
|
if ! test -x "$KSC_BIN"
|
||||||
|
then
|
||||||
|
echo
|
||||||
|
echo "ERROR: $KSC_BIN either does not exist or is not" \
|
||||||
|
"executable!" >&2
|
||||||
|
ls -l "$KSC_BIN" >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
}
|
56
tests/sanity/test-ksc-help.sh
Normal file
56
tests/sanity/test-ksc-help.sh
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
#
|
||||||
|
# ksc gating
|
||||||
|
#
|
||||||
|
# verify that ksc -h (--help) provides usage and terminated w/ non-zero error
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
TESTS+=(test_ksc_help)
|
||||||
|
|
||||||
|
DESCRIPTION_test_ksc_help=(
|
||||||
|
"Verify that ksc -h (--help) provides usage and terminated w/"
|
||||||
|
"non-zero error."
|
||||||
|
)
|
||||||
|
|
||||||
|
function test_ksc_help()
|
||||||
|
{
|
||||||
|
local stdout_log="$1"
|
||||||
|
local stderr_log="$2"
|
||||||
|
shift 2
|
||||||
|
|
||||||
|
for arg in -h --help
|
||||||
|
do
|
||||||
|
echo > $stdout_log
|
||||||
|
echo > $stderr_log
|
||||||
|
|
||||||
|
echo "# Calling $KSC_BIN $arg" >> $stdout_log
|
||||||
|
"$KSC_BIN" $arg >> $stdout_log 2>> $stderr_log
|
||||||
|
|
||||||
|
if test $? -gt 0
|
||||||
|
then
|
||||||
|
echo
|
||||||
|
echo "ERROR: $KSC_BIN $arg failed with non-zero" \
|
||||||
|
"return code. Expected zero."
|
||||||
|
|
||||||
|
echo "STDOUT {"
|
||||||
|
cat $stdout_log
|
||||||
|
echo "}"
|
||||||
|
|
||||||
|
echo "STDERR {"
|
||||||
|
cat $stderr_log
|
||||||
|
echo "}"
|
||||||
|
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test ! -s "$stdout_log" -a ! -s "$stderr_log"
|
||||||
|
then
|
||||||
|
echo
|
||||||
|
echo "ERROR: $KSC_BIN $arg produced no data." >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
done
|
||||||
|
return 0
|
||||||
|
}
|
46
tests/sanity/test-ksc-invalid-file.sh
Normal file
46
tests/sanity/test-ksc-invalid-file.sh
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
#
|
||||||
|
# ksc gating
|
||||||
|
#
|
||||||
|
# verify that ksc fails when presented w/ non-existent path
|
||||||
|
#
|
||||||
|
|
||||||
|
TESTS+=(test_ksc_invalid_file)
|
||||||
|
|
||||||
|
DESCRIPTION_test_ksc_invalid_file=(
|
||||||
|
"Verify that ksc fails when presented w/ non-existent path."
|
||||||
|
)
|
||||||
|
|
||||||
|
function test_ksc_invalid_file()
|
||||||
|
{
|
||||||
|
local stdout_log="$1"
|
||||||
|
local stderr_log="$2"
|
||||||
|
shift 2
|
||||||
|
|
||||||
|
local non_exist_file="/tmp/$RANDOM"
|
||||||
|
while test -e $non_exist_file
|
||||||
|
do
|
||||||
|
non_exist_file=$non_exist_file$RANDOM
|
||||||
|
done
|
||||||
|
|
||||||
|
"$KSC_BIN" -k "$non_exist_file" >> $stdout_log 2>> $stderr_log
|
||||||
|
|
||||||
|
if test $? -eq 0 -a ! -e "$non_exist_file"
|
||||||
|
then
|
||||||
|
echo
|
||||||
|
echo "ERROR: $KSC_BIN returned w/ zero return code when" \
|
||||||
|
"presented w/ non-existent file."
|
||||||
|
|
||||||
|
echo "STDOUT {"
|
||||||
|
cat $stdout_log
|
||||||
|
echo "}"
|
||||||
|
|
||||||
|
echo "STDERR {"
|
||||||
|
cat $stderr_log
|
||||||
|
echo "}"
|
||||||
|
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
55
tests/sanity/test-ksc-man.sh
Normal file
55
tests/sanity/test-ksc-man.sh
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
#
|
||||||
|
# ksc gating
|
||||||
|
#
|
||||||
|
# verify that ksc manpage exists and is nonempty
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
TESTS+=(test_ksc_manpage)
|
||||||
|
|
||||||
|
DESCRIPTION_test_ksc_manpage=(
|
||||||
|
"Verify that ksc manpage exists and is nonempty."
|
||||||
|
)
|
||||||
|
|
||||||
|
function test_ksc_manpage()
|
||||||
|
{
|
||||||
|
local stdout_log="$1"
|
||||||
|
local stderr_log="$2"
|
||||||
|
shift 2
|
||||||
|
|
||||||
|
LC_ALL=en_US.UTF-8 man -P cat ksc > $stdout_log 2> $stderr_log
|
||||||
|
|
||||||
|
if test $? -gt 0
|
||||||
|
then
|
||||||
|
echo
|
||||||
|
echo "$? ERROR: man ksc failed with non-zero" \
|
||||||
|
"return code. Expected zero."
|
||||||
|
|
||||||
|
echo "STDOUT {"
|
||||||
|
cat $stdout_log
|
||||||
|
echo "}"
|
||||||
|
|
||||||
|
echo "STDERR {"
|
||||||
|
cat $stderr_log
|
||||||
|
echo "}"
|
||||||
|
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test ! -s "$stdout_log"
|
||||||
|
then
|
||||||
|
echo
|
||||||
|
echo "ERROR: man ksc produced no data on stdout." >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test -s "$stderr_log"
|
||||||
|
then
|
||||||
|
echo
|
||||||
|
echo "ERROR: man ksc produced data on stderr." >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
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