Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a workflow to test building from a read-only source tree #22908

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 15 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -354,21 +354,33 @@ jobs:
- name: make test
run: make test HARNESS_JOBS=${HARNESS_JOBS:-4}

out-of-source-and-install:
# out-of-source-and-install checks multiple things at the same time:
# - That building, testing and installing works from an out-of-source
# build tree
# - That building, testing and installing works with a read-only source
# tree
out-of-readonly-source-and-install:
strategy:
matrix:
os: [ubuntu-latest, macos-latest ]
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
with:
path: ./source
- name: checkout fuzz/corpora submodule
run: git submodule update --init --depth 1 fuzz/corpora
- name: extra preparations
working-directory: ./source
- name: make source read-only
run: chmod -R a-w ./source
- name: create build and install directories
run: |
mkdir ./build
mkdir ./install
- name: config
run: ../config --banner=Configured enable-fips enable-acvp-tests --strict-warnings --prefix=$(cd ../install; pwd) && perl configdata.pm --dump
run: |
../source/config --banner=Configured enable-fips enable-quic enable-acvp-tests --strict-warnings --prefix=$(cd ../install; pwd)
perl configdata.pm --dump
working-directory: ./build
- name: make
run: make -s -j4
Expand Down
34 changes: 18 additions & 16 deletions Configure
Original file line number Diff line number Diff line change
Expand Up @@ -1891,11 +1891,12 @@ if ($builder eq "unified") {
my $base = shift;
my $dir = shift;
my $relativeto = shift || ".";
my $no_mkpath = shift // 0;

$dir = catdir($base,$dir) unless isabsolute($dir);

# Make sure the directories we're building in exists
mkpath($dir);
mkpath($dir) unless $no_mkpath;

my $res = abs2rel(absolutedir($dir), rel2abs($relativeto));
#print STDERR "DEBUG[cleandir]: $dir , $base => $res\n";
Expand All @@ -1906,14 +1907,15 @@ if ($builder eq "unified") {
my $base = shift;
my $file = shift;
my $relativeto = shift || ".";
my $no_mkpath = shift // 0;

$file = catfile($base,$file) unless isabsolute($file);

my $d = dirname($file);
my $f = basename($file);

# Make sure the directories we're building in exists
mkpath($d);
mkpath($d) unless $no_mkpath;

my $res = abs2rel(catfile(absolutedir($d), $f), rel2abs($relativeto));
#print STDERR "DEBUG[cleanfile]: $d , $f => $res\n";
Expand Down Expand Up @@ -1943,7 +1945,7 @@ if ($builder eq "unified") {
}
# Then, look in our standard directory
push @build_file_templates,
( map { cleanfile($srcdir, catfile("Configurations", $_), $blddir) }
( map { cleanfile($srcdir, catfile("Configurations", $_), $blddir, 1) }
@build_file_template_names );

my $build_file_template;
Expand All @@ -1958,7 +1960,7 @@ if ($builder eq "unified") {
}
$config{build_file_templates}
= [ cleanfile($srcdir, catfile("Configurations", "common0.tmpl"),
$blddir),
$blddir, 1),
$build_file_template ];

my @build_dirs = ( [ ] ); # current directory
Expand All @@ -1967,7 +1969,7 @@ if ($builder eq "unified") {

# We want to detect configdata.pm in the source tree, so we
# don't use it if the build tree is different.
my $src_configdata = cleanfile($srcdir, "configdata.pm", $blddir);
my $src_configdata = cleanfile($srcdir, "configdata.pm", $blddir, 1);

# Any source file that we recognise is placed in this hash table, with
# the list of its intended destinations as value. When everything has
Expand Down Expand Up @@ -2320,7 +2322,7 @@ EOF
my $dest = $_;
my $ddest = cleanfile($buildd, $_, $blddir);
foreach (@{$sources{$dest}}) {
my $s = cleanfile($sourced, $_, $blddir);
my $s = cleanfile($sourced, $_, $blddir, 1);

# If it's generated or we simply don't find it in the source
# tree, we assume it's in the build tree.
Expand Down Expand Up @@ -2365,7 +2367,7 @@ EOF
my $dest = $_;
my $ddest = cleanfile($buildd, $_, $blddir);
foreach (@{$shared_sources{$dest}}) {
my $s = cleanfile($sourced, $_, $blddir);
my $s = cleanfile($sourced, $_, $blddir, 1);

# If it's generated or we simply don't find it in the source
# tree, we assume it's in the build tree.
Expand Down Expand Up @@ -2420,7 +2422,7 @@ EOF
if scalar @{$generate{$_}} > 1;
my @generator = split /\s+/, $generate{$dest}->[0];
my $gen = $generator[0];
$generator[0] = cleanfile($sourced, $gen, $blddir);
$generator[0] = cleanfile($sourced, $gen, $blddir, 1);

# If the generator is itself generated, it's in the build tree
if ($generate{$gen} || ! -f $generator[0]) {
Expand All @@ -2446,7 +2448,7 @@ EOF
} elsif ($dest eq '') {
$ddest = '';
} else {
$ddest = cleanfile($sourced, $dest, $blddir);
$ddest = cleanfile($sourced, $dest, $blddir, 1);

# If the destination doesn't exist in source, it can only be
# a generated file in the build tree.
Expand All @@ -2471,12 +2473,12 @@ EOF
&& $f =~ m/^(.*?)\|(.*)$/) {
$i = $1;
$m = $2;
$i = cleanfile($sourced, $i, $blddir);
$i = cleanfile($sourced, $i, $blddir, 1);
$i2 = cleanfile($buildd, $i, $blddir);
$d = cleanfile($sourced, "$i/$m", $blddir);
$d = cleanfile($sourced, "$i/$m", $blddir, 1);
$d2 = cleanfile($buildd, "$i/$m", $blddir);
} else {
$d = cleanfile($sourced, $f, $blddir);
$d = cleanfile($sourced, $f, $blddir, 1);
$d2 = cleanfile($buildd, $f, $blddir);
}

Expand Down Expand Up @@ -2507,15 +2509,15 @@ EOF

foreach (keys %includes) {
my $dest = $_;
my $ddest = cleanfile($sourced, $_, $blddir);
my $ddest = cleanfile($sourced, $_, $blddir, 1);

# If the destination doesn't exist in source, it can only be
# a generated file in the build tree.
if ($ddest eq $src_configdata || ! -f $ddest) {
$ddest = cleanfile($buildd, $_, $blddir);
}
foreach (@{$includes{$dest}}) {
my $is = cleandir($sourced, $_, $blddir);
my $is = cleandir($sourced, $_, $blddir, 1);
my $ib = cleandir($buildd, $_, $blddir);
push @{$unified_info{includes}->{$ddest}->{source}}, $is
unless grep { $_ eq $is } @{$unified_info{includes}->{$ddest}->{source}};
Expand All @@ -2528,7 +2530,7 @@ EOF
my $ddest;

if ($dest ne "") {
$ddest = cleanfile($sourced, $dest, $blddir);
$ddest = cleanfile($sourced, $dest, $blddir, 1);

# If the destination doesn't exist in source, it can only
# be a generated file in the build tree.
Expand Down Expand Up @@ -2912,7 +2914,7 @@ my %template_vars = (
my $configdata_outname = 'configdata.pm';
open CONFIGDATA, ">$configdata_outname.new"
or die "Trying to create $configdata_outname.new: $!";
my $configdata_tmplname = cleanfile($srcdir, "configdata.pm.in", $blddir);
my $configdata_tmplname = cleanfile($srcdir, "configdata.pm.in", $blddir, 1);
my $configdata_tmpl =
OpenSSL::Template->new(TYPE => 'FILE', SOURCE => $configdata_tmplname);
$configdata_tmpl->fill_in(
Expand Down