Skip to content

Commit

Permalink
Merge branch 'main' into benchmark-abi-kernel
Browse files Browse the repository at this point in the history
  • Loading branch information
jrtc27 committed May 21, 2024
2 parents 73deffb + ea5db9a commit aa219a9
Show file tree
Hide file tree
Showing 18 changed files with 172 additions and 191 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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: |
Expand Down
114 changes: 40 additions & 74 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
16 changes: 4 additions & 12 deletions pycheribuild/projects/cross/cheribsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
MakeCommandKind,
MakeOptions,
Project,
ReuseOtherProjectBuildDir,
ReuseOtherProjectRepository,
)
from ..simple_project import SimpleProject, TargetAliasWithDependencies, _clear_line_sequence, flush_stdio
Expand All @@ -72,11 +73,6 @@ def inner(config: CheriConfig, project: Project):
return ComputedDefaultValue(function=inner, as_string="$INSTALL_ROOT/" + prefix + "-<arch>")


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)
Expand Down Expand Up @@ -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",
)
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion pycheribuild/projects/docker_adduser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
14 changes: 7 additions & 7 deletions pycheribuild/projects/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -101,6 +101,7 @@
"MakefileProject",
"MercurialRepository",
"Project",
"ReuseOtherProjectBuildDir",
"ReuseOtherProjectDefaultTargetRepository",
"ReuseOtherProjectRepository",
"SubversionRepository",
Expand All @@ -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)


Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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:
Expand Down
10 changes: 5 additions & 5 deletions pycheribuild/projects/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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(
Expand All @@ -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,
)


Expand Down
Loading

0 comments on commit aa219a9

Please sign in to comment.