Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unittest error in actions and failing SIGNALduino_CheckVersionResp test #923

Merged
merged 7 commits into from
Dec 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/prove.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ jobs:
flags: unittests,fhem,modules
name: fhem (testscripts) ${{ matrix.perl }}
- name: run make test (classic fhem unittest module)
id: classic_make_test
run: |
timeout 40 bash -c 'while /usr/bin/pgrep perl >> /dev/null; do sleep 1; echo .; done;'
make test PERL_OPTS="-MDevel::Cover" 2>make_error.txt && sudo pkill "^perl"
echo "::set-output name=exitcode::$(echo $?)"
cat make_error.txt
timeout 40 bash -c 'while /usr/bin/pgrep perl >> /dev/null; do sleep 1; echo .; done;' || sudo pkill "^perl"
sleep 3
Expand All @@ -73,4 +75,8 @@ jobs:
file: ./cover_db/clover.xml
flags: unittest
name: unittest module ${{ matrix.perl }}
- name: Fail if there was an error during tests
run: exit 1
if: ${{ steps.classic_make_test.outputs.exitcode != 0 }}


4 changes: 4 additions & 0 deletions CHANGED
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2020-12-27 - Merge branch 'repair_unitest' of ssh://github.com/RFD-FHEM/RFFHEM into repair_unitest
2020-12-27 - 00_SIGNALduino.pm

-Wrong version assignment in SIGNALduino_CheckVersionResp fixed and tests corrected
2020-12-20 - Decoding and sending protocol 24 (#915)

SD_ProtocolData.pm: change protocol u24 to P24
Expand Down
7 changes: 5 additions & 2 deletions FHEM/00_SIGNALduino.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1382,8 +1382,11 @@ sub SIGNALduino_CheckVersionResp {
### ToDo, manchmal kommen Mu Nachrichten in $msg und somit ist keine Version feststellbar !!!
if (defined($msg)) {
$hash->{logMethod}->($hash, 5, "$name: CheckVersionResp, called with $msg");
$msg =~ m/($gets{$hash->{ucCmd}->{cmd}}[4])/;
$hash->{version} = $1;
if ($msg =~ m/($gets{$hash->{ucCmd}->{cmd}}[4])/ ) {
$hash->{version} = $1;
} else {
delete $hash->{version};
}
} else {
$hash->{logMethod}->($hash, 5, "$name: CheckVersionResp, called without msg");
# Aufruf durch Timeout!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ defmod test_02_sub_SIGNALduino_CheckVersionResp UnitTest dummyDuino (
subtest 'Test SIGNALduino_CheckVersionResp timeout' => sub {
plan(1);
# mock like SIGNALduino_StartInit
$hash->{DevState} = 'waitInit';
$hash->{ucCmd}->{responseSub} = \&SIGNALduino_CheckVersionResp;
$hash->{ucCmd}->{cmd} = "version";
$targetHash->{DevState} = 'waitInit';
$targetHash->{ucCmd}->{responseSub} = \&SIGNALduino_CheckVersionResp;
$targetHash->{ucCmd}->{cmd} = "version";
# Simulate timeout behaviour
my ($ret,undef)=SIGNALduino_CheckVersionResp($targetHash);
like($ret,qr/^$target: CheckVersionResp, Not an SIGNALduino device, got for V: undef$/,"check return message");
Expand Down
2 changes: 1 addition & 1 deletion controls_signalduino.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
UPD 2020-12-20_21:49:49 216539 FHEM/00_SIGNALduino.pm
UPD 2020-12-28_00:01:23 216599 FHEM/00_SIGNALduino.pm
UPD 2020-06-15_17:41:39 17876 FHEM/10_FS10.pm
UPD 2020-05-26_11:51:12 20465 FHEM/10_SD_GT.pm
UPD 2016-09-18_21:22:06 10111 FHEM/14_BresserTemeo.pm
Expand Down