diff --git a/ci/run_tests.sh b/ci/run_tests.sh index 0b7fc8e057..c1abbb5e7f 100755 --- a/ci/run_tests.sh +++ b/ci/run_tests.sh @@ -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 diff --git a/src/fpm.f90 b/src/fpm.f90 index b162ff2827..561fb4e5e9 100644 --- a/src/fpm.f90 +++ b/src/fpm.f90 @@ -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 @@ -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