Skip to content

Commit

Permalink
Print diagnostic messages on stderr, not stdout
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-goode committed Aug 29, 2024
1 parent 8af2c71 commit d8a3a6f
Show file tree
Hide file tree
Showing 107 changed files with 4,350 additions and 2,879 deletions.
14 changes: 11 additions & 3 deletions dnf-behave-tests/common/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,17 @@ def then_stderr_is(context):

@behave.then("stderr matches line by line")
def then_stderr_matches_line_by_line(context):
out_lines = context.cmd_stderr.split('\n')
regexp_lines = context.text.split('\n')
lines_match_to_regexps_line_by_line(out_lines, regexp_lines)
"""
Checks that each line of stderr matches respective line in regular expressions.
Supports the <REPOSYNC> in the same way as the step "stderr is"
"""
found = context.cmd_stderr.split('\n')
expected = context.text.split('\n')

dnf5_mode = hasattr(context, "dnf5_mode") and context.dnf5_mode
clean_expected, clean_found = handle_reposync(expected, found, dnf5_mode)

lines_match_to_regexps_line_by_line(clean_found, clean_expected)


@behave.then("{dnf_version:dnf_version} exit code is {exitcode}")
Expand Down
243 changes: 144 additions & 99 deletions dnf-behave-tests/dnf/append_options.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,191 +14,236 @@ Background: Enable repository and set excludes in configuration
Scenario: Test that excludes from config file are applied
When I execute dnf with args "repoquery abcde lame lz4 wget"
Then the exit code is 0
And stderr is
"""
<REPOSYNC>
"""
And stdout is
"""
<REPOSYNC>
abcde-0:2.9.3-1.fc29.noarch
abcde-0:2.9.3-1.fc29.src
wget-0:1.19.6-5.fc29.src
wget-0:1.19.6-5.fc29.x86_64
"""
"""
abcde-0:2.9.3-1.fc29.noarch
abcde-0:2.9.3-1.fc29.src
wget-0:1.19.6-5.fc29.src
wget-0:1.19.6-5.fc29.x86_64
"""


Scenario: Test adding of excludes
When I execute dnf with args "--exclude=lz4 --exclude=wget repoquery abcde lame lz4 wget"
Then the exit code is 0
And stderr is
"""
<REPOSYNC>
"""
And stdout is
"""
<REPOSYNC>
abcde-0:2.9.3-1.fc29.noarch
abcde-0:2.9.3-1.fc29.src
"""
"""
abcde-0:2.9.3-1.fc29.noarch
abcde-0:2.9.3-1.fc29.src
"""


Scenario: Test adding of excludes using --setopt
When I execute dnf with args "--setopt=excludepkgs=lz4 --setopt=excludepkgs=wget repoquery abcde lame lz4 wget"
Then the exit code is 0
And stderr is
"""
<REPOSYNC>
"""
And stdout is
"""
<REPOSYNC>
abcde-0:2.9.3-1.fc29.noarch
abcde-0:2.9.3-1.fc29.src
"""
"""
abcde-0:2.9.3-1.fc29.noarch
abcde-0:2.9.3-1.fc29.src
"""


Scenario: Test adding of excludes short notation
When I execute dnf with args "--exclude=lz4,wget repoquery abcde lame lz4 wget"
Then the exit code is 0
And stderr is
"""
<REPOSYNC>
"""
And stdout is
"""
<REPOSYNC>
abcde-0:2.9.3-1.fc29.noarch
abcde-0:2.9.3-1.fc29.src
"""
"""
abcde-0:2.9.3-1.fc29.noarch
abcde-0:2.9.3-1.fc29.src
"""


Scenario: Test adding of excludes short notation using --setopt
When I execute dnf with args "--setopt=excludepkgs=lz4,wget repoquery abcde lame lz4 wget"
Then the exit code is 0
And stderr is
"""
<REPOSYNC>
"""
And stdout is
"""
<REPOSYNC>
abcde-0:2.9.3-1.fc29.noarch
abcde-0:2.9.3-1.fc29.src
"""
"""
abcde-0:2.9.3-1.fc29.noarch
abcde-0:2.9.3-1.fc29.src
"""


Scenario: Test removing of existing excludes
When I execute dnf with args "--exclude= repoquery abcde lame lz4 wget"
Then the exit code is 0
And stderr is
"""
<REPOSYNC>
"""
And stdout is
"""
<REPOSYNC>
abcde-0:2.9.3-1.fc29.noarch
abcde-0:2.9.3-1.fc29.src
lame-0:3.100-5.fc29.src
lame-0:3.100-5.fc29.x86_64
lz4-0:1.8.2-2.fc29.i686
lz4-0:1.8.2-2.fc29.src
lz4-0:1.8.2-2.fc29.x86_64
wget-0:1.19.6-5.fc29.src
wget-0:1.19.6-5.fc29.x86_64
"""
"""
abcde-0:2.9.3-1.fc29.noarch
abcde-0:2.9.3-1.fc29.src
lame-0:3.100-5.fc29.src
lame-0:3.100-5.fc29.x86_64
lz4-0:1.8.2-2.fc29.i686
lz4-0:1.8.2-2.fc29.src
lz4-0:1.8.2-2.fc29.x86_64
wget-0:1.19.6-5.fc29.src
wget-0:1.19.6-5.fc29.x86_64
"""


Scenario: Test removing of existing excludes using --setopt
When I execute dnf with args "--setopt=excludepkgs= repoquery abcde lame lz4 wget"
Then the exit code is 0
And stderr is
"""
<REPOSYNC>
"""
And stdout is
"""
<REPOSYNC>
abcde-0:2.9.3-1.fc29.noarch
abcde-0:2.9.3-1.fc29.src
lame-0:3.100-5.fc29.src
lame-0:3.100-5.fc29.x86_64
lz4-0:1.8.2-2.fc29.i686
lz4-0:1.8.2-2.fc29.src
lz4-0:1.8.2-2.fc29.x86_64
wget-0:1.19.6-5.fc29.src
wget-0:1.19.6-5.fc29.x86_64
"""
"""
abcde-0:2.9.3-1.fc29.noarch
abcde-0:2.9.3-1.fc29.src
lame-0:3.100-5.fc29.src
lame-0:3.100-5.fc29.x86_64
lz4-0:1.8.2-2.fc29.i686
lz4-0:1.8.2-2.fc29.src
lz4-0:1.8.2-2.fc29.x86_64
wget-0:1.19.6-5.fc29.src
wget-0:1.19.6-5.fc29.x86_64
"""


Scenario: Test replacing of existing excludes
When I execute dnf with args "--exclude= --exclude=lz4 --exclude=wget repoquery abcde lame lz4 wget"
Then the exit code is 0
And stderr is
"""
<REPOSYNC>
"""
And stdout is
"""
<REPOSYNC>
abcde-0:2.9.3-1.fc29.noarch
abcde-0:2.9.3-1.fc29.src
lame-0:3.100-5.fc29.src
lame-0:3.100-5.fc29.x86_64
"""
"""
abcde-0:2.9.3-1.fc29.noarch
abcde-0:2.9.3-1.fc29.src
lame-0:3.100-5.fc29.src
lame-0:3.100-5.fc29.x86_64
"""


Scenario: Test replacing of existing excludes using --setopt
When I execute dnf with args "--setopt=excludepkgs= --setopt=excludepkgs=lz4 --setopt=excludepkgs=wget repoquery abcde lame lz4 wget"
Then the exit code is 0
And stderr is
"""
<REPOSYNC>
"""
And stdout is
"""
<REPOSYNC>
abcde-0:2.9.3-1.fc29.noarch
abcde-0:2.9.3-1.fc29.src
lame-0:3.100-5.fc29.src
lame-0:3.100-5.fc29.x86_64
"""
"""
abcde-0:2.9.3-1.fc29.noarch
abcde-0:2.9.3-1.fc29.src
lame-0:3.100-5.fc29.src
lame-0:3.100-5.fc29.x86_64
"""


Scenario: Test replacing of existing excludes short notation
When I execute dnf with args "--exclude=,lz4,wget repoquery abcde lame lz4 wget"
Then the exit code is 0
And stderr is
"""
<REPOSYNC>
"""
And stdout is
"""
<REPOSYNC>
abcde-0:2.9.3-1.fc29.noarch
abcde-0:2.9.3-1.fc29.src
lame-0:3.100-5.fc29.src
lame-0:3.100-5.fc29.x86_64
"""
"""
abcde-0:2.9.3-1.fc29.noarch
abcde-0:2.9.3-1.fc29.src
lame-0:3.100-5.fc29.src
lame-0:3.100-5.fc29.x86_64
"""


