[libvirt] [tck PATCH 5/9] Fix no-arp-spoof test script generation

Laine Stump posted 9 patches 7 years, 3 months ago
There is a newer version of this series
[libvirt] [tck PATCH 5/9] Fix no-arp-spoof test script generation
Posted by Laine Stump 7 years, 3 months ago
I'm not sure if or how this ever worked before - what is supposed to
happen is that the shell script in $cmdfile is put into the file
/test.sh on the guest, then /test.sh is executed. But the code was
instead trying to directly execute the text of the entire script as a
single command and write the generated output to /test.sh, then
execute that.

putting echo " ..... " around the whole thing fixed it.
---
 scripts/nwfilter/240-no-arp-spoofing.t | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/nwfilter/240-no-arp-spoofing.t b/scripts/nwfilter/240-no-arp-spoofing.t
index 141fb92..45f790a 100644
--- a/scripts/nwfilter/240-no-arp-spoofing.t
+++ b/scripts/nwfilter/240-no-arp-spoofing.t
@@ -91,11 +91,11 @@ my $ssh = Net::OpenSSH->new($guestip,
                             password => $tck->root_password());
 
 # now generate a arp spoofing packets 
-diag "generate arpspoof";
+diag "generate arpspoof script";
 my $cmdfile = <<EOF;
-/usr/sbin/arpspoof ${spoofid} &
+echo "/usr/sbin/arpspoof ${spoofid} &
 /bin/sleep 10
-kill -15 `/sbin/pidof arpspoof`' > /test.sh
+kill -15 `/sbin/pidof arpspoof`" > /test.sh
 EOF
 
 diag "content of cmdfile:";
-- 
2.13.6

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [tck PATCH 5/9] Fix no-arp-spoof test script generation
Posted by Daniel P. Berrangé 7 years, 3 months ago
On Wed, Feb 07, 2018 at 09:04:55PM -0500, Laine Stump wrote:
> I'm not sure if or how this ever worked before - what is supposed to
> happen is that the shell script in $cmdfile is put into the file
> /test.sh on the guest, then /test.sh is executed. But the code was
> instead trying to directly execute the text of the entire script as a
> single command and write the generated output to /test.sh, then
> execute that.

Err, wow.

> 
> putting echo " ..... " around the whole thing fixed it.
> ---
>  scripts/nwfilter/240-no-arp-spoofing.t | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/scripts/nwfilter/240-no-arp-spoofing.t b/scripts/nwfilter/240-no-arp-spoofing.t
> index 141fb92..45f790a 100644
> --- a/scripts/nwfilter/240-no-arp-spoofing.t
> +++ b/scripts/nwfilter/240-no-arp-spoofing.t
> @@ -91,11 +91,11 @@ my $ssh = Net::OpenSSH->new($guestip,
>                              password => $tck->root_password());
>  
>  # now generate a arp spoofing packets 
> -diag "generate arpspoof";
> +diag "generate arpspoof script";
>  my $cmdfile = <<EOF;
> -/usr/sbin/arpspoof ${spoofid} &
> +echo "/usr/sbin/arpspoof ${spoofid} &
>  /bin/sleep 10
> -kill -15 `/sbin/pidof arpspoof`' > /test.sh
> +kill -15 `/sbin/pidof arpspoof`" > /test.sh
>  EOF
>  
>  diag "content of cmdfile:";

Reviewed-by: Daniel P. Berrange <berrange@redhat.com>

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list