Backport function tests from centos stream
This commit is contained in:
parent
d37efc8796
commit
0ee1026718
@ -72,4 +72,4 @@ $(METADATA): Makefile
|
|||||||
@echo "RunFor: $(PACKAGE_NAME)" >> $(METADATA)
|
@echo "RunFor: $(PACKAGE_NAME)" >> $(METADATA)
|
||||||
@echo "Requires: $(PACKAGE_NAME)" >> $(METADATA)
|
@echo "Requires: $(PACKAGE_NAME)" >> $(METADATA)
|
||||||
|
|
||||||
rhts-lint $(METADATA)
|
rhts-lint $(METADATA)
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
"""dmpd_library.py: Complete library providing functionality for device-mapper-persistent-data upstream test."""
|
"""dmpd_library.py: Complete library providing functionality for device-mapper-persistent-data upstream test."""
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
import platform
|
import platform
|
||||||
from os.path import expanduser
|
from os.path import expanduser
|
||||||
import re #regex
|
import re #regex
|
||||||
@ -25,7 +27,6 @@ import time
|
|||||||
import fileinput
|
import fileinput
|
||||||
# TODO: Is this really necessary? Unlikely we will run into python2 in rawhide
|
# TODO: Is this really necessary? Unlikely we will run into python2 in rawhide
|
||||||
# again...
|
# again...
|
||||||
from __future__ import print_function
|
|
||||||
|
|
||||||
|
|
||||||
def _print(string):
|
def _print(string):
|
||||||
@ -55,7 +56,7 @@ def run(cmd, return_output=False, verbose=True, force_flush=False):
|
|||||||
date = "date \"+%Y-%m-%d %H:%M:%S\""
|
date = "date \"+%Y-%m-%d %H:%M:%S\""
|
||||||
p = subprocess.Popen(date, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
p = subprocess.Popen(date, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||||
stdout, stderr = p.communicate()
|
stdout, stderr = p.communicate()
|
||||||
stdout = stdout.rstrip("\n")
|
stdout = stdout.decode('ascii', 'ignore').rstrip("\n")
|
||||||
_print("INFO: [%s] Running: '%s'..." % (stdout, cmd))
|
_print("INFO: [%s] Running: '%s'..." % (stdout, cmd))
|
||||||
|
|
||||||
#enabling shell=True, because was the only way I found to run command with '|'
|
#enabling shell=True, because was the only way I found to run command with '|'
|
||||||
@ -77,7 +78,7 @@ def run(cmd, return_output=False, verbose=True, force_flush=False):
|
|||||||
|
|
||||||
retcode = p.returncode
|
retcode = p.returncode
|
||||||
|
|
||||||
output = stdout + stderr
|
output = stdout.decode('ascii', 'ignore') + stderr.decode('ascii', 'ignore')
|
||||||
|
|
||||||
#remove new line from last line
|
#remove new line from last line
|
||||||
output = output.rstrip()
|
output = output.rstrip()
|
||||||
|
Loading…
Reference in New Issue
Block a user