Scenario: Test replacing of existing excludes short notation using --setopt
When I execute dnf with args "--setopt=excludepkgs=,lz4,wget repoquery abcde lame lz4 wget"
Then the exit code is 0
And stderr is
"""
<REPOSYNC>
"""
And stdout is
"""
<REPOSYNC>
abcde-0:2.9.3-1.fc29.noarch
abcde-0:2.9.3-1.fc29.src
lame-0:3.100-5.fc29.src
lame-0:3.100-5.fc29.x86_64
"""
"""
abcde-0:2.9.3-1.fc29.noarch
abcde-0:2.9.3-1.fc29.src
lame-0:3.100-5.fc29.src
lame-0:3.100-5.fc29.x86_64
"""


@bz1788154
Scenario: Test adding excludes (empty values in the middle of short notation are ignored)
When I execute dnf with args "--exclude=lz4,,wget repoquery abcde lame lz4 wget"
Then the exit code is 0
And stderr is
"""
<REPOSYNC>
"""
And stdout is
"""
<REPOSYNC>
abcde-0:2.9.3-1.fc29.noarch
abcde-0:2.9.3-1.fc29.src
"""
"""
abcde-0:2.9.3-1.fc29.noarch
abcde-0:2.9.3-1.fc29.src
"""


@bz1788154
Scenario: Test adding excludes (empty values in the middle of short notation are ignored) using --setopt
When I execute dnf with args "--setopt=excludepkgs=lz4,,wget repoquery abcde lame lz4 wget"
Then the exit code is 0
And stderr is
"""
<REPOSYNC>
"""
And stdout is
"""
<REPOSYNC>
abcde-0:2.9.3-1.fc29.noarch
abcde-0:2.9.3-1.fc29.src
"""
"""
abcde-0:2.9.3-1.fc29.noarch
abcde-0:2.9.3-1.fc29.src
"""


@bz1788154
Scenario: Test adding excludes (empty value at the end of short notation is ignored)
When I execute dnf with args "--exclude=lz4,wget, repoquery abcde lame lz4 wget"
Then the exit code is 0
And stderr is
"""
<REPOSYNC>
"""
And stdout is
"""
<REPOSYNC>
abcde-0:2.9.3-1.fc29.noarch
abcde-0:2.9.3-1.fc29.src
"""
"""
abcde-0:2.9.3-1.fc29.noarch
abcde-0:2.9.3-1.fc29.src
"""


@bz1788154
Scenario: Test adding excludes (empty value at the end of short notation is ignored) using --setopt
When I execute dnf with args "--setopt=excludepkgs=lz4,wget, repoquery abcde lame lz4 wget"
Then the exit code is 0
And stderr is
"""
<REPOSYNC>
"""
And stdout is
"""
<REPOSYNC>
abcde-0:2.9.3-1.fc29.noarch
abcde-0:2.9.3-1.fc29.src
"""
"""
abcde-0:2.9.3-1.fc29.noarch
abcde-0:2.9.3-1.fc29.src
"""
3 changes: 3 additions & 0 deletions dnf-behave-tests/dnf/broken-dependencies-report.feature
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Scenario: Broken dependencies are reported when strict and best options are off
Then the exit code is 0
And stderr is
"""
<REPOSYNC>
Problem: package postgresql-9.6.5-1.fc29.x86_64 from dnf-ci-fedora requires libpq.so.5()(64bit), but none of the providers can be installed
- package postgresql-9.6.5-1.fc29.x86_64 from dnf-ci-fedora requires postgresql-libs(x86-64) = 9.6.5-1.fc29, but none of the providers can be installed
- conflicting requests
Expand All @@ -33,6 +34,7 @@ Scenario: Broken dependencies are reported when strict option is off and best op
Then the exit code is 0
And stderr is
"""
<REPOSYNC>
Problem: package postgresql-9.6.5-1.fc29.x86_64 from dnf-ci-fedora requires libpq.so.5()(64bit), but none of the providers can be installed
- package postgresql-9.6.5-1.fc29.x86_64 from dnf-ci-fedora requires postgresql-libs(x86-64) = 9.6.5-1.fc29, but none of the providers can be installed
- conflicting requests
Expand All @@ -50,6 +52,7 @@ Scenario: Broken dependencies are reported when skip-broken and best options are
Then the exit code is 0
And stderr is
"""
<REPOSYNC>
Problem: package postgresql-9.6.5-1.fc29.x86_64 from dnf-ci-fedora requires libpq.so.5()(64bit), but none of the providers can be installed
- package postgresql-9.6.5-1.fc29.x86_64 from dnf-ci-fedora requires postgresql-libs(x86-64) = 9.6.5-1.fc29, but none of the providers can be installed
- conflicting requests
Expand Down
Loading

0 comments on commit d8a3a6f

Please sign in to comment.