rprove 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #!/usr/bin/env perl
  2. package App::Prove::Remote::rprove;
  3. use strict;
  4. use warnings;
  5. use App::Prove::Remote::Connector ();
  6. use Getopt::Long ();
  7. exit run() unless caller();
  8. sub run {
  9. my ( $host, $verbosity, $workdir ) = ( '127.0.0.1', 0, '', 'perl' );
  10. Getopt::Long::Configure( 'bundling', 'auto_help', 'pass_through' );
  11. Getopt::Long::GetOptions(
  12. 'host|h=s' => \$host,
  13. 'verbosity|v=i' => \$verbosity,
  14. 'workdir=s' => \$workdir,
  15. 'interpreter=s' => \$interpreter,
  16. );
  17. my $conn = App::Prove::Remote::Connector->new(
  18. $host, $verbosity, $workdir, $interpreter
  19. );
  20. return 0;
  21. }
  22. 1;
  23. __END__
  24. =head1 NAME
  25. rprove - Prove wrapper which executes your tests on the remote host
  26. =head1 SYNOPSIS
  27. rprove [options] [file ...]
  28. Options:
  29. -help You are reading it!
  30. -host Host to connect to. Defaults to 127.0.0.1.
  31. -verbosity How verbose you want this (and the SSH connection) to be
  32. =head1 OPTIONS
  33. =over 8
  34. =item B<-help>
  35. Print a brief help message and exits.
  36. =item B<-host>
  37. Host to connect to. Defaults to 127.0.0.1
  38. =item B<-verbosity>
  39. How verbose you want this to be. Useful if you need to debug
  40. some strange SSH behavior.
  41. =item B<-wordkir>
  42. Directory to execute the test from. Useful to set if the test requires it.
  43. =item B<-interpreter>
  44. Path to the interpreter to run your tests with. Default is /usr/bin/perl.
  45. Useful to set if you have perl in a nonstandard location
  46. or non-perl tests to execute that still emit valid TAP.
  47. =back
  48. =head1 DESCRIPTION
  49. B<rprove> will locally run prove with a --exec argument which is a shim.
  50. This (remote_shim.pl) will connect to the remote host for the test in
  51. question and run it on the host.
  52. Why do this? Because sometimes testing certain scenarios is better done
  53. on a disposable remote environment instead of on the local environment.
  54. If someone has a "smoker" like environment (Jenkins, some other CI) which
  55. also runs your tests, this could also be of use from the orchestrator's
  56. end.
  57. Anyways, the user is responsible for ensuring the test (and code under
  58. test) has been properly deployed to the remote system under test, so
  59. make sure that's done first if you want this approach to work.
  60. Output of the script is then read by the TAP parser as is expected for
  61. a seamless testing experience *as if you had ran the test locally*.
  62. =cut