remote_shim.pl 724 B

123456789101112131415161718192021222324252627
  1. #!/usr/bin/env perl
  2. use strict;
  3. use warnings;
  4. my $wd = $ENV{'RPROVE_WORK_DIR'};
  5. my $test = $ARGV[0];
  6. my $ssh = Net::OpenSSH->new($ENV{'RPROVE_HOST'});
  7. # Print directly to stdout, as this function merges
  8. # STDOUT & STDERR and discards STDIN.
  9. # Do this to avoid TTY overflow, and because prove expects
  10. # to capture output from STDOUT/ERR anyways.
  11. my $system_opts = {
  12. 'stdout_discard' => 0,
  13. 'stderr_discard' => 0,
  14. 'stderr_to_stdout' => 1,
  15. 'stdin_discard' => 1,
  16. };
  17. # Optionally move to the working directory.
  18. my $cd = $wd ? "cd $wd && " : '';
  19. $ssh->system(
  20. $system_opts, "${cd}$ENV{'RPROVE_INTERPRETER'} '$wd/$test'"
  21. );
  22. # Net::OpenSSH sets this value correctly for our purposes here.
  23. exit $?;