add curses entry point for scripts (archival, ghidra import, plots, queries, cleanup)
This commit is contained in:
@ -4,8 +4,16 @@ use strict;
|
||||
use warnings;
|
||||
use diagnostics;
|
||||
|
||||
use FindBin;
|
||||
use lib $FindBin::Bin;
|
||||
|
||||
use Util;
|
||||
use TUI;
|
||||
|
||||
use feature 'say';
|
||||
|
||||
my $date = Util::date_now;
|
||||
|
||||
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";
|
||||
@ -21,52 +29,37 @@ sub just {
|
||||
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;
|
||||
# Find and select experiments
|
||||
my @experiments = map { s/\.cpp//r } Util::find_files($local_experiments_dir);
|
||||
my @selected_experiments =
|
||||
$experiment_sel eq "all" ? @experiments : split( ',', $experiment_sel );
|
||||
TUI::select_from_list( "Select Experiments to Build", 1, @experiments );
|
||||
die "No experiment selected" unless @selected_experiments;
|
||||
|
||||
# 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 );
|
||||
TUI::select_from_list( "Select Targets Platforms", 1, @targets );
|
||||
die "No target selected" unless @selected_targets;
|
||||
|
||||
# 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 );
|
||||
my @selected_modes =
|
||||
TUI::select_from_list( "Select Execution Modes", 1, @modes );
|
||||
die "No mode selected" unless @selected_modes;
|
||||
|
||||
# Build everything
|
||||
# TODO: linux-baremetal target is broken
|
||||
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"
|
||||
join " ",
|
||||
(
|
||||
"mv",
|
||||
"$local_root/build-$experiment",
|
||||
"$local_builds_dir/${date}_$experiment-$target-$mode",
|
||||
)
|
||||
);
|
||||
system("rm -rf $local_root/build-$experiment");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user