From 463ec5bc0b7ba496c6ccd3e7141f5c9bbb30a76f Mon Sep 17 00:00:00 2001 From: Ole Tange Date: Sat, 21 Apr 2012 00:34:24 +0200 Subject: [PATCH] Fixed: bug #36151: swap_activity broken in v20120322. Passes testsuite. --- src/parallel | 10 ++++++---- testsuite/Makefile | 1 + testsuite/wanted-results/test32 | 6 +++--- testsuite/wanted-results/test60 | 6 +++--- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/parallel b/src/parallel index d50a8523..1fa3b080 100755 --- a/src/parallel +++ b/src/parallel @@ -537,7 +537,7 @@ sub get_options_from_array { sub parse_options { # Returns: N/A # Defaults: - $Global::version = 20120420; + $Global::version = 20120421; $Global::progname = 'parallel'; $Global::infinity = 2**31; $Global::debug = 0; @@ -2155,9 +2155,11 @@ sub swap_activity { -e $ENV{'HOME'}."/.parallel" or mkdir $ENV{'HOME'}."/.parallel"; -e $ENV{'HOME'}."/.parallel/tmp" or mkdir $ENV{'HOME'}."/.parallel/tmp"; my $swap_activity; - $swap_activity = ("vmstat 1 2 2>/dev/null | tail -n1 | awk '{print \$7*\$8}' || ". - # If the (remote) machine is Mac and the above fails, try this: - "vm_stat 1 | head -n 3 | tail -n1 | awk '{print \$9*\$10}'"); + # If the (remote) machine is Mac we should use vm_stat + # swap_in and swap_out on GNU/Linux is $7 and $8 + # swap_in and swap_out on Mac is $10 and $11 + $swap_activity = q[ { vmstat 1 2> /dev/null || vm_stat 1; } | ]. + q[ awk 'NR!=4{next} NF==16{print $7*$8} NF==11{print $10*$11} {exit}' ]; if($self->{'string'} ne ":") { $swap_activity = $self->sshcommand() . " " . $self->serverlogin() . " " . ::shell_quote_scalar($swap_activity); diff --git a/testsuite/Makefile b/testsuite/Makefile index c5a73420..b3d14ef3 100644 --- a/testsuite/Makefile +++ b/testsuite/Makefile @@ -13,6 +13,7 @@ testsuite: ../src/parallel tests-to-run/* wanted-results/* startdb niceload true || (echo niceload is required for testsuite; /bin/false) which burnP6 || (echo burnP6 is required for testsuite; /bin/false) which timeout || (echo timeout is required for testsuite; /bin/false) + parallel ssh parallel@parallel-server{} parallel --minversion 20100101 ::: 1 2 3 || (echo parallel on remote required for testsuite; /bin/false) time sh Start.sh date diff --git a/testsuite/wanted-results/test32 b/testsuite/wanted-results/test32 index bf42e7fb..b90da7fa 100644 --- a/testsuite/wanted-results/test32 +++ b/testsuite/wanted-results/test32 @@ -1,9 +1,9 @@ ### Test of --retries - it should run 13 jobs in total -13 +12 ### Test of --retries - it should run 25 jobs in total -25 +24 ### Test of --retries - it should run 49 jobs in total -49 +48 ### Bug with --retries 8 8 diff --git a/testsuite/wanted-results/test60 b/testsuite/wanted-results/test60 index 2480891d..9bb467da 100644 --- a/testsuite/wanted-results/test60 +++ b/testsuite/wanted-results/test60 @@ -51,11 +51,11 @@ 3 ### Test --nonall vm1 -vm10 +vm11 ### Test --nonall -u -vm10 +vm11 vm1 -vm10 +vm11 vm1 ### Test read sshloginfile from STDIN vm1