diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 054a9cb..027177c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.9] + python-version: [3.12] fail-fast: false steps: - uses: actions/checkout@v2 @@ -24,7 +24,7 @@ jobs: with: python-version: ${{ matrix.python-version }} - name: Install missing aexpect dependency (remove when https://github.com/avocado-framework/aexpect/pull/81 is merged) - run: pip install six + run: pip install six numpy - run: pip install -r requirements.txt - run: make check diff --git a/Makefile b/Makefile index ad76217..d33162c 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,6 @@ ifndef PYTHON PYTHON=$(shell which python3 2>/dev/null || which python 2>/dev/null) endif -PYTHON_DEVELOP_ARGS=$(shell if ($(PYTHON) setup.py develop --help 2>/dev/null | grep -q '\-\-user'); then echo "--user"; else echo ""; fi) all: @echo @@ -26,12 +25,11 @@ coverage: clean develop ./selftests/run_coverage develop: - $(PYTHON) setup.py develop $(PYTHON_DEVELOP_ARGS) + $(PYTHON) -m pip install -e . clean: - $(PYTHON) setup.py clean + $(PYTHON) -m pip uninstall -y runperf rm -rf build/ MANIFEST BUILD BUILDROOT SPECS RPMS SRPMS SOURCES dist/ docs/build/ - $(PYTHON) setup.py develop --uninstall $(PYTHON_DEVELOP_ARGS) rm -rf *.egg-info find . -name '*.pyc' -delete diff --git a/contrib/container/Dockerfile b/contrib/container/Dockerfile index 9eab33d..33251dc 100644 --- a/contrib/container/Dockerfile +++ b/contrib/container/Dockerfile @@ -5,8 +5,8 @@ FROM fedora MAINTAINER Lukas Doktor ldoktor@redhat.com -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 -RUN python3 -m pip install git+https://github.com/distributed-system-analysis/run-perf.git +RUN dnf install -y python3-avocado python3-pip git python3-pyyaml python3-numpy python3-jinja2 rsync && dnf clean all +RUN python3 -m pip install git+https://github.com/distributed-system-analysis/run-perf.git git+https://github.com/avocado-framework/aexpect.git RUN ssh-keygen -t ed25519 -N "" -f /root/.ssh/id_ed25519 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 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 diff --git a/runperf/tests.py b/runperf/tests.py index cd2f6e2..b876c48 100644 --- a/runperf/tests.py +++ b/runperf/tests.py @@ -15,8 +15,8 @@ import json import os -import pipes import re +import shlex import tempfile import time @@ -60,7 +60,7 @@ def _all_machines_kmsg(self, msg): for worker in workers: sessions.append(worker.get_session(hop=self.host)) msg = f"C{time.time():.0f}: {self.host.profile.name}: {msg}" - cmd = f"echo runperf: W$(date +%s): {pipes.quote(msg)} > /dev/kmsg" + cmd = f"echo runperf: W$(date +%s): {shlex.quote(msg)} > /dev/kmsg" for session in sessions: session.sendline(cmd) for session in sessions: diff --git a/runperf/utils/__init__.py b/runperf/utils/__init__.py index 688e0e5..698cbcb 100644 --- a/runperf/utils/__init__.py +++ b/runperf/utils/__init__.py @@ -20,8 +20,8 @@ import itertools import logging import os -import pipes import random +import shlex import shutil import string import subprocess # nosec @@ -275,7 +275,7 @@ def check_output(*args, **kwargs): args[0], str(args[1:]), str(kwargs)) else: logging.debug("Running: %s (%s, %s)", - " ".join(pipes.quote(_) for _ in args[0]), + " ".join(shlex.quote(_) for _ in args[0]), str(args[1:]), str(kwargs)) try: return subprocess.check_output(*args, **kwargs).decode("utf-8") # nosec @@ -458,7 +458,7 @@ def shell_write_content_cmd(path, content, append=False): eof = random_string(6) if eof + '\n' not in content: break - return (f"cat {'>>' if append else '>'} {pipes.quote(path)} << " + return (f"cat {'>>' if append else '>'} {shlex.quote(path)} << " f"\\{eof}\n{content}\n{eof}") @@ -478,7 +478,7 @@ def _shell_write_content_cmd(path, content, append=False): if eof + '\n' not in content: break return (f"head -c -1 <<\\{eof} | cat {'>>' if append else '>'} " - f"{pipes.quote(path)}\n{content}\n{eof}") + f"{shlex.quote(path)}\n{content}\n{eof}") size = 4096 if len(content) < size: return run(shell_write_content_cmd(path, content, append)) @@ -512,7 +512,7 @@ def shell_dnf_install_cmd(pkgs): :param pkgs: List of pkg names to be installed :return: Command to install all packages """ - escaped_pkgs = [pipes.quote(_) for _ in pkgs] + escaped_pkgs = [shlex.quote(_) for _ in pkgs] return f"dnf install -y --nobest --skip-broken {' '.join(escaped_pkgs)}" def wait_for_machine_calms_down(session, timeout=600): diff --git a/runperf/utils/cloud_image_providers.py b/runperf/utils/cloud_image_providers.py index ff475a3..921c799 100644 --- a/runperf/utils/cloud_image_providers.py +++ b/runperf/utils/cloud_image_providers.py @@ -13,8 +13,8 @@ # Copyright: Red Hat Inc. 2020 # Author: Lukas Doktor import os -import pipes import re +import shlex from urllib.request import urlopen from runperf import utils @@ -92,7 +92,7 @@ def prepare(self, default_password): """ # To be sure remove image and per-vm images as well self.session.cmd("rm -f " + - ' '.join(pipes.quote(_) for _ in self.paths)) + ' '.join(shlex.quote(_) for _ in self.paths)) # Store shared ssh key to allow checking for the same pub ssh key # when reusing the image. self.session.cmd(utils.shell_write_content_cmd(self.pubkey, diff --git a/setup.py b/setup.py index 7ce330f..905feb1 100755 --- a/setup.py +++ b/setup.py @@ -44,7 +44,7 @@ def _get_git_version(): try: subprocess.check_output([git, "diff", "--quiet"]) # nosec except subprocess.CalledProcessError: - version += "+dirty" + version += ".dirty" except (OSError, subprocess.SubprocessError, NameError): return '0.0' finally: