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

Run all tests with user-specified runner #1046

Merged
merged 8 commits into from
Jun 22, 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
22 changes: 22 additions & 0 deletions ci/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,36 @@ do
echo "$filename"
"$fpm" ${cmdrun[$j]} $filename
test -e $filename.txt
# non-i-th tests should not have run
for k in ${others[@]}
do
test ! -e ${targets[$k]}$k.txt
done
done
done

# Test building all targets and with runner
if [[ "$(which time)" ]]; then
targets=( "run" "run --example" "test" )
names=( "run" "example" "test" )
cmdrun=( " " " --runner time" )
for j in {0..2}
do
for i in {0..1}
do
rm -f *.txt
"$fpm" ${targets[$j]}${cmdrun[$i]}
# all targets should have run
for k in ${cases[@]}
do
test -e ${names[$j]}$k.txt
done
done
done
fi
popd


pushd auto_discovery_off
"$fpm" build
"$fpm" run --target auto_discovery_off
Expand Down
10 changes: 2 additions & 8 deletions src/fpm.f90
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,6 @@ subroutine cmd_run(settings,test)
integer :: run_scope,firsterror
integer, allocatable :: stat(:),target_ID(:)
character(len=:),allocatable :: line
logical :: toomany

call get_package_data(package, "fpm.toml", error, apply_defaults=.true.)
if (allocated(error)) then
Expand Down Expand Up @@ -547,13 +546,8 @@ subroutine cmd_run(settings,test)
end if

! Check all names are valid
! or no name and found more than one file
toomany= size(settings%name)==0 .and. size(executables)>1
if ( any(.not.found) &
& .or. &
& ( (toomany .and. .not.test) .or. (toomany .and. settings%runner /= '') ) &
& .and. &
& .not.settings%list) then
! or no name and found more than one file
if ( any(.not.found) ) then
line=join(settings%name)
if(line/='.')then ! do not report these special strings
if(any(.not.found))then
Expand Down
Loading