Skip to content

Commit 06cdf47

Browse files
authored
Run all tests with user-specified runner (#1046)
2 parents 40968b1 + c309322 commit 06cdf47

File tree

2 files changed

+24
-8
lines changed

2 files changed

+24
-8
lines changed

ci/run_tests.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,36 @@ do
8181
echo "$filename"
8282
"$fpm" ${cmdrun[$j]} $filename
8383
test -e $filename.txt
84+
# non-i-th tests should not have run
8485
for k in ${others[@]}
8586
do
8687
test ! -e ${targets[$k]}$k.txt
8788
done
8889
done
8990
done
91+
92+
# Test building all targets and with runner
93+
if [[ "$(which time)" ]]; then
94+
targets=( "run" "run --example" "test" )
95+
names=( "run" "example" "test" )
96+
cmdrun=( " " " --runner time" )
97+
for j in {0..2}
98+
do
99+
for i in {0..1}
100+
do
101+
rm -f *.txt
102+
"$fpm" ${targets[$j]}${cmdrun[$i]}
103+
# all targets should have run
104+
for k in ${cases[@]}
105+
do
106+
test -e ${names[$j]}$k.txt
107+
done
108+
done
109+
done
110+
fi
90111
popd
91112

113+
92114
pushd auto_discovery_off
93115
"$fpm" build
94116
"$fpm" run --target auto_discovery_off

src/fpm.f90

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,6 @@ subroutine cmd_run(settings,test)
486486
integer :: run_scope,firsterror
487487
integer, allocatable :: stat(:),target_ID(:)
488488
character(len=:),allocatable :: line
489-
logical :: toomany
490489

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

549548
! Check all names are valid
550-
! or no name and found more than one file
551-
toomany= size(settings%name)==0 .and. size(executables)>1
552-
if ( any(.not.found) &
553-
& .or. &
554-
& ( (toomany .and. .not.test) .or. (toomany .and. settings%runner /= '') ) &
555-
& .and. &
556-
& .not.settings%list) then
549+
! or no name and found more than one file
550+
if ( any(.not.found) ) then
557551
line=join(settings%name)
558552
if(line/='.')then ! do not report these special strings
559553
if(any(.not.found))then

0 commit comments

Comments
 (0)