add wip buildscripts for automated experiment execution
This commit is contained in:
72
scripts/build.pl
Executable file
72
scripts/build.pl
Executable file
@ -0,0 +1,72 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use diagnostics;
|
||||
|
||||
use feature 'say';
|
||||
|
||||
my $local_root = '/home/christoph/Notes/TU/MastersThesis/FailNix';
|
||||
my $local_builds_dir = "$local_root/builds";
|
||||
my $local_experiments_dir = "$local_root/targets/wasm-module";
|
||||
my $justbin = "$local_root/just-bin/just";
|
||||
my $justfile = "$local_root/scripts/nixos.just";
|
||||
|
||||
my @targets = ( "fail", "linux", "linux-baremetal" );
|
||||
my @modes = ( "c", "aot", "interp" );
|
||||
|
||||
sub just {
|
||||
say "Running: just @_...";
|
||||
system("$justbin -d $local_root -f $justfile @_")
|
||||
and die "Build failed";
|
||||
}
|
||||
|
||||
die "Please archive or delete old experiments before building"
|
||||
if ( -d $local_builds_dir );
|
||||
|
||||
# Find experiments
|
||||
opendir( my $dhandle, $local_experiments_dir )
|
||||
or die "opendir$local_experiments_dir): $!";
|
||||
my @experiments =
|
||||
map { s/\.cpp//r } grep { -f "$local_experiments_dir/$_" } readdir($dhandle);
|
||||
closedir($dhandle);
|
||||
|
||||
# Select experiments
|
||||
say "Experiments:";
|
||||
foreach (@experiments) { say " - $_"; }
|
||||
print "Enter single experiment name, comma-separated list or \"all\": ";
|
||||
my $experiment_sel = <STDIN>;
|
||||
chomp $experiment_sel;
|
||||
my @selected_experiments =
|
||||
$experiment_sel eq "all" ? @experiments : split( ',', $experiment_sel );
|
||||
|
||||
# Select targets
|
||||
say "Targets:";
|
||||
foreach (@targets) { say " - $_"; }
|
||||
print "Enter single target, comma-separated list or \"all\": ";
|
||||
my $target_sel = <STDIN>;
|
||||
chomp $target_sel;
|
||||
my @selected_targets =
|
||||
$target_sel eq "all" ? @targets : split( ',', $target_sel );
|
||||
|
||||
# Select modes
|
||||
say "Modes:";
|
||||
foreach (@modes) { say " - $_"; }
|
||||
print "Enter single mode, comma-separated list or \"all\": ";
|
||||
my $mode_sel = <STDIN>;
|
||||
chomp $mode_sel;
|
||||
my @selected_modes = $mode_sel eq "all" ? @modes : split( ',', $mode_sel );
|
||||
|
||||
# Build everything
|
||||
system( "mkdir", "-p", "$local_builds_dir" );
|
||||
foreach my $experiment (@selected_experiments) {
|
||||
foreach my $target (@selected_targets) {
|
||||
foreach my $mode (@selected_modes) {
|
||||
just( "build", $experiment, $target, $mode );
|
||||
system(
|
||||
"mv $local_root/build-$experiment $local_builds_dir/$experiment-$target-$mode"
|
||||
);
|
||||
system("rm -rf $local_root/build-$experiment");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user