https://github.com/genome/genome
Raw File
Tip revision: 1209fdce733571b0e060bf7e58311a852a707fb2 authored by Thomas B. Mooney on 21 September 2016, 19:02:45 UTC
Merge pull request #1579 from tmooney/remove_denovo_soap
Tip revision: 1209fdc
run_genome_tests
#!/usr/bin/env genome-perl

require Getopt::Long;
require Cwd;

my $junit = $no_update_ur = my $no_update_workflow = '';
my $checked_options = Getopt::Long::GetOptions(
    'no-update-ur' => \$no_update_ur,
    'no-update-workflow' => \$no_update_workflow,
    'junit' => \$junit,
);
unless ($checked_options) {
    print "ERROR: Failed to check command options.\n";
    exit;
}

if ( __FILE__ ne 'scripts/run_genome_tests' ) {
    print "ERROR: Please make sure you are in your base Git directory.\n";
    exit;
}

$ENV{PERL5LIB} = clean_perl5lib();
update_submodule('ur') unless ($no_update_ur);
update_submodule('workflow') unless ($no_update_workflow);

my $cwd = Cwd::getcwd();
$ENV{PERL5LIB} = join(':', "$cwd/ur/lib", "$cwd/workflow/lib", "$cwd/lib/perl", $ENV{PERL5LIB});
$ENV{PATH} = join(':', "$cwd/ur/bin", "$cwd/workflow/bin", "$cwd/bin", $ENV{PATH});

my @cmds = ("ur test use");
if ($junit) {
    push @cmds, "PERL_TEST_HARNESS_DUMP_TAP=../../../test_results ur test run --junit --recurse --lsf --jobs=15 --lsf-params=\"-q short -R 'select[tmp>1000 && mem>4000] rusage[tmp=1000, mem=4000]'\"";
}
else {
    push @cmds, "ur test run --recurse --lsf --jobs=15 --lsf-params=\"-q short -R 'select[tmp>1000 && mem>4000] rusage[tmp=1000, mem=4000]'\"";
}

my $prepare_cmd = "cd lib/perl/Genome && env | grep -P '^(PERL5LIB|PATH)'";
for my $cmd (@cmds) {
    print "Running command '$prepare_cmd && $cmd'...\n";
    $exit_code = system("$prepare_cmd && $cmd");
    unless($exit_code == 0) {
        print "ERROR: Non-zero exit code from '$cmd'.\n";
        exit;
    }
}

sub clean_perl5lib {
    my $PERL5LIB = $ENV{PERL5LIB};
    $PERL5LIB =~ s|/gsc/scripts/opt/genome/current/user/lib/perl||;
    $PERL5LIB =~ s/::/:/;
    $PERL5LIB =~ s/:$//;
    $PERL5LIB =~ s/^://;
    return $PERL5LIB;
}

sub update_submodule {
    my $submodule = shift;
    system("git submodule update --init $submodule");
}
back to top