Skip to content
Snippets Groups Projects
Commit 42213b5f authored by Izzard, Robert Dr (Maths & Physics)'s avatar Izzard, Robert Dr (Maths & Physics)
Browse files

add test script for new derivs, and orig reference binary_c

parent 9b1070f0
No related branches found
No related tags found
No related merge requests found
File added
#!/usr/bin/env perl
use threads;
use Thread::Queue;
use rob_misc;
use robqueue;
my $args = `tbse echo`;
my @bin_cs = ('binary_c.orig','binary_c');
my $count=0;
my $q = robqueue->new(
nthreads=>16,
subr=>\&run_system,
);
while(1)
{
$q->q();
$q->qwait();
$count++;
print "Count = $count \x0d";
}
$q->end();
exit;
############################################################
sub run_system
{
my $m1 = rand()*80+0.1;
my $m2 = MAX(0.1,rand()*$m1);
my $per = 10.0**(rand()*8.0);
my $idum = int(rand()*5000);
my %out;
my %cmd;
foreach my $executable (@bin_cs)
{
$cmd{$executable} = "env BIN_C=$executable tbse --M_1 $m1 --M_2 $m2 --orbital_period $per --idum $idum";
$out{$executable} = `$cmd{$executable}`;
# remove stuff that always changes
$out{$executable}=~s/Tick count.*//;
$out{$executable}=~s/IDUM.*//;
}
my $er=0;
for(my $i=1;$i<=$#bin_cs;$i++)
{
if($out{$bin_cs[$i]} ne $out{$bin_cs[0]})
{
print "ERROR : output for $bin_cs[$i] differs from $bin_cs[0]\n";
print "Commands were\n$bin_cs[0] : $cmd{$bin_cs[0]}\n$bin_cs[$i] : $cmd{$bin_cs[$i]}\n";
$er=1;
}
}
if($er)
{
print "Error detected : stopping\n";
exit;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment