Skip to content

Commit

Permalink
Run all tests with user-specified runner (#1046)
Browse files Browse the repository at this point in the history
  • Loading branch information
perazz committed Jun 22, 2024
2 parents 40968b1 + c309322 commit 06cdf47
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
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

0 comments on commit 06cdf47

Please sign in to comment.