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

Make test actions run only once #1792

Merged
merged 3 commits into from
Nov 18, 2024
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
31 changes: 13 additions & 18 deletions src/alr/alr-commands-test.adb
Original file line number Diff line number Diff line change
Expand Up @@ -317,24 +317,18 @@ package body Alr.Commands.Test is
else R.Base_Folder))
with Unreferenced;
begin
for Action of R.On_Platform_Actions
(Platform.Properties,
(Alire.Properties.Actions.Test => True,
others => False))
loop
Alire.Properties.Actions.Executor.Execute_Actions
(Release => R,
Env => Platform.Properties,
Moment => Alire.Properties.Actions.Test,
Capture => True,
Err_To_Out => True,
Code => Exit_Code,
Output => Output);

if Exit_Code /= 0 then
raise Child_Failed;
end if;
end loop;
Alire.Properties.Actions.Executor.Execute_Actions
(Release => R,
Env => Platform.Properties,
Moment => Alire.Properties.Actions.Test,
Capture => True,
Err_To_Out => True,
Code => Exit_Code,
Output => Output);

if Exit_Code /= 0 then
raise Child_Failed;
end if;
end;
end Custom_Test;

Expand Down Expand Up @@ -393,6 +387,7 @@ package body Alr.Commands.Test is
when E : Alire.Checked_Error =>
Reporters.End_Test (R, Testing.Fail, Clock - Start, Output);
Trace.Detail (Output.Flatten (Newline));
Alire.Errors.Pretty_Print (Alire.Errors.Get (E));
Some_Failed := True;

Output.Append ("****** Checked Error raised during test:");
Expand Down
9 changes: 7 additions & 2 deletions testsuite/tests/test/action-test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""

from drivers.alr import run_alr
from drivers.helpers import check_line_in
from drivers.helpers import content_of

from glob import glob

Expand All @@ -16,7 +16,12 @@
chdir('alire')

# Check the magic string in the test output log
check_line_in(glob('*.log')[0], 'ABRACADABRA')
log_contents = content_of(glob('*.log')[0])
magic_string_count = log_contents.count("ABRACADABRA")
if magic_string_count == 0:
assert False, 'action not run'
elif magic_string_count > 1:
assert False, 'action ran more than once'


print('SUCCESS')
Loading