Skip to content

Commit b8b6df6

Browse files
committed
Merging pull request 238
Signed-off-by: Lukáš Doktor <[email protected]> * github.com:distributed-system-analysis/run-perf: Makefile: Use pip to deploy/uninstall the runperf .github: Use python3.12 for testing setup: Use supported version string runperf: Replace pipes with shlex module contrib: Update docker image
2 parents 4cd161b + c675ef2 commit b8b6df6

File tree

7 files changed

+16
-18
lines changed

7 files changed

+16
-18
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313
strategy:
1414
matrix:
15-
python-version: [3.9]
15+
python-version: [3.12]
1616
fail-fast: false
1717
steps:
1818
- uses: actions/checkout@v2
@@ -24,7 +24,7 @@ jobs:
2424
with:
2525
python-version: ${{ matrix.python-version }}
2626
- name: Install missing aexpect dependency (remove when https://github.com/avocado-framework/aexpect/pull/81 is merged)
27-
run: pip install six
27+
run: pip install six numpy
2828
- run: pip install -r requirements.txt
2929
- run: make check
3030

Makefile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
ifndef PYTHON
22
PYTHON=$(shell which python3 2>/dev/null || which python 2>/dev/null)
33
endif
4-
PYTHON_DEVELOP_ARGS=$(shell if ($(PYTHON) setup.py develop --help 2>/dev/null | grep -q '\-\-user'); then echo "--user"; else echo ""; fi)
54

65
all:
76
@echo
@@ -26,12 +25,11 @@ coverage: clean develop
2625
./selftests/run_coverage
2726

2827
develop:
29-
$(PYTHON) setup.py develop $(PYTHON_DEVELOP_ARGS)
28+
$(PYTHON) -m pip install -e .
3029

3130
clean:
32-
$(PYTHON) setup.py clean
31+
$(PYTHON) -m pip uninstall -y runperf
3332
rm -rf build/ MANIFEST BUILD BUILDROOT SPECS RPMS SRPMS SOURCES dist/ docs/build/
34-
$(PYTHON) setup.py develop --uninstall $(PYTHON_DEVELOP_ARGS)
3533
rm -rf *.egg-info
3634
find . -name '*.pyc' -delete
3735

contrib/container/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
FROM fedora
66
MAINTAINER Lukas Doktor [email protected]
77

8-
RUN dnf -y module enable avocado:latest && dnf install -y python3-pip git python3-pyyaml python3-numpy python3-aexpect python3-jinja2 rsync && dnf clean all
9-
RUN python3 -m pip install git+https://github.com/distributed-system-analysis/run-perf.git
8+
RUN dnf install -y python3-avocado python3-pip git python3-pyyaml python3-numpy python3-jinja2 rsync && dnf clean all
9+
RUN python3 -m pip install git+https://github.com/distributed-system-analysis/run-perf.git git+https://github.com/avocado-framework/aexpect.git
1010
RUN ssh-keygen -t ed25519 -N "" -f /root/.ssh/id_ed25519
1111
RUN curl https://raw.githubusercontent.com/distributed-system-analysis/run-perf/master/contrib/bisect.sh > /usr/local/bin/bisect.sh && chmod +x /usr/local/bin/bisect.sh
1212
RUN curl https://raw.githubusercontent.com/distributed-system-analysis/run-perf/master/contrib/upstream_qemu_bisect.sh > /usr/local/bin/upstream_qemu_bisect.sh && chmod +x /usr/local/bin/upstream_qemu_bisect.sh

runperf/tests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515

1616
import json
1717
import os
18-
import pipes
1918
import re
19+
import shlex
2020
import tempfile
2121
import time
2222

@@ -60,7 +60,7 @@ def _all_machines_kmsg(self, msg):
6060
for worker in workers:
6161
sessions.append(worker.get_session(hop=self.host))
6262
msg = f"C{time.time():.0f}: {self.host.profile.name}: {msg}"
63-
cmd = f"echo runperf: W$(date +%s): {pipes.quote(msg)} > /dev/kmsg"
63+
cmd = f"echo runperf: W$(date +%s): {shlex.quote(msg)} > /dev/kmsg"
6464
for session in sessions:
6565
session.sendline(cmd)
6666
for session in sessions:

runperf/utils/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
import itertools
2121
import logging
2222
import os
23-
import pipes
2423
import random
24+
import shlex
2525
import shutil
2626
import string
2727
import subprocess # nosec
@@ -275,7 +275,7 @@ def check_output(*args, **kwargs):
275275
args[0], str(args[1:]), str(kwargs))
276276
else:
277277
logging.debug("Running: %s (%s, %s)",
278-
" ".join(pipes.quote(_) for _ in args[0]),
278+
" ".join(shlex.quote(_) for _ in args[0]),
279279
str(args[1:]), str(kwargs))
280280
try:
281281
return subprocess.check_output(*args, **kwargs).decode("utf-8") # nosec
@@ -458,7 +458,7 @@ def shell_write_content_cmd(path, content, append=False):
458458
eof = random_string(6)
459459
if eof + '\n' not in content:
460460
break
461-
return (f"cat {'>>' if append else '>'} {pipes.quote(path)} << "
461+
return (f"cat {'>>' if append else '>'} {shlex.quote(path)} << "
462462
f"\\{eof}\n{content}\n{eof}")
463463

464464

@@ -478,7 +478,7 @@ def _shell_write_content_cmd(path, content, append=False):
478478
if eof + '\n' not in content:
479479
break
480480
return (f"head -c -1 <<\\{eof} | cat {'>>' if append else '>'} "
481-
f"{pipes.quote(path)}\n{content}\n{eof}")
481+
f"{shlex.quote(path)}\n{content}\n{eof}")
482482
size = 4096
483483
if len(content) < size:
484484
return run(shell_write_content_cmd(path, content, append))
@@ -512,7 +512,7 @@ def shell_dnf_install_cmd(pkgs):
512512
:param pkgs: List of pkg names to be installed
513513
:return: Command to install all packages
514514
"""
515-
escaped_pkgs = [pipes.quote(_) for _ in pkgs]
515+
escaped_pkgs = [shlex.quote(_) for _ in pkgs]
516516
return f"dnf install -y --nobest --skip-broken {' '.join(escaped_pkgs)}"
517517

518518
def wait_for_machine_calms_down(session, timeout=600):

runperf/utils/cloud_image_providers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
# Copyright: Red Hat Inc. 2020
1414
# Author: Lukas Doktor <[email protected]>
1515
import os
16-
import pipes
1716
import re
17+
import shlex
1818
from urllib.request import urlopen
1919

2020
from runperf import utils
@@ -92,7 +92,7 @@ def prepare(self, default_password):
9292
"""
9393
# To be sure remove image and per-vm images as well
9494
self.session.cmd("rm -f " +
95-
' '.join(pipes.quote(_) for _ in self.paths))
95+
' '.join(shlex.quote(_) for _ in self.paths))
9696
# Store shared ssh key to allow checking for the same pub ssh key
9797
# when reusing the image.
9898
self.session.cmd(utils.shell_write_content_cmd(self.pubkey,

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def _get_git_version():
4444
try:
4545
subprocess.check_output([git, "diff", "--quiet"]) # nosec
4646
except subprocess.CalledProcessError:
47-
version += "+dirty"
47+
version += ".dirty"
4848
except (OSError, subprocess.SubprocessError, NameError):
4949
return '0.0'
5050
finally:

0 commit comments

Comments
 (0)