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

feat: propagate verbosity in alr test #1817

Merged
merged 2 commits into from
Jan 10, 2025
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 src/alr/alr-commands-test.adb
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,12 @@ package body Alr.Commands.Test is
Empty_Vector
& "-d"
& "-n"
& (if Alire.Log_Level >= Detail
then To_Vector ("-v")
else Empty_Vector)
& (if Alire.Log_Level >= Debug
then To_Vector ("-v")
else Empty_Vector)
& (if Alire.Force
then To_Vector ("--force")
else Empty_Vector);
Expand Down
33 changes: 33 additions & 0 deletions testsuite/tests/test/verbose-propagation/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""
Check that when running `alr test` with the verbose flag, the spawned command
of the default test action inherits the verbosity flag.
"""

import os
from drivers.alr import init_local_crate, run_alr
from drivers.asserts import assert_not_substring, assert_substring
from drivers.helpers import content_of

# Run `alr test` in a local crate for this test with increasing verbosity
# levels; we check the existence of expected output in the test log. The
# selected messages are representative of the log level at play.

LOGFILE = os.path.join("alire", "alr_test_local.log")

init_local_crate()

# Default log level
run_alr("test", quiet=False)
assert_not_substring("alr build done", content_of(LOGFILE))

# Verbose
run_alr("-v", "test", quiet=False)
assert_substring("alr build done", content_of(LOGFILE))
assert_not_substring("Setenv ALIRE=True", content_of(LOGFILE))

# More verbose
run_alr("-vv", "test", quiet=False)
assert_substring("alr build done", content_of(LOGFILE))
assert_substring("Setenv ALIRE=True", content_of(LOGFILE))

print("SUCCESS")
4 changes: 4 additions & 0 deletions testsuite/tests/test/verbose-propagation/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
driver: python-script
build_mode: both
indexes:
compiler_only_index: {}
Loading