diff --git a/t/mockup-lib/File/Which.pm b/t/mockup-lib/File/Which.pm new file mode 100644 index 0000000..1181863 --- /dev/null +++ b/t/mockup-lib/File/Which.pm @@ -0,0 +1,20 @@ +package File::Which; + +# Mockup package to _not_ find anything + +use strict; +use warnings; + +use Exporter; + +use vars qw{@ISA @EXPORT @EXPORT_OK}; +BEGIN { + @ISA = 'Exporter'; + @EXPORT = 'which'; +} + +sub which { + return; +} + +'This is a fake!'; diff --git a/t/xt-create-xen-config.t b/t/xt-create-xen-config.t index 0658d26..30dbefe 100755 --- a/t/xt-create-xen-config.t +++ b/t/xt-create-xen-config.t @@ -20,7 +20,27 @@ use File::Temp; # # +runAllTests(); +# Fake File::Which to find nothing at all, i.e. no lsb_release. +$ENV{PERL5OPT} = '-It/mockup-lib'.($ENV{PERL5OPT}?" $ENV{PERL5OPT}":''); + +runAllTests(); + +done_testing; + + + +=head2 runAllTests + + Runs all the xt-create-xen-config test. + + The idea is to be able to run these tests multiple times under +different conditions. + +=cut + +sub runAllTests { # # Look for mention of DHCP when setting up DHCP, this conflicts with # a static IP address. @@ -104,12 +124,7 @@ testOutputContains( "/tmp/domains/foo.my.flat", memory => 128, dhcp => 1, dir => '/tmp' ); noMentionOf( "phy:", memory => 128, dhcp => 1, dir => '/tmp' ); - - - -done_testing(); - - +} # end of runAllTests =head2 runCreateCommand