Bläddra i källkod

Merge pull request #1365 from richardkchapman/regression-suite-fixup

Regression suite fixup

Reviewed-by: Gavin Halliday <ghalliday@hpccsystems.com>
Gavin Halliday 13 år sedan
förälder
incheckning
1bd27d97dd
2 ändrade filer med 44 tillägg och 62 borttagningar
  1. 29 37
      testing/ecl/Regress/RoxieConfig.pm
  2. 15 25
      testing/ecl/Regress/Engine.pm

+ 29 - 37
testing/ecl/Regress/RoxieConfig.pm

@@ -15,22 +15,22 @@
 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 ################################################################################
 
-package Regress::RoxieConfig;
+package Regress::EclPublish;
 
 =pod
 
 =head1 NAME
-    
-Regress::RoxieConfig - perl module used by runregress to execute roxieconfig
+
+Regress::EclPublish - perl module used by runregress to execute ecl publish
 
 =head1 SYNOPSIS
 
-my $submit = Regress::RoxieConfig->new($opts);
+my $submit = Regress::EclPublish->new($opts);
 
 $submit->submit($run);
 
 =cut
-    
+
 use strict;
 use warnings;
 use File::Spec::Functions qw(splitpath);
@@ -49,9 +49,9 @@ our @ISA = qw(Exporter);
 
 =pod
 
-=item my $submit = Regress::RoxieConfig->new(%options);
+=item my $submit = Regress::EclPublish->new(%options);
 
-Takes a hash of options obtained from a L<Regress::Engine> object. Returns an object used to execute roxieconfig.
+Takes a hash of options obtained from a L<Regress::Engine> object. Returns an object used to execute ecl publish.
 
 =cut
 
@@ -67,7 +67,7 @@ sub new($$)
 
 =item $submit->submit($run, $seq);
 
-Runs roxieconfig to submit a query. Takes a hash as passed to L<Regress::Engine::note_to_run>, and a sequence number. Calls L<Regress::Engine::note_done_run> when completed, passing the run hash and the WUID if known.
+Runs ecl publish to submit a query. Takes a hash as passed to L<Regress::Engine::note_to_run>, and a sequence number. Calls L<Regress::Engine::note_done_run> when completed, passing the run hash and the WUID if known.
 
 =cut
 
@@ -75,22 +75,20 @@ sub submit($$)
 {
     my ($self, $run, $seq) = @_;
     my $tmpout = "$run->{outpath}.tmp";
+    my (undef, undef, $basename) = splitpath($run->{path});
+    $basename =~ s/\.ecl//i;
     $self->{seqpaths}->{$seq} = {outpath => $run->{outpath}, tmppath => $tmpout, postfilter => $run->{postfilter}};
 
     my @commands;
     if($self->{deploy_roxie_queries} eq 'run')
     {
-        my %vals = (name => $run->{path},
-                    user => $self->{owner},
-                    password => $self->{password},
-                    roxieconfigaddress => $self->{roxieconfig},
-                    makeActive => 1,
-                    -noCache => 1,
-                    ImportAllModules => 0,
-                    ImportImplicitModules => 0,
-                    logAction => 0);
-        my $args = ["RunECLFile", map("$_=$vals{$_}", sort(keys(%vals)))];
-        push(@commands, {command => $self->{roxieconfigcmd} || $self->{engine}->executable_name('roxieconfig'),
+        my %vals = ('--username' => $self->{owner},
+                    '--password' => $self->{password},
+                    '--cluster' => $self->{cluster},
+                    '--name' => $basename
+                   );
+        my $args = ["run", "$run->{path}", map("$_=$vals{$_}", sort(keys(%vals)))];
+        push(@commands, {command => $self->{eclcmd} || $self->{engine}->executable_name('ecl'),
                          args => $args,
                          output => $tmpout,
                          done_callback => sub { $self->_on_complete(@_); },
@@ -100,23 +98,18 @@ sub submit($$)
     {
         if($self->{deploy_roxie_queries} eq 'yes')
         {
-            my %vals = (name => $run->{path},
-                        user => $self->{owner},
-                        password => $self->{password},
-                        roxieconfigaddress => $self->{roxieconfig},
-                        -noCache => 1,
-                        ImportAllModules => 0,
-                        ImportImplicitModules => 0,
-                        makeActive => 1);
-            my $args = ["DeployECLFile", map("$_=$vals{$_}", sort(keys(%vals)))];
-            push(@commands, {command => $self->{roxieconfigcmd} || $self->{engine}->executable_name('roxieconfig'),
+            my %vals = ('--username' => $self->{owner},
+                        '--password' => $self->{password},
+                        '--cluster' => $self->{cluster},
+                        '--name' => $basename
+                       );
+            my $args = ["publish", "$run->{path}", "--activate", map("$_=$vals{$_}", sort(keys(%vals)))];
+            push(@commands, {command => $self->{eclcmd} || $self->{engine}->executable_name('ecl'),
                              args => $args,
                              output => sub { $self->_scan_for_wuid($seq, @_); },
                              done_callback => sub { $self->_report_deployed(@_); },
                              seq => $seq});
         }
-        my (undef, undef, $basename) = splitpath($run->{path});
-        $basename =~ s/\.ecl//i;
         my $args;
         if (-e $run->{queryxmlpath})
         {
@@ -150,14 +143,14 @@ sub _report_deployed($$$$)
         my $deployout = $self->{deployout}->{$seq};
         if($deployout)
         {
-            $self->{engine}->log_write("roxieconfig output was: [" . join("\n", @{$deployout}) . "]");
+            $self->{engine}->log_write("ecl publish output was: [" . join("\n", @{$deployout}) . "]");
         }
         else
         {
-            $self->{engine}->log_write("roxieconfig produced no output");
+            $self->{engine}->log_write("ecl publish produced no output");
         }
         $self->{engine}->note_done_run($seq);
-        #MORE: need to decide what to do here: as written, will get missing output; could write roxieconfig output, but would not match in case where failure expected (if there are any)
+        #MORE: need to decide what to do here: as written, will get missing output; could write ecl publish output, but would not match in case where failure expected (if there are any)
     }
     else
     {
@@ -181,7 +174,7 @@ sub _scan_for_wuid($$$)
 {
     my ($self, $seq, $line) = @_;
     $line =~ s/[\r\n]+$//;
-    $self->{engine}->log_write("roxieconfig output: [$line]", !$self->{engine}->{verbose});
+    $self->{engine}->log_write("ecl command output: [$line]", !$self->{engine}->{verbose});
     push(@{$self->{deployout}->{$seq}}, $line);
     return if($self->{wuids}->{$seq});
     return unless($line =~ /(W[\d-]+)/);
@@ -195,5 +188,4 @@ sub _scan_for_wuid($$$)
 
 =cut
 
-1;
-
+1;

+ 15 - 25
testing/ecl/Regress/Engine.pm

@@ -71,7 +71,7 @@ use POSIX qw(localtime strftime);
 use XML::Simple;
 use Regress::Prepare qw();
 use Regress::EclPlus qw();
-use Regress::RoxieConfig qw();
+use Regress::EclPublish qw();
 use Regress::Execute qw();
 use Regress::ReportList qw();
 use Exporter;
@@ -189,7 +189,7 @@ sub run($)
     my $wuidfile = catfile($self->{suite}, 'wuids.csv');
     open($self->{wuidout}, '>', $wuidfile) or $self->error("Could not write $wuidfile: $!");
 
-    my $submit = ($self->{type} eq 'roxie') ? Regress::RoxieConfig->new($self) : Regress::EclPlus->new($self);
+    my $submit = ($self->{type} eq 'roxie') ? Regress::EclPublish->new($self) : Regress::EclPlus->new($self);
     my $seq = 0;
     foreach my $run (@{$self->{to_run}})
     {
@@ -384,7 +384,7 @@ sub log_write($$;$)
 
 =item $engine->executable_name($name);
 
-Takes the name of an executable expected to be in the regression suite directory and returns a path for it, appending '.exe' if we think we're on windows.
+Takes the name of an executable expected to be on the path and returns a path for it, appending '.exe' if we think we're on windows.
 
 =cut
 
@@ -392,7 +392,7 @@ sub executable_name($$)
 {
     my ($self, $base) = @_;
     $base .= '.exe' if($self->{iamwindows});
-    my $eclplus = catfile($self->{testdir}, $base);
+    return $base;
 }
 
 =pod
@@ -468,7 +468,7 @@ sub _check_ini_file($)
     # Variables not present in xsl or xml. How to get them?
     my $purge = 'move';
     my $fileloc = '';
-    my $roxieConfig;
+    my $eclPublish;
 
     # Format to INI
     my $ini = new Config::Simple(syntax=>'ini');
@@ -488,10 +488,8 @@ sub _check_ini_file($)
             'cluster' => $name,
             'type' => $type,
         );
-        # Config and server, only in Roxie
-        if ($name eq 'roxie') {
-            $config{roxieconfig} = $xml_sw->{EspProcess}->{EspBinding}->{$roxieConfig}->{service}
-                                    if defined $roxieConfig;
+        # roxieserver, only in Roxie
+        if ($type eq 'roxie') {
             my $xml_srv = $xml_sw->{RoxieCluster}->{RoxieServerProcess};
             if (defined $xml_srv->{computer}) {
                 $config{roxieserver} = $xml_srv->{computer}.':'.$xml_srv->{port};
@@ -506,7 +504,7 @@ sub _check_ini_file($)
             }
         }
         # Append suite to list
-        $clusters .= $name.' ';
+        $clusters .= $name.' ' unless ($type eq 'roxie');
 
         $ini->param(-block=>$name.'_suite', -value=> \%config);
     }
@@ -654,26 +652,18 @@ sub _check_cluster_values($)
     my ($self) = @_;
     $self->error("Cluster name $self->{cluster} contains illegal characters") if($self->{cluster} && ($self->{cluster} =~ /[^[:alnum:,-]_]/));
     $self->{setup_clusters} = $self->{cluster} unless($self->{setup_clusters});
-    if($self->{type} eq 'roxie')
+    if($self->{setup_generate})
     {
-        $self->error("Config does not provide value for setup_clusters for roxie tests") unless($self->{setup_clusters});
-        $self->error("Config does not supply required roxieconfig value") unless($self->{roxieconfig} || ($self->{deploy_roxie_queries} eq 'no'));
-        $self->error("Config does not supply required roxieserver value") unless($self->{roxieserver} || $self->{deploy_roxie_queries} eq 'run');
+        $self->error("Config does not provide value for setup_clusters and is setup_generate") unless($self->{setup_clusters});
     }
     else
     {
-        if($self->{setup_generate})
-        {
-            $self->error("Config does not provide value for setup_clusters and is setup_generate") unless($self->{setup_clusters});
-        }
-        else
-        {
-            $self->error("Config does not provide value for type and is not setup_generate") unless($self->{type});
-            $self->error("Config does not provide value for cluster and is not setup_generate") unless($self->{cluster});
-        }
+        $self->error("Config does not provide value for type and is not setup_generate") unless($self->{type});
+        $self->error("Config does not provide value for cluster and is not setup_generate") unless($self->{cluster});
     }
-    $self->error("Config does not provide value for owner") unless($self->{owner});
-    $self->_promptpw() unless($self->{password} || $self->{preview} || $self->{norun} || (($self->{type} eq 'roxie') && ($self->{deploy_roxie_queries} eq 'no')));
+    $self->_promptpw() unless($self->{password} || !$self->{owner} || $self->{preview} || $self->{norun} || (($self->{type} eq 'roxie') && ($self->{deploy_roxie_queries} eq 'no')));
+    $self->{owner} = '' unless $self->{owner};
+    $self->{password} = '' unless $self->{password};
 }
 
 sub _check_suite($)