Skip to content

Conversation

@ghost
Copy link

@ghost ghost commented Mar 16, 2021

#692 adds a new parameter. However not specifying its value will give the following message in t/test01.t (see Travis output from the PR) :

Use of uninitialized value $val in numeric gt (>) at /home/travis/build/zonemaster/zonemaster-backend/build_dir/lib/Zonemaster/Backend/Config.pm line 331.

This PR passes the default value (set to 600 seconds = 10 minutes) to the val() call if the the parameter age_reuse_previous_test does not exist.

Get the default value if the parameter 'age_reuse_previous_test' does
not exist.
@ghost ghost added this to the v2021.1 milestone Mar 16, 2021
@ghost ghost requested review from matsduf and mattias-p March 16, 2021 17:32
@matsduf matsduf added A-Code T-Bug Type: Bug in software or error in test case description labels Mar 16, 2021
@matsduf
Copy link
Contributor

matsduf commented Mar 16, 2021

@PNAX, could you add how to test this PR at release testing?

@ghost
Copy link
Author

ghost commented Mar 18, 2021

This PR on its own is just fixing the code of #692 so that we don't call an uninitialized value.

Before, make test give an ouptut like the following :

PERL_DL_NONLAZY=1 "/usr/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'inc', 'blib/lib', 'blib/arch')" t/*.t                                        
t/test01.t ................ 1/? Use of uninitialized value $val in numeric gt (>) at /zonemaster/zonemaster-backend/blib/lib/Zonemaster/Backend/Config.pm line 331.                                     
t/test01.t ................ 11/? Use of uninitialized value $val in numeric gt (>) at /zonemaster/zonemaster-backend/blib/lib/Zonemaster/Backend/Config.pm line 331.                                    
t/test01.t ................ ok
t/test_validate_syntax.t .. ok
All tests successful.

With this PR, the output should be as (no more complaining message about uninitialized value) :

PERL_DL_NONLAZY=1 "/usr/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'inc', 'blib/lib', 'blib/arch')" t/*.t                                        
t/test01.t ................ ok
t/test_validate_syntax.t .. ok
All tests successful.

By the way I don't know why the tests are passing even though there is this uninitialized variable.

@matsduf
Copy link
Contributor

matsduf commented Mar 18, 2021

By the way I don't know why the tests are passing even though there is this uninitialized variable.

Because it is just a warning and the undefined value is handled as if zero.

@matsduf
Copy link
Contributor

matsduf commented Mar 22, 2021

@PNAX, please merge.

@ghost ghost merged commit 851c721 into zonemaster:develop Mar 23, 2021
@ghost ghost deleted the fix-undef-value branch April 29, 2021 18:13
@mattias-p
Copy link
Member

There's a unit test for this now:

is $config->ZONEMASTER_age_reuse_previous_test, 600, 'default: ZONEMASTER.age_reuse_previous_test';

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-Bug Type: Bug in software or error in test case description

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants