#!/usr/bin/env perl

use strict;
use warnings;
use diagnostics;

use FindBin;
use lib "$FindBin::Bin/Modules";

use Util;

use feature 'say';

my $remote_root       = '/home/lab/smchurla/Documents/failnix';
my $remote_builds_dir = "$remote_root/builds";

# Run experiments
my @experiments = Util::find_subdirs($remote_builds_dir);
for my $experiment (@experiments) {
    say "Running experiment: $experiment";
    my $experiment_runner = "$remote_builds_dir/$experiment/runner.pl";
    system( "perl", $experiment_runner, $experiment,
        ">", Util::shell_quote("$remote_builds_dir/$experiment/0_runner.log"),
        "2>&1" ) == 0
      or warn "runner.pl failed for $experiment: $?";
}

Util::notify("Finished all experiments");
