Merge pull request #20480 from smithfarm/wip-23035

build/ops: run-make-check.sh: handle Python 2 absence

Reviewed-by: Jan Fajerski <jfajerski@suse.com>
Reviewed-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
Kefu Chai 2018-04-26 12:50:44 +08:00 committed by GitHub
commit b6cc272181
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 6 deletions

View File

@ -5,7 +5,7 @@ if test -e build; then
exit 1
fi
if which ccache ; then
if type ccache > /dev/null 2>&1 ; then
echo "enabling ccache"
ARGS="$ARGS -DWITH_CCACHE=ON"
fi

View File

@ -69,7 +69,12 @@ function run() {
BUILD_MAKEOPTS=${BUILD_MAKEOPTS:-$DEFAULT_MAKEOPTS}
CHECK_MAKEOPTS=${CHECK_MAKEOPTS:-$DEFAULT_MAKEOPTS}
$DRY_RUN ./do_cmake.sh -DWITH_FIO=ON $@ || return 1
CMAKE_PYTHON_OPTS=
if ! type python2 > /dev/null 2>&1 ; then
CMAKE_PYTHON_OPTS="-DWITH_PYTHON2=OFF -DWITH_PYTHON3=ON -DMGR_PYTHON_VERSION=3"
fi
$DRY_RUN ./do_cmake.sh -DWITH_FIO=ON $CMAKE_PYTHON_OPTS $@ || return 1
$DRY_RUN cd build
$DRY_RUN make $BUILD_MAKEOPTS tests || return 1
# prevent OSD EMFILE death on tests, make sure large than 1024

View File

@ -1,18 +1,18 @@
#!/usr/bin/env python
#!/usr/bin/env python3
import json
import os
import re
import subprocess
disks = json.loads(subprocess.check_output("ceph-disk list --format json", shell=True))
disks = json.loads(subprocess.check_output("ceph-disk list --format json", shell=True).decode("utf-8"))
used = 0
for disk in disks:
for partition in disk.get('partition', []):
if partition.get('type') == 'data':
df = subprocess.check_output("df --output=used " + partition['path'], shell=True)
used += int(re.findall('\d+', df)[0])
used += int(re.findall(b'\d+', df)[0])
facts_file = os.environ.get("CEPH_FACTS_FILE", "/etc/rhsm/facts/ceph_usage.facts")
open(facts_file, 'w').write("""\

View File

@ -95,7 +95,7 @@ class TestArgparse:
command,
'toomany']))
def capture_output(self, args, stdout=None, stderr=None):
def capture_output(self, args, stdout=None, stderr=None):
if stdout:
stdout = StringIO()
sys.stdout = stdout