Skip to content

Commit

Permalink
[backend] support test mode option for bs_deltastore
Browse files Browse the repository at this point in the history
  • Loading branch information
mlschroe authored and adrianschroeter committed May 11, 2016
1 parent 472ab56 commit e60af6b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions src/backend/bs_deltastore
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ my $rundir = $BSConfig::rundir || "$BSConfig::bsdir/run";

my $myeventdir = "$eventdir/deltastore";

my $testmode;

sub deltastore {
my ($projid, $packid, $file) = @_;
print "generating src delta for $projid/$packid/$file\n";
Expand Down Expand Up @@ -94,6 +96,11 @@ sub deltastore {
}
}

if (@ARGV && ($ARGV[0] eq '--test-mode' || $ARGV[0] eq '--testmode')) {
$testmode = 1;
shift @ARGV;
}

$| = 1;
$SIG{'PIPE'} = 'IGNORE';
BSUtil::restartexit($ARGV[0], 'deltastore', "$rundir/bs_deltastore", "$myeventdir/.ping");
Expand Down Expand Up @@ -143,6 +150,12 @@ while(1) {
}
}

if ($testmode) {
close(RUNLOCK);
print "Test mode, exiting...\n";
exit(0);
}

# check for restart/exit
if (-e "$rundir/bs_deltastore.exit") {
close(RUNLOCK);
Expand Down
2 changes: 1 addition & 1 deletion src/backend/bs_dispatch
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ while (@ARGV) {
if ($ARGV[0] eq '--test-directory') {
shift @ARGV;
$testdir = shift @ARGV;
} elsif ($ARGV[0] eq '--test-mode') {
} elsif ($ARGV[0] eq '--test-mode' || $ARGV[0] eq '--testmode') {
shift @ARGV;
$testmode = 1;
} elsif ($ARGV[0] eq '--test-constraints') {
Expand Down

0 comments on commit e60af6b

Please sign in to comment.