diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index ca3d669d2..50b980dee 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -16,7 +16,7 @@ jobs: build-baseline: runs-on: ubuntu-latest container: - image: python:3.6.0 + image: python:3.8 steps: - uses: actions/checkout@v3 - name: Install dependencies @@ -49,10 +49,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Set up Python 3.11 + - name: Set up Python 3.12 uses: actions/setup-python@v4 with: - python-version: '3.11' + python-version: '3.12' cache: 'pip' - name: Install dependencies run: | diff --git a/Jenkinsfile b/Jenkinsfile index 9ab98f768..941f9a0a2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,118 +7,84 @@ pipeline { stages { stage('Test') { parallel { - stage('Test Python 3.6.0') { + stage('Test Python Baseline') { agent { dockerfile { dir 'src/tests' - filename 'python-360.Dockerfile' + filename 'python-baseline.Dockerfile' } } steps { ansiColor(colorMapName: 'xterm') { - dir("tempsrc") { deleteDir() } - dir("tempsrc") { sh 'ls -la' } - // Avoid git chowning .git/index to root which will cause the next build to fail - // Work around old docker version in jenkins that can't change cwd: - sh 'cd tempsrc && ../src/tests/run_jenkins_tests.sh 3.6.0' - dir("tempsrc") { deleteDir() } + dir("scratch") { deleteDir() } + dir("scratch") { + sh 'ls -la' + // Avoid git chowning .git/index to root which will cause the next build to fail + sh '../src/tests/run_jenkins_tests.sh baseline' + deleteDir() + } } - junit '3.6.0-results.xml' + junit 'baseline-results.xml' } } - stage('Test Python 3.7.0') { + stage('Test Python Latest') { agent { dockerfile { dir 'src/tests' - filename 'python-370.Dockerfile' + filename 'python-latest.Dockerfile' } } steps { ansiColor(colorMapName: 'xterm') { - dir("tempsrc") { deleteDir() } - dir("tempsrc") { sh 'ls -la' } - // Avoid git chowning .git/index to root which will cause the next build to fail - // Work around old docker version in jenkins that can't change cwd: - sh 'cd tempsrc && ../src/tests/run_jenkins_tests.sh 3.7.0' - dir("tempsrc") { deleteDir() } + dir("scratch") { deleteDir() } + dir("scratch") { + sh 'ls -la' + // Avoid git chowning .git/index to root which will cause the next build to fail + sh '../src/tests/run_jenkins_tests.sh latest' + deleteDir() + } } - junit '3.7.0-results.xml' + junit 'latest-results.xml' } } - stage('Test Python 3.8.0') { + stage('Test Ubuntu Baseline') { agent { dockerfile { dir 'src/tests' - filename 'python-380.Dockerfile' + filename 'ubuntu-baseline.Dockerfile' } } steps { ansiColor(colorMapName: 'xterm') { - dir("tempsrc") { deleteDir() } - dir("tempsrc") { sh 'ls -la' } - // Avoid git chowning .git/index to root which will cause the next build to fail - // Work around old docker version in jenkins that can't change cwd: - sh 'cd tempsrc && ../src/tests/run_jenkins_tests.sh 3.8.0' - dir("tempsrc") { deleteDir() } + dir("scratch") { deleteDir() } + dir("scratch") { + sh 'ls -la' + // Avoid git chowning .git/index to root which will cause the next build to fail + sh '../src/tests/run_jenkins_tests.sh ubuntu-baseline' + deleteDir() + } } - junit '3.8.0-results.xml' + junit 'ubuntu-baseline-results.xml' } } - stage('Test Python 3.9.0') { + stage('Test Ubuntu Latest') { agent { dockerfile { dir 'src/tests' - filename 'python-390.Dockerfile' + filename 'ubuntu-latest.Dockerfile' } } steps { ansiColor(colorMapName: 'xterm') { - dir("tempsrc") { deleteDir() } - dir("tempsrc") { sh 'ls -la' } - // Avoid git chowning .git/index to root which will cause the next build to fail - // Work around old docker version in jenkins that can't change cwd: - sh 'cd tempsrc && ../src/tests/run_jenkins_tests.sh 3.9.0' - dir("tempsrc") { deleteDir() } + dir("scratch") { deleteDir() } + dir("scratch") { + sh 'ls -la' + // Avoid git chowning .git/index to root which will cause the next build to fail + sh '../src/tests/run_jenkins_tests.sh ubuntu-latest' + deleteDir() + } } - junit '3.9.0-results.xml' - } - } - stage('Test Python RC') { - agent { - dockerfile { - dir 'src/tests' - filename 'python-rc.Dockerfile' - } - } - steps { - ansiColor(colorMapName: 'xterm') { - dir("tempsrc") { deleteDir() } - dir("tempsrc") { sh 'ls -la' } - // Avoid git chowning .git/index to root which will cause the next build to fail - // Work around old docker version in jenkins that can't change cwd: - sh 'cd tempsrc && ../src/tests/run_jenkins_tests.sh rc' - dir("tempsrc") { deleteDir() } - } - junit 'rc-results.xml' - } - } - stage('Test Ubuntu 18.04') { - agent { - dockerfile { - dir 'src/tests' - filename 'ubuntu.Dockerfile' - } - } - steps { - ansiColor(colorMapName: 'xterm') { - dir("tempsrc") { deleteDir() } - dir("tempsrc") { sh 'ls -la' } - // Avoid git chowning .git/index to root which will cause the next build to fail - // Work around old docker version in jenkins that can't change cwd: - sh 'cd tempsrc && ../src/tests/run_jenkins_tests.sh ubuntu' - dir("tempsrc") { deleteDir() } - } - junit 'ubuntu-results.xml' + junit 'ubuntu-latest-results.xml' } } } diff --git a/README.md b/README.md index e137c12dc..88439799a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# `cheribuild.py` - A script to build CHERI-related software (**requires Python 3.6+**) +# `cheribuild.py` - A script to build CHERI-related software (**requires Python 3.8+**) This script automates all the steps required to build various [CHERI](http://www.chericpu.com)-related software. For example `cheribuild.py [options] sdk-riscv64-purecap` will create an SDK that can be diff --git a/pycheribuild/projects/cross/cheribsd.py b/pycheribuild/projects/cross/cheribsd.py index 1280d9860..8c6b87344 100644 --- a/pycheribuild/projects/cross/cheribsd.py +++ b/pycheribuild/projects/cross/cheribsd.py @@ -51,6 +51,7 @@ MakeCommandKind, MakeOptions, Project, + ReuseOtherProjectBuildDir, ReuseOtherProjectRepository, ) from ..simple_project import SimpleProject, TargetAliasWithDependencies, _clear_line_sequence, flush_stdio @@ -72,11 +73,6 @@ def inner(config: CheriConfig, project: Project): return ComputedDefaultValue(function=inner, as_string="$INSTALL_ROOT/" + prefix + "-") -def freebsd_reuse_build_dir(config: CheriConfig, project: "SimpleProject") -> Path: - build_freebsd = BuildFreeBSD.get_instance(project, config) - return build_freebsd.default_build_dir(config, build_freebsd) - - def cheribsd_reuse_build_dir(config: CheriConfig, project: "SimpleProject") -> Path: build_cheribsd = BuildCHERIBSD.get_instance(project, config) return build_cheribsd.default_build_dir(config, build_cheribsd) @@ -1875,7 +1871,7 @@ def setup_config_options(cls, kernel_only_target=False, install_directory_help=N _allow_unknown_targets=True, only_add_for_targets=cls.purecap_kernel_targets, kind=KernelABI, - default=KernelABI.HYBRID, + default=KernelABI.PURECAP, enum_choices=[KernelABI.HYBRID, KernelABI.PURECAP], help="Select default kernel to build", ) @@ -2272,9 +2268,7 @@ class BuildFreeBSDRelease(BuildFreeBSDReleaseMixin, BuildFreeBSD): dependencies: "tuple[str, ...]" = ("freebsd",) repository: ReuseOtherProjectRepository = ReuseOtherProjectRepository(source_project=BuildFreeBSD) _always_add_suffixed_targets: bool = True - default_build_dir: ComputedDefaultValue[Path] = ComputedDefaultValue( - function=freebsd_reuse_build_dir, as_string=lambda cls: BuildFreeBSD.project_build_dir_help() - ) + _build_dir: ReuseOtherProjectBuildDir = ReuseOtherProjectBuildDir(build_project=BuildFreeBSD) _default_install_dir_fn: ComputedDefaultValue[Path] = _arch_suffixed_custom_install_dir("freebsd-release") # We want the FreeBSD config options as well so the release installworld, # distributeworld etc. calls match what was built. @@ -2286,9 +2280,7 @@ class BuildCheriBSDRelease(BuildFreeBSDReleaseMixin, BuildCHERIBSD): dependencies: "tuple[str, ...]" = ("cheribsd",) repository: ReuseOtherProjectRepository = ReuseOtherProjectRepository(source_project=BuildCHERIBSD) _always_add_suffixed_targets: bool = True - default_build_dir: ComputedDefaultValue[Path] = ComputedDefaultValue( - function=cheribsd_reuse_build_dir, as_string=lambda cls: BuildCHERIBSD.project_build_dir_help() - ) + _build_dir: ReuseOtherProjectBuildDir = ReuseOtherProjectBuildDir(build_project=BuildCHERIBSD) _default_install_dir_fn: ComputedDefaultValue[Path] = _arch_suffixed_custom_install_dir("cheribsd-release") # We want the CheriBSD config options as well so the release installworld, # distributeworld etc. calls match what was built. diff --git a/pycheribuild/projects/docker_adduser.py b/pycheribuild/projects/docker_adduser.py index f8423d7b7..947465c01 100644 --- a/pycheribuild/projects/docker_adduser.py +++ b/pycheribuild/projects/docker_adduser.py @@ -42,7 +42,7 @@ class DockerAdduser(SimpleProject): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - self.build_dir = self.config.build_root / (self.target + "-build") + self._initial_build_dir = self.config.build_root / (self.target + "-build") def process(self): if not self.build_dir.is_dir(): diff --git a/pycheribuild/projects/project.py b/pycheribuild/projects/project.py index aa3fe42d3..15f2f1d2e 100644 --- a/pycheribuild/projects/project.py +++ b/pycheribuild/projects/project.py @@ -53,7 +53,7 @@ SubversionRepository, TargetBranchInfo, ) -from .simple_project import SimpleProject, _default_stdout_filter +from .simple_project import ReuseOtherProjectBuildDir, SimpleProject, _default_stdout_filter from ..config.chericonfig import BuildType, CheriConfig, ComputedDefaultValue, Linkage, supported_build_type_strings from ..config.config_loader_base import ConfigOptionHandle from ..config.target_info import ( @@ -101,6 +101,7 @@ "MakefileProject", "MercurialRepository", "Project", + "ReuseOtherProjectBuildDir", "ReuseOtherProjectDefaultTargetRepository", "ReuseOtherProjectRepository", "SubversionRepository", @@ -117,6 +118,9 @@ def install_dir_not_specified(_: CheriConfig, project: "Project"): def _default_build_dir(_: CheriConfig, project: "SimpleProject"): assert isinstance(project, Project) + if project._build_dir is not None and isinstance(project._build_dir, ReuseOtherProjectBuildDir): + # For projects that reuse other source directories, we return None to use the default for the source project. + return None return project.build_dir_for_target(project.crosscompile_target) @@ -475,10 +479,6 @@ def generate_cmakelists(self): def get_source_dir(cls, caller: AbstractProject, cross_target: "Optional[CrossCompileTarget]" = None) -> Path: return cls._get_instance_no_setup(caller, cross_target).source_dir - @classmethod - def get_build_dir(cls, caller: AbstractProject, cross_target: "Optional[CrossCompileTarget]" = None) -> Path: - return cls._get_instance_no_setup(caller, cross_target).build_dir - @classmethod def get_install_dir(cls, caller: AbstractProject, cross_target: "Optional[CrossCompileTarget]" = None) -> Path: return cls._get_instance_no_setup(caller, cross_target).real_install_root_dir @@ -641,7 +641,7 @@ def setup_config_options(cls, install_directory_help="", **kwargs) -> None: # supported target). default_xtarget = cls.default_architecture if cls._xtarget is not None or default_xtarget is not None: - cls.build_dir = cls.add_path_option( + cls._initial_build_dir = cls.add_path_option( "build-directory", metavar="DIR", default=cls.default_build_dir, @@ -940,7 +940,7 @@ def __init__(self, *args, **kwargs) -> None: assert not self.build_via_symlink_farm, "Using a symlink farm only makes sense with a separate build dir" if self.config.debug_output: self.info("Cannot build", self.target, "in a separate build dir, will build in", self.source_dir) - self.build_dir = self.source_dir + self._initial_build_dir = self.source_dir self.configure_command = None # non-assignable variables: diff --git a/pycheribuild/projects/repository.py b/pycheribuild/projects/repository.py index 2483e4622..25d3462c8 100644 --- a/pycheribuild/projects/repository.py +++ b/pycheribuild/projects/repository.py @@ -94,12 +94,12 @@ def __init__( source_project: "type[Project]", *, subdirectory=".", - repo_for_target: "Optional[CrossCompileTarget]" = None, + dir_for_target: "Optional[CrossCompileTarget]" = None, do_update=False, ): self.source_project = source_project self.subdirectory = subdirectory - self.repo_for_target = repo_for_target + self.dir_for_target = dir_for_target self.do_update = do_update def ensure_cloned(self, current_project: "Project", **kwargs) -> None: @@ -118,11 +118,11 @@ def ensure_cloned(self, current_project: "Project", **kwargs) -> None: def get_real_source_dir(self, caller: SimpleProject, base_project_source_dir: Optional[Path]) -> Path: if base_project_source_dir is not None: return base_project_source_dir - return self.source_project.get_source_dir(caller, cross_target=self.repo_for_target) / self.subdirectory + return self.source_project.get_source_dir(caller, cross_target=self.dir_for_target) / self.subdirectory def update(self, current_project: "Project", *, src_dir: Path, **kwargs): if self.do_update: - src_proj = self.source_project.get_instance(current_project, cross_target=self.repo_for_target) + src_proj = self.source_project.get_instance(current_project, cross_target=self.dir_for_target) src_proj.update() else: current_project.info( @@ -143,7 +143,7 @@ def __init__(self, source_project: "type[Project]", *, subdirectory=".", do_upda source_project, subdirectory=subdirectory, do_update=do_update, - repo_for_target=xtarget, + dir_for_target=xtarget, ) diff --git a/pycheribuild/projects/simple_project.py b/pycheribuild/projects/simple_project.py index 6a9aac7f7..a9ee6bfc4 100644 --- a/pycheribuild/projects/simple_project.py +++ b/pycheribuild/projects/simple_project.py @@ -254,6 +254,26 @@ def __get__(self, instance: "SimpleProject", owner: "type[SimpleProject]"): return ValueError("Should have been replaced!") +class ReuseOtherProjectBuildDir: + def __init__( + self, + build_project: "type[SimpleProject]", + *, + subdirectory=".", + dir_for_target: "Optional[CrossCompileTarget]" = None, + do_update=False, + ): + self.build_project = build_project + self.subdirectory = subdirectory + self.dir_for_target = dir_for_target + self.do_update = do_update + + def get_real_build_dir(self, caller: "SimpleProject", base_project_build_dir: Optional[Path]) -> Path: + if base_project_build_dir is not None: + return base_project_build_dir + return self.build_project.get_build_dir(caller, cross_target=self.dir_for_target) / self.subdirectory + + if typing.TYPE_CHECKING: def BoolConfigOption( # noqa: N802 @@ -374,7 +394,6 @@ class SimpleProject(AbstractProject, metaclass=ABCMeta if typing.TYPE_CHECKING e # freebsd-freebsd-amd64, etc.) include_os_in_target_suffix: bool = True source_dir: Optional[Path] = None - build_dir: Optional[Path] = None install_dir: Optional[Path] = None build_dir_suffix: str = "" # add a suffix to the build dir (e.g. for freebsd-with-bootstrap-clang) use_asan: bool = False @@ -406,6 +425,12 @@ class SimpleProject(AbstractProject, metaclass=ABCMeta if typing.TYPE_CHECKING e __checked_pkg_config: "dict[str, InstallInstructions]" = {} custom_target_name: "Optional[typing.Callable[[str, CrossCompileTarget], str]]" = None + _build_dir: Optional[Path] = None + _initial_build_dir: Optional[Path] = None + + @classmethod + def get_build_dir(cls, caller: AbstractProject, cross_target: "Optional[CrossCompileTarget]" = None) -> Path: + return cls._get_instance_no_setup(caller, cross_target).build_dir @classmethod def is_toolchain_target(cls) -> bool: @@ -1064,6 +1089,19 @@ def __init__(self, config: CheriConfig, *, crosscompile_target: CrossCompileTarg self._setup_late_called = False self._last_stdout_line_can_be_overwritten = False assert not hasattr(self, "gitBranch"), "gitBranch must not be used: " + self.__class__.__name__ + if self._build_dir is not None: + assert isinstance(self._build_dir, ReuseOtherProjectBuildDir) + initial_build_dir = inspect.getattr_static(self, "_initial_build_dir") + assert isinstance(initial_build_dir, ConfigOptionHandle) + # noinspection PyProtectedMember + assert ( + initial_build_dir._get_default_value(self.config, self) is None + ), "initial build dir != None for ReuseOtherProjectBuildDir" + self._initial_build_dir = self._build_dir.get_real_build_dir(self, self._initial_build_dir) + + @property + def build_dir(self) -> Path: + return self._initial_build_dir def setup(self) -> None: """ diff --git a/tests/python-360.Dockerfile b/tests/python-360.Dockerfile deleted file mode 100644 index e1fe8db53..000000000 --- a/tests/python-360.Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM python:3.6.0 - -LABEL maintainer="Alexander.Richardson@cl.cam.ac.uk" - -COPY requirements.txt /tmp/requirements.txt -RUN pip install -r /tmp/requirements.txt && rm -f /tmp/requirements.txt - -# setting Git username and email for workaround of -# https://github.com/jenkinsci/docker/issues/519 -ENV GIT_COMMITTER_NAME cheribuild -ENV GIT_COMMITTER_EMAIL cheribuild@cl.cam.ac.uk diff --git a/tests/python-370.Dockerfile b/tests/python-370.Dockerfile deleted file mode 100644 index 43c52d332..000000000 --- a/tests/python-370.Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM python:3.7.0 -LABEL maintainer="Alexander.Richardson@cl.cam.ac.uk" - -COPY requirements.txt /tmp/requirements.txt -RUN pip install -r /tmp/requirements.txt && rm -f /tmp/requirements.txt - -# setting Git username and email for workaround of -# https://github.com/jenkinsci/docker/issues/519 -ENV GIT_COMMITTER_NAME cheribuild -ENV GIT_COMMITTER_EMAIL cheribuild@cl.cam.ac.uk diff --git a/tests/python-390.Dockerfile b/tests/python-390.Dockerfile deleted file mode 100644 index 5dc69d25e..000000000 --- a/tests/python-390.Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM python:3.9.0 -LABEL maintainer="Alexander.Richardson@cl.cam.ac.uk" - -COPY requirements.txt /tmp/requirements.txt -RUN pip install -r /tmp/requirements.txt && rm -f /tmp/requirements.txt - -# setting Git username and email for workaround of -# https://github.com/jenkinsci/docker/issues/519 -ENV GIT_COMMITTER_NAME cheribuild -ENV GIT_COMMITTER_EMAIL cheribuild@cl.cam.ac.uk diff --git a/tests/python-380.Dockerfile b/tests/python-baseline.Dockerfile similarity index 68% rename from tests/python-380.Dockerfile rename to tests/python-baseline.Dockerfile index c02fc887e..25cf33ffe 100644 --- a/tests/python-380.Dockerfile +++ b/tests/python-baseline.Dockerfile @@ -1,8 +1,6 @@ FROM python:3.8.0 -LABEL maintainer="Alexander.Richardson@cl.cam.ac.uk" -COPY requirements.txt /tmp/requirements.txt -RUN pip install -r /tmp/requirements.txt && rm -f /tmp/requirements.txt +LABEL maintainer="Alexander.Richardson@cl.cam.ac.uk" # setting Git username and email for workaround of # https://github.com/jenkinsci/docker/issues/519 diff --git a/tests/python-rc.Dockerfile b/tests/python-latest.Dockerfile similarity index 64% rename from tests/python-rc.Dockerfile rename to tests/python-latest.Dockerfile index 16151b6eb..e25d4c10f 100644 --- a/tests/python-rc.Dockerfile +++ b/tests/python-latest.Dockerfile @@ -1,10 +1,7 @@ -FROM python:rc +FROM python:latest LABEL maintainer="Alexander.Richardson@cl.cam.ac.uk" -COPY requirements.txt /tmp/requirements.txt -RUN pip install -r /tmp/requirements.txt && rm -f /tmp/requirements.txt - # setting Git username and email for workaround of # https://github.com/jenkinsci/docker/issues/519 ENV GIT_COMMITTER_NAME cheribuild diff --git a/tests/run_jenkins_tests.sh b/tests/run_jenkins_tests.sh index 87b9d58fb..b1fa24c87 100755 --- a/tests/run_jenkins_tests.sh +++ b/tests/run_jenkins_tests.sh @@ -1,10 +1,10 @@ #!/usr/bin/env bash -pytest_binary="python3 -m pytest" - +set -e +set -x -case $1 in - 3.6.0|3.7.0|3.8.0|3.9.0|rc|ubuntu) +case $1 in + baseline|latest|ubuntu-baseline|ubuntu-latest) test_prefix=$1 ;; *) @@ -13,27 +13,39 @@ case $1 in ;; esac -_srcdir=../src -set -e -set -x +test_results="$PWD/../$test_prefix-results.xml" + +if [ "${HOME:-/}" = "/" ]; then + export HOME="$PWD/home" + mkdir "$HOME" +fi export CHERIBUILD_DEBUG=1 # Copy cheribuild to a temporary director +_srcdir=../src if command -v git >/dev/null && [[ -z "$FORCE_RUN" ]]; then echo "GIT IS INSTALLED, copying to tempdir to avoid chowning files to root" if [[ -e ".git" ]]; then echo ".git already exists, cannot continue!"; exit 1 fi - git clone "$_srcdir" "." < /dev/null + git clone "$_srcdir" "src" < /dev/null + cd src else cd "$_srcdir" fi +if ! PIP_BREAK_SYSTEM_PACKAGES=1 python3 -m pip install --user -r requirements.txt; then + echo "FATAL: could not install requirements" + exit 1 +fi + +pytest_binary="python3 -m pytest" + # Run unit tests -rm -f "../$test_prefix-results.xml" -$pytest_binary -v --junit-xml "../$test_prefix-results.xml" tests || echo "Some tests failed" -if [ ! -e "../$test_prefix-results.xml" ]; then +rm -f "$test_results" +$pytest_binary -v --junit-xml "$test_results" tests || echo "Some tests failed" +if [ ! -e "$test_results" ]; then echo "FATAL: could not find test results xml" exit 1 fi diff --git a/tests/test_argument_parsing.py b/tests/test_argument_parsing.py index fcf751646..6a2eb4f04 100644 --- a/tests/test_argument_parsing.py +++ b/tests/test_argument_parsing.py @@ -528,7 +528,7 @@ def test_kernconf(): freebsd_native = _get_target_instance("freebsd-amd64", config, BuildFreeBSD) assert config.freebsd_kernconf is None assert freebsd_riscv.kernel_config == "QEMU" - assert cheribsd_riscv_hybrid.kernel_config == "CHERI-QEMU" + assert cheribsd_riscv_hybrid.kernel_config == "CHERI-PURECAP-QEMU" assert freebsd_native.kernel_config == "GENERIC" # Check that --kernconf is used as the fallback @@ -816,20 +816,23 @@ def test_disk_image_path(target, expected_name): pytest.param( "cheribsd-riscv64-purecap", ["--cheribsd/no-build-alternate-abi-kernels"], - ["CHERI-QEMU"], + ["CHERI-PURECAP-QEMU"], ), pytest.param( "cheribsd-riscv64-purecap", ["--cheribsd/build-fpga-kernels"], [ - "CHERI-QEMU", "CHERI-PURECAP-QEMU", + "CHERI-QEMU", ], ), pytest.param( "cheribsd-riscv64-purecap", [], - ["CHERI-QEMU", "CHERI-PURECAP-QEMU"], + [ + "CHERI-PURECAP-QEMU", + "CHERI-QEMU", + ], ), pytest.param( "cheribsd-riscv64-purecap", @@ -843,35 +846,34 @@ def test_disk_image_path(target, expected_name): "cheribsd-riscv64-purecap", ["--cheribsd/build-fett-kernels", "--cheribsd/no-build-alternate-abi-kernels"], [ - "CHERI-QEMU", - "CHERI-QEMU-FETT", + "CHERI-PURECAP-QEMU", ], ), pytest.param( "cheribsd-riscv64-purecap", ["--cheribsd/build-fett-kernels"], [ + "CHERI-PURECAP-QEMU", "CHERI-QEMU", "CHERI-QEMU-FETT", - "CHERI-PURECAP-QEMU", ], ), pytest.param( "cheribsd-riscv64-purecap", ["--cheribsd/build-bench-kernels", "--cheribsd/no-build-alternate-abi-kernels"], [ - "CHERI-QEMU", - "CHERI-QEMU-NODEBUG", + "CHERI-PURECAP-QEMU", + "CHERI-PURECAP-QEMU-NODEBUG", ], ), pytest.param( "cheribsd-riscv64-purecap", ["--cheribsd/build-bench-kernels"], [ - "CHERI-QEMU", - "CHERI-QEMU-NODEBUG", "CHERI-PURECAP-QEMU", "CHERI-PURECAP-QEMU-NODEBUG", + "CHERI-QEMU", + "CHERI-QEMU-NODEBUG", ], ), pytest.param( @@ -882,20 +884,19 @@ def test_disk_image_path(target, expected_name): "--cheribsd/no-build-alternate-abi-kernels", ], [ - "CHERI-QEMU", - "CHERI-QEMU-FETT", - "CHERI-FETT", + "CHERI-PURECAP-QEMU", + "CHERI-PURECAP-FETT", ], ), pytest.param( "cheribsd-riscv64-purecap", ["--cheribsd/build-fett-kernels", "--cheribsd/build-fpga-kernels"], [ + "CHERI-PURECAP-QEMU", "CHERI-QEMU", "CHERI-QEMU-FETT", - "CHERI-PURECAP-QEMU", - "CHERI-FETT", "CHERI-PURECAP-FETT", + "CHERI-FETT", ], ), pytest.param( @@ -906,28 +907,33 @@ def test_disk_image_path(target, expected_name): # Morello kernconf tests pytest.param("cheribsd-aarch64", [], ["GENERIC"]), pytest.param( - "cheribsd-morello-purecap", - ["--cheribsd/no-build-alternate-abi-kernels"], - ["GENERIC-MORELLO"], + "cheribsd-morello-purecap", ["--cheribsd/no-build-alternate-abi-kernels"], ["GENERIC-MORELLO-PURECAP"] ), pytest.param( "cheribsd-morello-purecap", [], - ["GENERIC-MORELLO", "GENERIC-MORELLO-PURECAP"], + [ + "GENERIC-MORELLO-PURECAP", + "GENERIC-MORELLO" + ], ), pytest.param( "cheribsd-morello-purecap", ["--cheribsd/build-benchmark-abi-kernels"], - ["GENERIC-MORELLO", "GENERIC-MORELLO-PURECAP", "GENERIC-MORELLO-PURECAP-BENCHMARK"], + [ + "GENERIC-MORELLO-PURECAP", + "GENERIC-MORELLO", + "GENERIC-MORELLO-PURECAP-BENCHMARK" + ], ), pytest.param( "cheribsd-morello-purecap", ["--cheribsd/build-benchmark-abi-kernels", "--cheribsd/build-bench-kernels"], [ - "GENERIC-MORELLO", - "GENERIC-MORELLO-NODEBUG", "GENERIC-MORELLO-PURECAP", "GENERIC-MORELLO-PURECAP-NODEBUG", + "GENERIC-MORELLO", + "GENERIC-MORELLO-NODEBUG", "GENERIC-MORELLO-PURECAP-BENCHMARK", "GENERIC-MORELLO-PURECAP-BENCHMARK-NODEBUG", ], @@ -972,19 +978,16 @@ def test_kernel_configs(target, config_options: "list[str]", expected_kernels: " "--cheribsd-mfs-root-kernel-riscv64-purecap/build-fpga-kernels", "--cheribsd-mfs-root-kernel-riscv64-purecap/no-build-alternate-abi-kernels", ], - [ - "CHERI-QEMU-MFS-ROOT", - "CHERI-GFE", - ], + ["CHERI-PURECAP-QEMU-MFS-ROOT", "CHERI-PURECAP-GFE"], ), pytest.param( "cheribsd-mfs-root-kernel-riscv64-purecap", ["--cheribsd-mfs-root-kernel-riscv64-purecap/build-fpga-kernels"], [ - "CHERI-QEMU-MFS-ROOT", "CHERI-PURECAP-QEMU-MFS-ROOT", - "CHERI-GFE", + "CHERI-QEMU-MFS-ROOT", "CHERI-PURECAP-GFE", + "CHERI-GFE", ], ), pytest.param( @@ -1010,10 +1013,10 @@ def test_kernel_configs(target, config_options: "list[str]", expected_kernels: " "cheribsd-mfs-root-kernel-riscv64-purecap", ["--cheribsd/build-nocaprevoke-kernel"], [ - "CHERI-QEMU-MFS-ROOT", - "CHERI-NOCAPREVOKE-QEMU-MFS-ROOT", "CHERI-PURECAP-QEMU-MFS-ROOT", "CHERI-PURECAP-NOCAPREVOKE-QEMU-MFS-ROOT", + "CHERI-QEMU-MFS-ROOT", + "CHERI-NOCAPREVOKE-QEMU-MFS-ROOT", ], ), ], @@ -1263,13 +1266,13 @@ def test_mfs_root_kernel_config_options(): ] config_options.sort() assert config_options == [ + "_initial_build_dir", "_initial_source_dir", "_install_dir", "_linkage", "auto_var_init", "build_alternate_abi_kernels", "build_bench_kernels", - "build_dir", "build_fett_kernels", "build_fpga_kernels", "build_nocaprevoke_kernels", @@ -1345,7 +1348,7 @@ def test_mfs_root_kernel_inherits_defaults_from_cheribsd(): ], ) assert cheribsd_riscv64_purecap.kernel_config == "BASE_CONFIG_RISCV64" - assert cheribsd_riscv64_hybrid.kernel_config == "CHERI-QEMU" + assert cheribsd_riscv64_hybrid.kernel_config == "CHERI-PURECAP-QEMU" assert mfs_riscv64.kernel_config is None assert mfs_riscv64_hybrid.kernel_config == "MFS_CONFIG_RISCV64_HYBRID" _parse_arguments( diff --git a/tests/test_async_delete.py b/tests/test_async_delete.py index ecaea061d..24b3c96a4 100644 --- a/tests/test_async_delete.py +++ b/tests/test_async_delete.py @@ -28,7 +28,7 @@ def __init__(self, config: MockConfig, name: str): self.expected_install = config.source_root / "install" / name self._install_dir = self.expected_install self.expected_build = Path(config.source_root, "build", name + "-build") - self.build_dir = self.expected_build + self._initial_build_dir = self.expected_build super().__init__(config, crosscompile_target=CompilationTargets.NATIVE) def setup(self): diff --git a/tests/ubuntu.Dockerfile b/tests/ubuntu-baseline.Dockerfile similarity index 58% rename from tests/ubuntu.Dockerfile rename to tests/ubuntu-baseline.Dockerfile index c1cd60539..912fe6439 100644 --- a/tests/ubuntu.Dockerfile +++ b/tests/ubuntu-baseline.Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:bionic-20180426 +FROM ubuntu:20.04 LABEL maintainer="Alexander.Richardson@cl.cam.ac.uk" @@ -7,6 +7,3 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ gcc \ git \ python3-minimal python3-pip python3-setuptools - -COPY requirements.txt /tmp/requirements.txt -RUN pip3 install -r /tmp/requirements.txt && rm -f /tmp/requirements.txt diff --git a/tests/ubuntu-latest.Dockerfile b/tests/ubuntu-latest.Dockerfile new file mode 100644 index 000000000..49e3dfb39 --- /dev/null +++ b/tests/ubuntu-latest.Dockerfile @@ -0,0 +1,9 @@ +FROM ubuntu:latest + +LABEL maintainer="Alexander.Richardson@cl.cam.ac.uk" + +RUN apt-get update && apt-get install -y --no-install-recommends \ + make ninja-build \ + gcc \ + git \ + python3-minimal python3-pip python3-setuptools