Fix gating
- Add gating.yaml - Fix tools_not_linked_usr test compatibility with python3 Related: #1980882
This commit is contained in:
parent
0d98ab82f7
commit
b6c6936189
@ -8,7 +8,7 @@
|
||||
Summary: Device-mapper Persistent Data Tools
|
||||
Name: device-mapper-persistent-data
|
||||
Version: 0.9.0
|
||||
Release: 8%{?dist}%{?release_suffix}
|
||||
Release: 9%{?dist}%{?release_suffix}
|
||||
License: GPLv3+
|
||||
URL: https://github.com/jthornber/thin-provisioning-tools
|
||||
#Source0: https://github.com/jthornber/thin-provisioning-tools/archive/thin-provisioning-tools-%%{version}.tar.gz
|
||||
@ -162,6 +162,9 @@ make DESTDIR=%{buildroot} MANDIR=%{_mandir} install-rust-tools
|
||||
#% {_sbindir}/thin_show_duplicates
|
||||
|
||||
%changelog
|
||||
* Fri Jul 23 2021 Marian Csontos <mcsontos@redhat.com> - 0.9.0-9
|
||||
- Fix gating tests.
|
||||
|
||||
* Thu Jul 22 2021 Marian Csontos <mcsontos@redhat.com> - 0.9.0-8
|
||||
- Fix rust compilation issues.
|
||||
|
||||
|
6
gating.yaml
Normal file
6
gating.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
--- !Policy
|
||||
product_versions:
|
||||
- rhel-9
|
||||
decision_context: osci_compose_gate
|
||||
rules:
|
||||
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}
|
@ -56,7 +56,7 @@ def run(cmd, return_output=False, verbose=True, force_flush=False):
|
||||
date = "date \"+%Y-%m-%d %H:%M:%S\""
|
||||
p = subprocess.Popen(date, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||
stdout, stderr = p.communicate()
|
||||
stdout = stdout.rstrip("\n")
|
||||
stdout = stdout.decode('ascii', 'ignore').rstrip("\n")
|
||||
_print("INFO: [%s] Running: '%s'..." % (stdout, cmd))
|
||||
|
||||
#enabling shell=True, because was the only way I found to run command with '|'
|
||||
@ -78,7 +78,7 @@ def run(cmd, return_output=False, verbose=True, force_flush=False):
|
||||
|
||||
retcode = p.returncode
|
||||
|
||||
output = stdout + stderr
|
||||
output = stdout.decode('ascii', 'ignore') + stderr.decode('ascii', 'ignore')
|
||||
|
||||
#remove new line from last line
|
||||
output = output.rstrip()
|
||||
|
5
tests/main.fmf
Normal file
5
tests/main.fmf
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
# dmpd testsuite requires 2G ramdisk to create a loop device
|
||||
standard-inventory-qcow2:
|
||||
qemu:
|
||||
m: 3G
|
@ -11,6 +11,7 @@
|
||||
required_packages:
|
||||
- findutils # beakerlib needs find command
|
||||
- which # tools_not_linked_usr needs which command
|
||||
- lvm2
|
||||
|
||||
# Tests suitable to run in container and atomic environments
|
||||
- hosts: localhost
|
||||
|
@ -14,33 +14,41 @@
|
||||
#
|
||||
# Author: Bruno Goncalves <bgoncalv@redhat.com>
|
||||
|
||||
from os import walk
|
||||
import subprocess
|
||||
import sys
|
||||
import re
|
||||
|
||||
|
||||
def run(cmd):
|
||||
print("INFO: Running '%s'..." % cmd)
|
||||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||
stdout, stderr = p.communicate()
|
||||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
|
||||
stderr = b""
|
||||
stdout = b""
|
||||
while p.poll() is None:
|
||||
new_data = p.stdout.readline()
|
||||
stdout += new_data
|
||||
sys.stdout.write(new_data.decode('ascii', 'ignore'))
|
||||
sys.stdout.flush()
|
||||
|
||||
retcode = p.returncode
|
||||
output = stdout + stderr
|
||||
output = stdout.decode('ascii', 'ignore') + stderr.decode('ascii', 'ignore')
|
||||
|
||||
# remove new line from last line
|
||||
output = output.rstrip()
|
||||
print(output)
|
||||
return retcode, output
|
||||
|
||||
|
||||
def start_test():
|
||||
# if uses any library linked to /usr this my affect the tools during boot
|
||||
print("INFO: Making sure tools provided by device-mapper-persistent-data are not linked to /usr")
|
||||
|
||||
#if uses any library linked to /usr this my affect the tools during boot
|
||||
print("INFO: Making sure tools provided by device-mapper-persistent-data "
|
||||
"are not linked to /usr")
|
||||
|
||||
#Paths where we should have no libraries linked from
|
||||
# Paths where we should have no libraries linked from
|
||||
lib_paths = ["/usr/"]
|
||||
|
||||
package = "device-mapper-persistent-data"
|
||||
run("yum install -y %s" % package)
|
||||
#Get all tools that we need to check
|
||||
# Get all tools that we need to check
|
||||
ret, output = run("rpm -ql %s | grep \"sbin/\"" % package)
|
||||
if ret != 0:
|
||||
print("FAIL: Could not get the tools shipped from %s" % package)
|
||||
@ -50,7 +58,7 @@ def start_test():
|
||||
error = False
|
||||
for tool in tools:
|
||||
if not tool:
|
||||
#skip any blank line
|
||||
# skip any blank line
|
||||
continue
|
||||
tool_error = 0
|
||||
for lib_path in lib_paths:
|
||||
@ -60,8 +68,8 @@ def start_test():
|
||||
print("FAIL: Could not list dynamically libraries for %s" % (tool))
|
||||
tool_error += 1
|
||||
else:
|
||||
#The command executed sucessfuly
|
||||
#check if any library linked is from lib_path
|
||||
# The command executed sucessfuly
|
||||
# check if any library linked is from lib_path
|
||||
links = linked_lib.split("\n")
|
||||
for link in links:
|
||||
if re.match(".*%s.*" % lib_path, link):
|
||||
@ -71,7 +79,7 @@ def start_test():
|
||||
if tool_error == 0:
|
||||
print("%s is not linked to %s" % (tool, lib_path))
|
||||
else:
|
||||
#found some error in at least 1 tool
|
||||
# found some error in at least 1 tool
|
||||
error = True
|
||||
|
||||
if error:
|
||||
@ -81,7 +89,6 @@ def start_test():
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
if not start_test():
|
||||
print("FAIL: test failed")
|
||||
sys.exit(1)
|
||||
@ -89,5 +96,5 @@ def main():
|
||||
print("PASS: Test pass")
|
||||
sys.exit(0)
|
||||
|
||||
main()
|
||||
|
||||
main()
|
||||
|
Loading…
Reference in New Issue
Block a user