diff --git a/Makefile.PL b/Makefile.PL
index 6c600660f..606af2e59 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -100,20 +100,18 @@ if(scalar @ARGV != 1 || $ARGV[0] ne '--checkdeps') {
# check plugin test symlinks
my $testlinks = {};
mkdir("t/xt") unless -d "t/xt";
-for my $testdir (glob('plugins/plugins-available/*/t')) {
- $testdir =~ m|/plugins-available/(.*)/t|gmx or die("test directory $testdir does not have valid format!");
+for my $testdir (glob('plugins/plugins-enabled/*/t')) {
+ $testdir =~ m|/plugins-enabled/(.*)/t|gmx or die("test directory $testdir does not have valid format!");
my $plugin = $1;
if(!-e 't/xt/'.$plugin and !-l 't/xt/'.$plugin) {
- symlink('../../plugins/plugins-available/'.$plugin.'/t', 't/xt/'.$plugin) or die("cannot create symlink ('../../plugins/plugins-available/$plugin/t', 't/xt/$plugin'): $!");
- $testlinks->{$plugin} = '../../plugins/plugins-available/'.$plugin.'/t';
+ symlink('../../plugins/plugins-enabled/'.$plugin.'/t', 't/xt/'.$plugin) or die("cannot create symlink ('../../plugins/plugins-enabled/$plugin/t', 't/xt/$plugin'): $!");
+ $testlinks->{$plugin} = '../../plugins/plugins-enabled/'.$plugin.'/t';
next;
}
my $target = readlink('t/xt/'.$plugin);
- if( $target ne '../../plugins/plugins-available/'.$plugin.'/t'
- and $target ne '../../plugins/plugins-enabled/'.$plugin.'/t'
- ) {
- die('t/xt/'.$plugin.' has wrong target: '.$target.' vs. ../../plugins/plugins-available/'.$plugin.'/t');
+ if($target ne '../../plugins/plugins-enabled/'.$plugin.'/t') {
+ die('t/xt/'.$plugin.' has wrong target: '.$target.' vs. ../../plugins/plugins-enabled/'.$plugin.'/t');
}
$testlinks->{$plugin} = $target;
}
diff --git a/plugins/plugins-available/agents/t/controller_agents.t b/plugins/plugins-available/agents/t/controller_agents.t
index 64f05d26f..310cfbaa6 100644
--- a/plugins/plugins-available/agents/t/controller_agents.t
+++ b/plugins/plugins-available/agents/t/controller_agents.t
@@ -9,9 +9,6 @@ BEGIN {
plan skip_all => 'backends required' if(!-s 'thruk_local.conf' and !defined $ENV{'PLACK_TEST_EXTERNALSERVER_URI'});
plan skip_all => 'test skipped' if defined $ENV{'NO_DISABLED_PLUGINS_TEST'};
- # enable plugin
- `cd plugins/plugins-enabled && ln -s ../plugins-available/agents .`;
-
plan tests => 39;
}
@@ -77,6 +74,3 @@ sub _test_json_page {
return($data);
}
-
-# restore default
-`cd plugins/plugins-enabled && rm -f agents`;
\ No newline at end of file
diff --git a/plugins/plugins-available/agents/templates/agents_edit.tt b/plugins/plugins-available/agents/templates/agents_edit.tt
index 13238dd20..cb1e53026 100644
--- a/plugins/plugins-available/agents/templates/agents_edit.tt
+++ b/plugins/plugins-available/agents/templates/agents_edit.tt
@@ -197,8 +197,8 @@
-
-
+
+
|
diff --git a/plugins/plugins-available/core_scheduling/t/controller_core_scheduling.t b/plugins/plugins-available/core_scheduling/t/controller_core_scheduling.t
index 9130bffe6..c79126046 100644
--- a/plugins/plugins-available/core_scheduling/t/controller_core_scheduling.t
+++ b/plugins/plugins-available/core_scheduling/t/controller_core_scheduling.t
@@ -8,9 +8,6 @@ BEGIN {
plan skip_all => 'local test only' if defined $ENV{'PLACK_TEST_EXTERNALSERVER_URI'};
plan skip_all => 'test skipped' if defined $ENV{'NO_DISABLED_PLUGINS_TEST'};
- # enable plugin
- `cd plugins/plugins-enabled && ln -s ../plugins-available/core_scheduling .`;
-
plan tests => 22;
}
@@ -56,6 +53,3 @@ for my $url (@{$json_hash_pages}) {
my $data = decode_json($page->{'content'});
is(ref $data, 'HASH', "json result is an hash: ".$url);
}
-
-# restore default
-`cd plugins/plugins-enabled && rm -f core_scheduling`;
diff --git a/plugins/plugins-available/editor/t/controller_editor.t b/plugins/plugins-available/editor/t/controller_editor.t
index e713a6fa1..877f533bd 100644
--- a/plugins/plugins-available/editor/t/controller_editor.t
+++ b/plugins/plugins-available/editor/t/controller_editor.t
@@ -7,9 +7,6 @@ BEGIN {
plan skip_all => 'local test only' if defined $ENV{'PLACK_TEST_EXTERNALSERVER_URI'};
plan skip_all => 'test skipped' if defined $ENV{'NO_DISABLED_PLUGINS_TEST'};
- # enable plugin
- `cd plugins/plugins-enabled && ln -s ../plugins-available/editor .`;
-
plan tests => 30;
}
@@ -38,6 +35,3 @@ for my $alias (qw/naemon nagios/) {
'like' => ['TextHighlightRules', 'servicegroup_members', 'NaemonHighlightRules'],
);
}
-
-# restore default
-`cd plugins/plugins-enabled && rm -f editor`;
\ No newline at end of file
diff --git a/plugins/plugins-available/node-control/t/controller_node-control.t b/plugins/plugins-available/node-control/t/controller_node-control.t
index 1a26aa2aa..f73497c1b 100644
--- a/plugins/plugins-available/node-control/t/controller_node-control.t
+++ b/plugins/plugins-available/node-control/t/controller_node-control.t
@@ -7,9 +7,6 @@ BEGIN {
plan skip_all => 'local test only' if defined $ENV{'PLACK_TEST_EXTERNALSERVER_URI'};
plan skip_all => 'test skipped' if defined $ENV{'NO_DISABLED_PLUGINS_TEST'};
- # enable plugin
- `cd plugins/plugins-enabled && ln -s ../plugins-available/node-control .`;
-
plan tests => 12;
}
@@ -30,6 +27,3 @@ TestUtils::test_page(
'url' => '/thruk/cgi-bin/node_control.cgi',
'like' => 'Node Control',
);
-
-# restore default
-`cd plugins/plugins-enabled && rm -f node-control`;
\ No newline at end of file
diff --git a/t/800-plugins.t b/t/800-plugins.t
index 8dfb3c7a2..d7dc772a8 100644
--- a/t/800-plugins.t
+++ b/t/800-plugins.t
@@ -2,6 +2,7 @@ use warnings;
use strict;
use Test::More 0.96;
+use Thruk::Base ();
use Thruk::Config 'noautoload';
use Thruk::Utils::IO ();
@@ -55,7 +56,7 @@ TestUtils::test_command({
cmd => $BIN.' plugin search report -f',
like => ['/reports2/'],
exit => 0,
-});
+}) unless $filter;
my $failed = {};
for my $p (@{$plugins}) {
diff --git a/t/TestUtils.pm b/t/TestUtils.pm
index fc577ded5..d2bec6646 100644
--- a/t/TestUtils.pm
+++ b/t/TestUtils.pm
@@ -748,8 +748,6 @@ sub test_command {
}
my($prg,$arg) = split(/\s+/, $test->{'cmd'}, 2);
- my $t = Test::Cmd->new(prog => $prg, workdir => '') || bail_out_cmd($test, $!);
- $test->{'test_cmd'} = $t;
# wait for something?
if(defined $test->{'waitfor'}) {
@@ -767,6 +765,7 @@ sub test_command {
while($now <= $end) {
alarm(15);
$expr = $waitfor;
+ my $t = Test::Cmd->new(prog => $prg, workdir => '') || bail_out_cmd($test, $!);
eval {
local $SIG{ALRM} = sub { die "timeout on cmd: ".$test->{'cmd'}."\n" };
$t->run(args => $arg, stdin => $test->{'stdin'});
@@ -796,6 +795,9 @@ sub test_command {
}
}
+ my $t = Test::Cmd->new(prog => $prg, workdir => '') || bail_out_cmd($test, $!);
+ $test->{'test_cmd'} = $t;
+
alarm(300);
eval {
local $SIG{ALRM} = sub { die "timeout on cmd: ".$test->{'cmd'}."\n" };
diff --git a/t/data/800-plugins/01-css.t b/t/data/800-plugins/01-css.t
index 3d622fcc4..e9d510f94 100644
--- a/t/data/800-plugins/01-css.t
+++ b/t/data/800-plugins/01-css.t
@@ -32,6 +32,7 @@ for my $dir (@dirs) {
done_testing();
+##########################################################
sub check_templates {
my($file) = @_;
return if($filter && $file !~ m%$filter%mx);
@@ -75,6 +76,7 @@ sub check_templates {
}
}
+##########################################################
sub _get_classes {
my($file) = @_;
my $content = Thruk::Utils::IO::read($file);
@@ -85,24 +87,47 @@ sub _get_classes {
my @cl = split(/[,\>\s]/mx, $cls);
for my $c (@cl) {
$c = Thruk::Base::trim_whitespace($c);
+
+ # replace escaped hex numbers used at start of class name, ex.: 2xl -> .\32xl
+ $c =~ s/\.\\(\d+)/&_dec_class($1)/gemxis;
+
+ # replace \[\]
+ $c =~ s/\\\[(.*?)\\\]/[$1]/mxg;
+
+ # remove backslashes, but not before dots
+ $c =~ s/\\:/__ESCAPED_COLON__/gmx;
+ $c =~ s/\\\./__ESCAPED_DOT__/gmx;
+ $c =~ s/\\//gmx;
+
# trim leading html tag, ex.: DIV.classname
- $c =~ s/\\//mx;
$c =~ s/^\w+\././mx;
+
# remove trailing + label
- $c =~ s/\s+\+\s+\w+//mx;
+ $c =~ s/\s*\+\s*\w+//mx;
+
# remove [type=..]
$c =~ s/(\w+)\[.*?\]/$1/mx;
+
# remove :checked
$c =~ s/:checked//mx;
+
next if $c eq '';
# split by dot to catch multiple classes from ex.: DIV.cls1.cls2
for my $c1 (split/\./mx, $c) {
$c1 = Thruk::Base::trim_whitespace($c1);
$c1 =~ s/:.*$//gmx;
+ $c1 =~ s/__ESCAPED_DOT__/./gmx;
+ $c1 =~ s/__ESCAPED_COLON__/:/gmx;
next if $c1 eq '';
$classes->{$c1} = 1;
}
}
}
return($classes);
+}
+
+##########################################################
+sub _dec_class {
+ my($hex) = @_;
+ return(".".pack('H*', $hex));
}
\ No newline at end of file