From cb297aa9f4a2e201cf50be184b6af15e424b4918 Mon Sep 17 00:00:00 2001 From: Jessica Clarke Date: Wed, 15 May 2024 19:05:19 +0100 Subject: [PATCH 01/15] repository: Rename repo_for_target to dir_for_target --- pycheribuild/projects/repository.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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, ) From 7a08b6018680caba91d8ec240c01c5f1e24e1847 Mon Sep 17 00:00:00 2001 From: Jessica Clarke Date: Wed, 15 May 2024 20:52:05 +0100 Subject: [PATCH 02/15] simple_project: Add new ReuseOtherProjectBuildDir This will be used to allow cheribsd-release to inherit cheribsd's build-directory, not just the default value. --- pycheribuild/projects/docker_adduser.py | 2 +- pycheribuild/projects/project.py | 14 ++++----- pycheribuild/projects/simple_project.py | 40 ++++++++++++++++++++++++- tests/test_argument_parsing.py | 2 +- tests/test_async_delete.py | 2 +- 5 files changed, 49 insertions(+), 11 deletions(-) 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/simple_project.py b/pycheribuild/projects/simple_project.py index 6a9aac7f7..507896d9c 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: "type[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/test_argument_parsing.py b/tests/test_argument_parsing.py index a3dcab3b5..d669d9b5a 100644 --- a/tests/test_argument_parsing.py +++ b/tests/test_argument_parsing.py @@ -1249,13 +1249,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", 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): From afea91fcaae4417835ed27bd3d5c84baec5c5c3f Mon Sep 17 00:00:00 2001 From: Jessica Clarke Date: Wed, 15 May 2024 20:55:41 +0100 Subject: [PATCH 03/15] {freebsd,cheribsd}-release: Always inherit build-directory Using the default build directory if the dependent project's has been overridden doesn't make sense, since that's the project we want to build release images from. I don't know why cheribsd-mfs-root-kernel only uses the default and has that asserted by a test case, I can't see the logic behind that being the expected behaviour, but at least that one does work either way round, so is left as is. --- pycheribuild/projects/cross/cheribsd.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/pycheribuild/projects/cross/cheribsd.py b/pycheribuild/projects/cross/cheribsd.py index 9ae563af8..d25e7caba 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) @@ -2247,9 +2243,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. @@ -2261,9 +2255,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. From 196be558b9507d41a0fc0b9394a99ae920f622b0 Mon Sep 17 00:00:00 2001 From: Brooks Davis Date: Tue, 12 Mar 2024 21:42:00 +0000 Subject: [PATCH 04/15] Re-land "Default to purecap kernels for CheriBSD" In theory Jenkins should now be happy with this default changed as it's now explicitly setting it based on what CheriBSD's Jenkinsfile does. --- pycheribuild/projects/cross/cheribsd.py | 2 +- tests/test_argument_parsing.py | 54 ++++++++++++------------- 2 files changed, 26 insertions(+), 30 deletions(-) diff --git a/pycheribuild/projects/cross/cheribsd.py b/pycheribuild/projects/cross/cheribsd.py index d25e7caba..a842f0fd2 100644 --- a/pycheribuild/projects/cross/cheribsd.py +++ b/pycheribuild/projects/cross/cheribsd.py @@ -1861,7 +1861,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", ) diff --git a/tests/test_argument_parsing.py b/tests/test_argument_parsing.py index d669d9b5a..f104c7df4 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,16 +907,14 @@ 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", ], ), pytest.param( @@ -958,19 +957,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( @@ -996,10 +992,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", ], ), ], @@ -1331,7 +1327,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( From db30c920b4e61149ea8ca0dd9a0eaf0ec93d5ff7 Mon Sep 17 00:00:00 2001 From: Jessica Clarke Date: Tue, 21 May 2024 19:12:34 +0100 Subject: [PATCH 05/15] Bump Python minimum to 3.8 and rework CI a bit Rather than testing every version, just maintain a Jenkins build for the baseline and the latest. The latter can be done automatically as there's a Docker image tagged latest, whilst the former needs a bit of manual bumping. However, there should now be fewer places that need updating with the version number. Note that officially this means Ubuntu 18.04 is not supported. However, for now, Jenkins is still using that for linux-baseline, and so we'll need to keep it working in practice until we've migrated over to 20.04, though probably we should jump straight to 22.04 for CI as 20.04 has a bit under a year left to it as well. --- .github/workflows/python-app.yml | 6 +- Jenkinsfile | 70 +++++-------------- README.md | 2 +- tests/python-370.Dockerfile | 10 --- tests/python-390.Dockerfile | 10 --- ....Dockerfile => python-baseline.Dockerfile} | 0 ...60.Dockerfile => python-latest.Dockerfile} | 2 +- tests/python-rc.Dockerfile | 11 --- tests/run_jenkins_tests.sh | 4 +- ....Dockerfile => ubuntu-baseline.Dockerfile} | 2 +- tests/ubuntu-latest.Dockerfile | 12 ++++ 11 files changed, 36 insertions(+), 93 deletions(-) delete mode 100644 tests/python-370.Dockerfile delete mode 100644 tests/python-390.Dockerfile rename tests/{python-380.Dockerfile => python-baseline.Dockerfile} (100%) rename tests/{python-360.Dockerfile => python-latest.Dockerfile} (94%) delete mode 100644 tests/python-rc.Dockerfile rename tests/{ubuntu.Dockerfile => ubuntu-baseline.Dockerfile} (92%) create mode 100644 tests/ubuntu-latest.Dockerfile 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..f9eb2c8a3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,11 +7,11 @@ 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 { @@ -20,17 +20,17 @@ pipeline { 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' + sh 'cd tempsrc && ../src/tests/run_jenkins_tests.sh baseline' dir("tempsrc") { 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 { @@ -39,17 +39,17 @@ pipeline { 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' + sh 'cd tempsrc && ../src/tests/run_jenkins_tests.sh latest' dir("tempsrc") { 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 { @@ -58,17 +58,17 @@ pipeline { 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' + sh 'cd tempsrc && ../src/tests/run_jenkins_tests.sh ubuntu-baseline' dir("tempsrc") { 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 { @@ -77,48 +77,10 @@ pipeline { 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' + sh 'cd tempsrc && ../src/tests/run_jenkins_tests.sh ubuntu-latest' dir("tempsrc") { 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/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 100% rename from tests/python-380.Dockerfile rename to tests/python-baseline.Dockerfile diff --git a/tests/python-360.Dockerfile b/tests/python-latest.Dockerfile similarity index 94% rename from tests/python-360.Dockerfile rename to tests/python-latest.Dockerfile index e1fe8db53..c76e223d1 100644 --- a/tests/python-360.Dockerfile +++ b/tests/python-latest.Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.6.0 +FROM python:latest LABEL maintainer="Alexander.Richardson@cl.cam.ac.uk" diff --git a/tests/python-rc.Dockerfile b/tests/python-rc.Dockerfile deleted file mode 100644 index 16151b6eb..000000000 --- a/tests/python-rc.Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM python:rc - -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/run_jenkins_tests.sh b/tests/run_jenkins_tests.sh index 87b9d58fb..b554c8a2c 100755 --- a/tests/run_jenkins_tests.sh +++ b/tests/run_jenkins_tests.sh @@ -3,8 +3,8 @@ pytest_binary="python3 -m pytest" -case $1 in - 3.6.0|3.7.0|3.8.0|3.9.0|rc|ubuntu) +case $1 in + baseline|latest|ubuntu) test_prefix=$1 ;; *) diff --git a/tests/ubuntu.Dockerfile b/tests/ubuntu-baseline.Dockerfile similarity index 92% rename from tests/ubuntu.Dockerfile rename to tests/ubuntu-baseline.Dockerfile index c1cd60539..7f77f1a25 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" diff --git a/tests/ubuntu-latest.Dockerfile b/tests/ubuntu-latest.Dockerfile new file mode 100644 index 000000000..0f99c5350 --- /dev/null +++ b/tests/ubuntu-latest.Dockerfile @@ -0,0 +1,12 @@ +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 + +COPY requirements.txt /tmp/requirements.txt +RUN pip3 install -r /tmp/requirements.txt && rm -f /tmp/requirements.txt From 78f802394eee2e9ca3363bc16925b1aedf900028 Mon Sep 17 00:00:00 2001 From: Jessica Clarke Date: Tue, 21 May 2024 19:42:19 +0100 Subject: [PATCH 06/15] Fix typing error Fixes: 7a08b6018680 ("simple_project: Add new ReuseOtherProjectBuildDir") --- pycheribuild/projects/simple_project.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pycheribuild/projects/simple_project.py b/pycheribuild/projects/simple_project.py index 507896d9c..a9ee6bfc4 100644 --- a/pycheribuild/projects/simple_project.py +++ b/pycheribuild/projects/simple_project.py @@ -268,7 +268,7 @@ def __init__( self.dir_for_target = dir_for_target self.do_update = do_update - def get_real_build_dir(self, caller: "type[SimpleProject]", base_project_build_dir: Optional[Path]) -> Path: + 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 From 4bc0f72f039dc012d07a2f51bf13a98573982cca Mon Sep 17 00:00:00 2001 From: Jessica Clarke Date: Tue, 21 May 2024 20:19:59 +0100 Subject: [PATCH 07/15] run_jenkins_tests: Fix set of expected prefixes Fixes: db30c920b4e6 ("Bump Python minimum to 3.8 and rework CI a bit") --- tests/run_jenkins_tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/run_jenkins_tests.sh b/tests/run_jenkins_tests.sh index b554c8a2c..aacee707e 100755 --- a/tests/run_jenkins_tests.sh +++ b/tests/run_jenkins_tests.sh @@ -4,7 +4,7 @@ pytest_binary="python3 -m pytest" case $1 in - baseline|latest|ubuntu) + baseline|latest|ubuntu-baseline|ubuntu-latest) test_prefix=$1 ;; *) From fd9cbc46a4b586feb075d9ae48cd7abd19fb0077 Mon Sep 17 00:00:00 2001 From: Jessica Clarke Date: Tue, 21 May 2024 20:29:52 +0100 Subject: [PATCH 08/15] tests: Run pip3 install with --user for Ubuntu Modern Ubuntu errors out if you pip3 install system-wide without passing --break-system-packages. We could add that flag, but we can just install them for the current user instead (which more closely matches how actual users will use cheribuild anyway). Although our current baseline doesn't require this, be consistent and do it there too. Fixes: db30c920b4e6 ("Bump Python minimum to 3.8 and rework CI a bit") --- tests/ubuntu-baseline.Dockerfile | 2 +- tests/ubuntu-latest.Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/ubuntu-baseline.Dockerfile b/tests/ubuntu-baseline.Dockerfile index 7f77f1a25..517255cf7 100644 --- a/tests/ubuntu-baseline.Dockerfile +++ b/tests/ubuntu-baseline.Dockerfile @@ -9,4 +9,4 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ python3-minimal python3-pip python3-setuptools COPY requirements.txt /tmp/requirements.txt -RUN pip3 install -r /tmp/requirements.txt && rm -f /tmp/requirements.txt +RUN pip3 install --user -r /tmp/requirements.txt && rm -f /tmp/requirements.txt diff --git a/tests/ubuntu-latest.Dockerfile b/tests/ubuntu-latest.Dockerfile index 0f99c5350..6f1d019bc 100644 --- a/tests/ubuntu-latest.Dockerfile +++ b/tests/ubuntu-latest.Dockerfile @@ -9,4 +9,4 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ python3-minimal python3-pip python3-setuptools COPY requirements.txt /tmp/requirements.txt -RUN pip3 install -r /tmp/requirements.txt && rm -f /tmp/requirements.txt +RUN pip3 install --user -r /tmp/requirements.txt && rm -f /tmp/requirements.txt From 5d57c392766377b4e31a46294f8471a632f697ab Mon Sep 17 00:00:00 2001 From: Jessica Clarke Date: Tue, 21 May 2024 21:03:23 +0100 Subject: [PATCH 09/15] tests: Shift pip install to run_jenkins_tests Otherwise it's run as root rather than whatever user is being used inside the container. --- tests/python-baseline.Dockerfile | 4 +--- tests/python-latest.Dockerfile | 3 --- tests/run_jenkins_tests.sh | 10 +++++++--- tests/ubuntu-baseline.Dockerfile | 3 --- tests/ubuntu-latest.Dockerfile | 3 --- 5 files changed, 8 insertions(+), 15 deletions(-) diff --git a/tests/python-baseline.Dockerfile b/tests/python-baseline.Dockerfile index c02fc887e..25cf33ffe 100644 --- a/tests/python-baseline.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-latest.Dockerfile b/tests/python-latest.Dockerfile index c76e223d1..e25d4c10f 100644 --- a/tests/python-latest.Dockerfile +++ b/tests/python-latest.Dockerfile @@ -2,9 +2,6 @@ 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 aacee707e..1f189a2fb 100755 --- a/tests/run_jenkins_tests.sh +++ b/tests/run_jenkins_tests.sh @@ -1,8 +1,5 @@ #!/usr/bin/env bash -pytest_binary="python3 -m pytest" - - case $1 in baseline|latest|ubuntu-baseline|ubuntu-latest) test_prefix=$1 @@ -30,6 +27,13 @@ else cd "$_srcdir" fi +if ! 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" diff --git a/tests/ubuntu-baseline.Dockerfile b/tests/ubuntu-baseline.Dockerfile index 517255cf7..912fe6439 100644 --- a/tests/ubuntu-baseline.Dockerfile +++ b/tests/ubuntu-baseline.Dockerfile @@ -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 --user -r /tmp/requirements.txt && rm -f /tmp/requirements.txt diff --git a/tests/ubuntu-latest.Dockerfile b/tests/ubuntu-latest.Dockerfile index 6f1d019bc..49e3dfb39 100644 --- a/tests/ubuntu-latest.Dockerfile +++ b/tests/ubuntu-latest.Dockerfile @@ -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 --user -r /tmp/requirements.txt && rm -f /tmp/requirements.txt From 37a6b79b9ef968835e4486443e3cb56028e304a2 Mon Sep 17 00:00:00 2001 From: Jessica Clarke Date: Tue, 21 May 2024 21:22:34 +0100 Subject: [PATCH 10/15] Make sure we have a sensible HOME when running in Jenkins Otherwise pip tries to install to /.local which goes as well as one would expect. Since this is messing with the tempsrc code, this also cleans up that. I suspect what was previously happening was deleteDir() could not be followed by something else inside the dir(...), as it wouldn't then create the directory again. --- Jenkinsfile | 52 ++++++++++++++++++++------------------ tests/run_jenkins_tests.sh | 10 ++++++-- 2 files changed, 36 insertions(+), 26 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index f9eb2c8a3..941f9a0a2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,12 +16,13 @@ pipeline { } 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 baseline' - 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 'baseline-results.xml' } @@ -35,12 +36,13 @@ pipeline { } 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 latest' - 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 'latest-results.xml' } @@ -54,12 +56,13 @@ pipeline { } 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-baseline' - 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 'ubuntu-baseline-results.xml' } @@ -73,12 +76,13 @@ pipeline { } 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-latest' - 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 'ubuntu-latest-results.xml' } diff --git a/tests/run_jenkins_tests.sh b/tests/run_jenkins_tests.sh index 1f189a2fb..8f0c81535 100755 --- a/tests/run_jenkins_tests.sh +++ b/tests/run_jenkins_tests.sh @@ -10,19 +10,25 @@ case $1 in ;; esac -_srcdir=../src set -e set -x +if [ -z "${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 From d8e670f4e023233e36fc76c4fac221e8286735ef Mon Sep 17 00:00:00 2001 From: Jessica Clarke Date: Tue, 21 May 2024 21:30:57 +0100 Subject: [PATCH 11/15] tests: HOME is / not empty in CI, weirdly --- tests/run_jenkins_tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/run_jenkins_tests.sh b/tests/run_jenkins_tests.sh index 8f0c81535..6ddd479b2 100755 --- a/tests/run_jenkins_tests.sh +++ b/tests/run_jenkins_tests.sh @@ -13,7 +13,7 @@ esac set -e set -x -if [ -z "${HOME:-}" ]; then +if [ "${HOME:-/}" = "/" ]; then export HOME="$PWD/home" mkdir "$HOME" fi From e8223cf9acd6fe568becc7c1c6841f09c1195be7 Mon Sep 17 00:00:00 2001 From: Jessica Clarke Date: Tue, 21 May 2024 21:36:50 +0100 Subject: [PATCH 12/15] tests: Shut pip up about breaking system packages In their infinite wisdom the Python developers made even --user fail despite being an extremely normal thing for people to use with no good alternative. Set PIP_BREAK_SYSTEM_PACKAGES=1 in the environment to shut it up once and for all. --break-system-packages probably works too but I've already wasted enough time dealing with this insanity and don't want to have to figure out if that flag is too new for the baseline we support. --- tests/run_jenkins_tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/run_jenkins_tests.sh b/tests/run_jenkins_tests.sh index 6ddd479b2..f4179eaca 100755 --- a/tests/run_jenkins_tests.sh +++ b/tests/run_jenkins_tests.sh @@ -33,7 +33,7 @@ else cd "$_srcdir" fi -if ! python3 -m pip install --user -r requirements.txt; then +if ! PIP_BREAK_SYSTEM_PACKAGES=1 python3 -m pip install --user -r requirements.txt; then echo "FATAL: could not install requirements" exit 1 fi From 48277b1691178d001a1f4f200a46d8551db265c8 Mon Sep 17 00:00:00 2001 From: Jessica Clarke Date: Tue, 21 May 2024 21:48:06 +0100 Subject: [PATCH 13/15] run_jenkins_tests: Put test results in the expected location Now that we clone to a subdirectory the relative path is wrong. --- tests/run_jenkins_tests.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/run_jenkins_tests.sh b/tests/run_jenkins_tests.sh index f4179eaca..fdf496300 100755 --- a/tests/run_jenkins_tests.sh +++ b/tests/run_jenkins_tests.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +set -e +set -x + case $1 in baseline|latest|ubuntu-baseline|ubuntu-latest) test_prefix=$1 @@ -10,8 +13,7 @@ case $1 in ;; esac -set -e -set -x +test_results="$PWD/$test_prefix-results.xml" if [ "${HOME:-/}" = "/" ]; then export HOME="$PWD/home" @@ -41,9 +43,9 @@ fi pytest_binary="python3 -m pytest" # Run unit tests -rm -f "../$test_prefix-results.xml" +rm -f "$test_results" $pytest_binary -v --junit-xml "../$test_prefix-results.xml" tests || echo "Some tests failed" -if [ ! -e "../$test_prefix-results.xml" ]; then +if [ ! -e "$test_results" ]; then echo "FATAL: could not find test results xml" exit 1 fi From 14257fbd269f3f34385084607947964da1d1d725 Mon Sep 17 00:00:00 2001 From: Jessica Clarke Date: Tue, 21 May 2024 21:54:27 +0100 Subject: [PATCH 14/15] run_jenkins_tests: Actually use the right test results path --- tests/run_jenkins_tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/run_jenkins_tests.sh b/tests/run_jenkins_tests.sh index fdf496300..e2ea49856 100755 --- a/tests/run_jenkins_tests.sh +++ b/tests/run_jenkins_tests.sh @@ -13,7 +13,7 @@ case $1 in ;; esac -test_results="$PWD/$test_prefix-results.xml" +test_results="$PWD/../$test_prefix-results.xml" if [ "${HOME:-/}" = "/" ]; then export HOME="$PWD/home" From ea5db9a0ad242e529ccaad6e073ad56c42e8d72d Mon Sep 17 00:00:00 2001 From: Jessica Clarke Date: Tue, 21 May 2024 22:01:56 +0100 Subject: [PATCH 15/15] run_jenkins_tests: Missed a place for $test_results... --- tests/run_jenkins_tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/run_jenkins_tests.sh b/tests/run_jenkins_tests.sh index e2ea49856..b1fa24c87 100755 --- a/tests/run_jenkins_tests.sh +++ b/tests/run_jenkins_tests.sh @@ -44,7 +44,7 @@ pytest_binary="python3 -m pytest" # Run unit tests rm -f "$test_results" -$pytest_binary -v --junit-xml "../$test_prefix-results.xml" tests || echo "Some tests failed" +$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