From 766e0e9a4f03e4bcf66e0926950b5425ee11c223 Mon Sep 17 00:00:00 2001 From: "Alejandro R. Mosteo" Date: Mon, 28 Oct 2024 14:10:02 +0100 Subject: [PATCH 1/2] fix: propagate verbosity to test run --- src/alr/alr-commands-test.adb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/alr/alr-commands-test.adb b/src/alr/alr-commands-test.adb index d98838d92..6ddf2fb11 100644 --- a/src/alr/alr-commands-test.adb +++ b/src/alr/alr-commands-test.adb @@ -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); From 1fd6d28176306ec997033134b9f569860bafd61f Mon Sep 17 00:00:00 2001 From: "Alejandro R. Mosteo" Date: Thu, 9 Jan 2025 17:19:06 +0100 Subject: [PATCH 2/2] New test --- .../tests/test/verbose-propagation/test.py | 33 +++++++++++++++++++ .../tests/test/verbose-propagation/test.yaml | 4 +++ 2 files changed, 37 insertions(+) create mode 100644 testsuite/tests/test/verbose-propagation/test.py create mode 100644 testsuite/tests/test/verbose-propagation/test.yaml diff --git a/testsuite/tests/test/verbose-propagation/test.py b/testsuite/tests/test/verbose-propagation/test.py new file mode 100644 index 000000000..23d9aafc7 --- /dev/null +++ b/testsuite/tests/test/verbose-propagation/test.py @@ -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") diff --git a/testsuite/tests/test/verbose-propagation/test.yaml b/testsuite/tests/test/verbose-propagation/test.yaml new file mode 100644 index 000000000..702010525 --- /dev/null +++ b/testsuite/tests/test/verbose-propagation/test.yaml @@ -0,0 +1,4 @@ +driver: python-script +build_mode: both +indexes: + compiler_only_index: {}