https://gl.petatech.eu/root/HomeBot/-/jobs/168 (s.u. nun 8 Funktionstests)
https://gl.petatech.eu/root/HomeBot/-/commit/1cefbb3a753d56d65ef2801a06918bb7f852774b#43b584c479f6e29dee48f9676c72edae39725b16a.k.a. "Schwalbe - noch kein Sommer", aber trotzdem nett - finde ich.
übrigens: einer von denen braucht Date::Time - hat der Test ergeben.
PS: Mich nervt auch so manches. z.B wenn neuer Code 2020 a.D. so aussieht wie
"das war schon 2005 nicht so toll". Da frage ich mich dann auch ob es die vergebliche
Liebesmüh' wert ist.
And that's why we can't have nice things.
Sehr schade eigentlich.
Modifikationen an FhemTestUtils:
sub FhemTestUtils_gotLog {
my $arg = shift;
my $reset = shift // 0;
my $back = grep m{$arg}, @logs;
@logs = () if ($reset);
return $back;
}
2. Parameter macht einen Log Reset. Default: kein Reset.
Da FhemTestUtils_gotLog einen Wahrheitswert zurückliefert, kann man im Testfile auch ok(...) statt is(..., 1) verwenden.
ElsnerWS verhält sich sehr fragil beim Define:
2020.05.31 16:00:16 1: PERL WARNING: Use of uninitialized value $d in hash element at hobo.pl line 3221.
2020.05.31 16:00:16 1: PERL WARNING: Use of uninitialized value $autocreateName in hash element at ./FHEM/00_ElsnerWS.pm line 121.
2020.05.31 16:00:16 2: ElsnerWS define FileLog_EWS FileLog ./log/EWS-%Y-%m.log EWS
2020.05.31 16:00:16 1: PERL WARNING: Use of uninitialized value $autocreateName in hash element at ./FHEM/00_ElsnerWS.pm line 144.
2020.05.31 16:00:16 2: ElsnerWS define SVG_EWS SVG FileLog_EWS:ElsnerWS:CURRENT
2020.05.31 16:00:16 1: PERL WARNING: Use of uninitialized value $FW_gplotdir in concatenation (.) or string at ./FHEM/98_SVG.pm line 141.
2020.05.31 16:00:16 1: PERL WARNING: Use of uninitialized value $FW_gplotdir in concatenation (.) or string at ./FHEM/98_SVG.pm line 144.
2020.05.31 16:00:16 2: ElsnerWS ERROR: set SVG_EWS copyGplotFile: Can't open /ElsnerWS.gplot: No such file or directory
2020.05.31 16:00:16 1: define EWS ElsnerWS comtype=rs485 devicename=/dev/tty0: Can't open /ElsnerWS.gplot: No such file or directory
2020.05.31 16:00:16 3: define EWS ElsnerWS comtype=rs485 devicename=/dev/tty0 : Can't open /ElsnerWS.gplot: No such file or directory
Ich gehe natürlich davon aus, dass das im Lokalkolorit ja überhaupt kein Problem darstellt, aber unter normalen Umständen ("da draussen") stört sowas.
Reiche Ernte:
FBAHAHTTP macht überhaupt keinen Mucks im Log beim define. Nichtmal wenn ich ihm die lokale Fritzbox anbiete und auch nicht nach X Sekunden.
define FHZ FHZ /dev/tty0kämpft ein wenig
2020.05.31 16:19:32 3: FHZ opening FHZ device /dev/tty0
2020.05.31 16:19:32 3: FHZ opened FHZ device /dev/tty0
2020.05.31 16:19:33 1: Trying again get FHZ init2 (2 out of 3)
2020.05.31 16:19:34 1: Trying again get FHZ init2 (3 out of 3)
2020.05.31 16:19:37 1: Trying again get FHZ serial (2 out of 3)
2020.05.31 16:19:38 1: Trying again get FHZ serial (3 out of 3)
Dann faltet sich alles fatal:
Can't use an undefined value as an ARRAY reference at hobo.pl line 1558.
Compilation failed in require at hobo.pl line 4651.
# Tests were run but no plan was declared and done_testing() was not seen.
# Looks like your test exited with 29 just after 5.
Gut, das passiert mir zwar in HoBo, aber ich würde wetten das passiert in FHEM auch. In DoSet:
$arg = join(" ", @args) if (!@{$hash->{CHANGED}});
Ich gehe davon aus $hash->{CHANGED} ist in dem Fall (noch) keine Arrayref.
Ha! Was ein wenig defensives Programmieren doch ausmachen kann:
$hash->{CHANGED} //= [];
$arg = join(" ", @args) if (!@{$hash->{CHANGED}});
=> Und der Test läuft durch.