Project

General

Profile

Actions

action #162866

closed

Compile test does not work without TEST_PG set on current Tumbleweed 20240622 size:S

Added by jbaier_cz 6 months ago. Updated 5 months ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Regressions/Crashes
Target version:
Start date:
2024-06-25
Due date:
% Done:

0%

Estimated time:

Description

Observation

Compile test fails

Steps to reproduce

From within the openQA checkout

# podman run --rm -ti -v .:/work -w /work opensuse/leap:15.6 bash -c 'zypper in -y openQA-devel &>/dev/null && perl -I lib -c t/basic.t'
t/basic.t syntax OK
podman run --rm -ti -v .:/work -w /work opensuse/tumbleweed:latest bash -c 'zypper in -y openQA-devel &>/dev/null && perl -I lib -c t/basic.t'

Suggestions

  • Read comments about upstream changes that triggered that new behaviour
  • The problem is triggered by code in t/lib/OpenQA/Test/Database.pm doing plan skip_all => 'set TEST_PG to e.g. "DBI:Pg:dbname=test" to enable this test' unless $ENV{TEST_PG}; which effectively exits from BEGIN so reconsider that
  • Use use_ok 'OpenQA::Test::Database' or require OpenQA::Test::Database instead of use OpenQA::Test::Database. Where? one line in t/lib/OpenQA/SeleniumTest.pm already does that, git grep 'use OpenQA::Test::Database' shows other uses
Actions #1

Updated by okurz 6 months ago

  • Subject changed from Compile test does not work without TEST_PG set to Compile test does not work without TEST_PG set on current Tumbleweed 20240622
  • Category set to Regressions/Crashes
Actions #2

Updated by tinita 6 months ago

  • Status changed from New to In Progress
  • Assignee set to tinita

I asked in the #toolchain channel on irc.perl.org
reproducer shows it changed in 5.38: https://gist.github.com/perlpunk/3042dcdd67c81fb404fe4e2395bb0b49 and it doesn't seem to be Test::More. Couldn't find anything in https://metacpan.org/release/PEVANS/perl-5.38.2/view/pod/perl5380delta.pod

Meanwhile, a simple workaround for use can be to use use_ok 'OpenQA::Test::Database' or require OpenQA::Test::Database instead of use OpenQA::Test::Database.

Actions #3

Updated by tinita 6 months ago

Fast answer: https://perldoc.perl.org/perl5380delta#INIT-blocks-no-longer-run-after-an-exit()-in-BEGIN

INIT blocks no longer run after an exit() in BEGIN
INIT blocks will no longer run after an exit() performed inside of a BEGIN. This means that the combination of the -v option and the -c option no longer executes a compile check as well as showing the perl version. The -v > option executes an exit(0) after printing the version information inside of a BEGIN block, and the -c check is implemented by using INIT hooks, resulting in the -v option taking precedence.

< ilmari> because skip_all does exit, and use is BEGIN, the -c test in INIT doesn't run

Actions #4

Updated by openqa_review 6 months ago

  • Due date set to 2024-07-11

Setting due date based on mean cycle time of SUSE QE Tools

Actions #5

Updated by tinita 6 months ago

  • Status changed from In Progress to Workable
Actions #6

Updated by okurz 6 months ago

  • Status changed from Workable to New
Actions #7

Updated by tinita 5 months ago

  • Assignee deleted (tinita)
Actions #8

Updated by okurz 5 months ago

  • Due date deleted (2024-07-11)
Actions #9

Updated by mkittler 5 months ago

  • Subject changed from Compile test does not work without TEST_PG set on current Tumbleweed 20240622 to Compile test does not work without TEST_PG set on current Tumbleweed 20240622 size:S
  • Description updated (diff)
  • Status changed from New to Workable
Actions #10

Updated by tinita 5 months ago

  • Status changed from Workable to In Progress
  • Assignee set to tinita
Actions #11

Updated by tinita 5 months ago

  • Status changed from In Progress to Feedback

https://github.com/os-autoinst/openQA/pull/5756 Use require for loading OpenQA::Test::Database

Actions #12

Updated by tinita 5 months ago

  • Status changed from Feedback to Workable
  • Assignee deleted (tinita)
Actions #13

Updated by tinita 5 months ago

  • Status changed from Workable to Resolved
  • Assignee set to tinita
Actions

Also available in: Atom PDF