Browse Source

svn path=/trunk/; revision=15381

tags/stw2018
ato 9 years ago
parent
commit
a6f70b85c9
7 changed files with 68 additions and 30 deletions
  1. 10
    0
      tools/paths.sh
  2. 0
    5
      tools/qa/QA/Config.pm
  3. 21
    0
      tools/qa/QA/Options.pm
  4. 19
    7
      tools/qa/QA/Report.pm
  5. 11
    3
      tools/qa/QA/Validation.pm
  6. 6
    0
      tools/qa/fsfe.sh
  7. 1
    15
      tools/qa/qa

+ 10
- 0
tools/paths.sh View File

@@ -0,0 +1,10 @@
#!/bin/bash

# Paths for building FSFE website.
# FIXME: This does not apply to build.pl yet!

SOURCE=/home/www/fsfe
DEST=/home/www/html
TMP=/home/www/tmp.$$
STATUS=/var/www/web


+ 0
- 5
tools/qa/QA/Config.pm View File

@@ -33,11 +33,6 @@ chdir $current_directory;
my $base_directory = Cwd::realpath(File::Spec->updir);
chdir $base_directory;

#die $QA::Options->{config};

use Data::Dumper;
die Dumper($QA::Options);

unless (defined $QA::Options->{config}) {
$QA::Options->{config} = "config.xml";
}

+ 21
- 0
tools/qa/QA/Options.pm View File

@@ -0,0 +1,21 @@

use strict;
use warnings;

use Getopt::Long;
use Data::Dumper;

# Options
$QA::Options = {};
my $options_parser = new Getopt::Long::Parser("config" => ["gnu_compat",
"bundling", "permute", "no_getopt_compat"]);

$options_parser->getoptions($QA::Options, #$QA::Options,
"config|c=s",
"debug|d",
"help|h",
"version|v"
) or exit;

1;


+ 19
- 7
tools/qa/QA/Report.pm View File

@@ -20,11 +20,13 @@ package QA::Report;
use strict;
use warnings;

use Carp;
use Log::Log4perl qw(get_logger);

use vars qw($VERSION @ISA);
my $VERSION = 1;

my $log = get_logger("QA::Report");

my @supported_outcomes = (
"PASS",
"FAIL",
@@ -44,7 +46,7 @@ sub init {
if (defined $args{file}) {
$self->{report_file} = $args{file};
} else {
croak "You must supply a filename for your report.";
$log->error("You must supply a filename for your report.");
}

return $self;
@@ -56,7 +58,7 @@ sub new_test_result {
my ($name, $outcome, $message);

unless (defined $args{name} && defined $args{outcome}) {
croak "You must define 'name' and 'outcome' arguments.";
$log->error("You must define 'name' and 'outcome' arguments.");
}

if ($args{name}) {
@@ -64,7 +66,7 @@ sub new_test_result {
}

unless (grep $_ eq uc($args{outcome}), @supported_outcomes) {
croak "Invalid outcome '" . $args{outcome} . "'";
$log->error("Invalid outcome '" . $args{outcome} . "'");
} else {
$outcome = uc($args{outcome});
}
@@ -73,15 +75,23 @@ sub new_test_result {
$message = $args{message};
}

$self->{tests}{scalar($self->{tests}) + 1} = {
$log->debug("Inserting new test result ('$name', '$outcome',
'$message'");

my $count = keys %{ $self->{tests} };
$count++;

$self->{tests}{$count} = {
outcome => $outcome,
message => $message
};
};
}

sub compile {
my $self = shift;

$log->info("Compiling report...");

use Data::Dumper;
return Dumper($self->{tests});
}
@@ -89,6 +99,8 @@ sub compile {
sub compile_to_file {
my $self = shift;

$log->info("Saving report to '" . $self->{report_file} . "'");

open REPORT, ">", $self->{report_file} or die $!;
print REPORT $self->compile;
close REPORT;
@@ -100,7 +112,7 @@ sub get_report {
if (-f $self->{report_file}) {
return $self->{report_file};
} else {
croak "Report has not yet been generated.";
$log->error("Report has not yet been generated!");
}
}


+ 11
- 3
tools/qa/QA/Validation.pm View File

@@ -43,7 +43,6 @@ sub init {
my ($self, %args) = @_;

$log->debug("Initializing Validation module");
die "yes";

my @supported_formats = (
"html",
@@ -82,16 +81,25 @@ sub test {
$log->info("No files to test.");
}

$log->info("Starting testing:");

foreach my $file ($self->{files}[0][0]) {
unless (-f $file) {
$log->warn(" [ERROR] (Missing file) $file");
} else {
$report->new_test_result(name => $file,
outcome => "FAIL",
message => "Missing file.");
if ($validator->parse_file($file)) {
$log->info(" [PASS] $file");
} else {
$log->warn(" [FAIL] $file");
}
}

$validator->parse_file($file);
}

$log->info("Finished testing!");
$report->compile;
}


+ 6
- 0
tools/qa/fsfe.sh View File

@@ -0,0 +1,6 @@
#!/bin/bash
# QA tools execution script for mainline.

source ../paths.sh
./qa --config=config-fsfe.xml


+ 1
- 15
tools/qa/qa View File

@@ -21,25 +21,11 @@ use strict;
use warnings;

use Log::Log4perl qw(:easy);
use Getopt::Long;
use Pod::Usage;
use File::Path qw(mkpath);

# Options
$QA::Options = {};
my $options_parser = new Getopt::Long::Parser("config" => ["gnu_compat",
"bundling", "permute", "no_getopt_compat"]);

$options_parser->getoptions($QA::Options,
"config|c=s",
"debug|d",
"help|h",
"version|v"
) or exit;

use Data::Dumper;
die Dumper($QA::Options);

use QA::Options;
use QA::Config;
use QA::Utilities;


Loading…
Cancel
Save