Make all scripts python3-compliant
And explicitly call python3
This commit is contained in:
parent
ce3c0e65aa
commit
18ffcfbc2c
137
fio-python3.patch
Normal file
137
fio-python3.patch
Normal file
@ -0,0 +1,137 @@
|
||||
|
||||
|
||||
make fio scripts python3-ready
|
||||
|
||||
commit 5eac3b00238b450ac0679121a76f1e566ca8f468
|
||||
Author: Bill O'Donnell <billodo@redhat.com>
|
||||
Date: Fri May 4 14:43:40 2018 -0500
|
||||
|
||||
make fio scripts python3-ready
|
||||
|
||||
Many distributions are moving to python3 by default. Here's
|
||||
an attempt to make the python scripts in fio python3-ready.
|
||||
|
||||
Conversion was facilitated with automated tools. A few areas
|
||||
were hand fixed: remove superfluous parentheses introduced by
|
||||
2to3 converter in print function calls, shebang modifications
|
||||
to use environment variable for python version, and byte-string
|
||||
decode correction in steadystate_tests.py following 2to3
|
||||
conversion.
|
||||
|
||||
The modified scripts pass rudimentary testing when run under
|
||||
python2.7 as well as python3.
|
||||
|
||||
Signed-off-by: Bill O'Donnell <billodo@redhat.com>
|
||||
Signed-off-by: Jens Axboe <axboe@kernel.dk>
|
||||
---
|
||||
Index: fio-3.6/doc/conf.py
|
||||
===================================================================
|
||||
--- fio-3.6.orig/doc/conf.py
|
||||
+++ fio-3.6/doc/conf.py
|
||||
@@ -22,6 +22,9 @@
|
||||
|
||||
# -- General configuration ------------------------------------------------
|
||||
|
||||
+from __future__ import absolute_import
|
||||
+from __future__ import print_function
|
||||
+
|
||||
# If your documentation needs a minimal Sphinx version, state it here.
|
||||
#
|
||||
# needs_sphinx = '1.0'
|
||||
Index: fio-3.6/tools/fiologparser.py
|
||||
===================================================================
|
||||
--- fio-3.6.orig/tools/fiologparser.py
|
||||
+++ fio-3.6/tools/fiologparser.py
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/python3
|
||||
+# Note: this script is python2 and python 3 compatible.
|
||||
#
|
||||
# fiologparser.py
|
||||
#
|
||||
@@ -13,6 +14,8 @@
|
||||
#
|
||||
# to see per-interval average completion latency.
|
||||
|
||||
+from __future__ import absolute_import
|
||||
+from __future__ import print_function
|
||||
import argparse
|
||||
import math
|
||||
|
||||
Index: fio-3.6/unit_tests/steadystate_tests.py
|
||||
===================================================================
|
||||
--- fio-3.6.orig/unit_tests/steadystate_tests.py
|
||||
+++ fio-3.6/unit_tests/steadystate_tests.py
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/python3
|
||||
+# Note: this script is python2 and python 3 compatible.
|
||||
#
|
||||
# steadystate_tests.py
|
||||
#
|
||||
@@ -18,6 +19,8 @@
|
||||
# if ss attained: min runtime = ss_dur + ss_ramp
|
||||
# if not attained: runtime = timeout
|
||||
|
||||
+from __future__ import absolute_import
|
||||
+from __future__ import print_function
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
@@ -26,11 +29,12 @@ import pprint
|
||||
import argparse
|
||||
import subprocess
|
||||
from scipy import stats
|
||||
+from six.moves import range
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('fio',
|
||||
- help='path to fio executable');
|
||||
+ help='path to fio executable')
|
||||
parser.add_argument('--read',
|
||||
help='target for read testing')
|
||||
parser.add_argument('--write',
|
||||
@@ -45,7 +49,7 @@ def check(data, iops, slope, pct, limit,
|
||||
data = data[measurement]
|
||||
mean = sum(data) / len(data)
|
||||
if slope:
|
||||
- x = range(len(data))
|
||||
+ x = list(range(len(data)))
|
||||
m, intercept, r_value, p_value, std_err = stats.linregress(x,data)
|
||||
m = abs(m)
|
||||
if pct:
|
||||
@@ -89,11 +93,11 @@ if __name__ == '__main__':
|
||||
'output': "set steady state BW threshold to 12" },
|
||||
]
|
||||
for test in parsing:
|
||||
- output = subprocess.check_output([args.fio] + test['args']);
|
||||
- if test['output'] in output:
|
||||
- print "PASSED '{0}' found with arguments {1}".format(test['output'], test['args'])
|
||||
+ output = subprocess.check_output([args.fio] + test['args'])
|
||||
+ if test['output'] in output.decode():
|
||||
+ print("PASSED '{0}' found with arguments {1}".format(test['output'], test['args']))
|
||||
else:
|
||||
- print "FAILED '{0}' NOT found with arguments {1}".format(test['output'], test['args'])
|
||||
+ print("FAILED '{0}' NOT found with arguments {1}".format(test['output'], test['args']))
|
||||
|
||||
#
|
||||
# test some read workloads
|
||||
@@ -117,7 +121,7 @@ if __name__ == '__main__':
|
||||
args.read = '/dev/zero'
|
||||
extra = [ "--size=134217728" ] # 128 MiB
|
||||
else:
|
||||
- print "ERROR: file for read testing must be specified on non-posix systems"
|
||||
+ print("ERROR: file for read testing must be specified on non-posix systems")
|
||||
sys.exit(1)
|
||||
else:
|
||||
extra = []
|
||||
@@ -216,7 +220,7 @@ if __name__ == '__main__':
|
||||
else:
|
||||
result = 'FAILED '
|
||||
line = result + line + ' no ss, expected runtime {0} ~= actual runtime {1}'.format(expected, actual)
|
||||
- print line
|
||||
+ print(line)
|
||||
if 'steadystate' in jsonjob:
|
||||
pp.pprint(jsonjob['steadystate'])
|
||||
jobnum += 1
|
||||
|
||||
|
9
fio.spec
9
fio.spec
@ -1,6 +1,6 @@
|
||||
Name: fio
|
||||
Version: 3.6
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
Summary: Multithreaded IO generation tool
|
||||
|
||||
Group: Applications/System
|
||||
@ -21,6 +21,8 @@ BuildRequires: numactl-devel
|
||||
BuildRequires: librdmacm-devel
|
||||
%endif
|
||||
|
||||
Patch0: fio-python3.patch
|
||||
|
||||
%description
|
||||
fio is an I/O tool that will spawn a number of threads or processes doing
|
||||
a particular type of io action as specified by the user. fio takes a
|
||||
@ -32,6 +34,8 @@ one wants to simulate.
|
||||
%prep
|
||||
%setup -q
|
||||
|
||||
%patch0 -p1
|
||||
|
||||
%build
|
||||
./configure --disable-optimizations
|
||||
EXTFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS" make V=1 %{?_smp_mflags}
|
||||
@ -48,6 +52,9 @@ make install prefix=%{_prefix} mandir=%{_mandir} DESTDIR=$RPM_BUILD_ROOT INSTALL
|
||||
%{_datadir}/%{name}/*
|
||||
|
||||
%changelog
|
||||
* Wed May 16 2018 Eric Sandeen <sandeen@redhat.com> 3.6-2
|
||||
- Make all python scripts python3 compliant and explicit
|
||||
|
||||
* Wed Apr 18 2018 Eric Sandeen <sandeen@redhat.com> 3.6-1
|
||||
- New upstream version
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user