fortran generated test: add code to reveal issue

used with Issue #7265
pull/7321/head
Michael Hirsch 5 years ago committed by Nirbheek Chauhan
parent 977dc4d19f
commit e2379148a6
  1. 7
      test cases/fortran/7 generated/meson.build
  2. 4
      test cases/fortran/7 generated/mod1.fpp
  3. 6
      test cases/fortran/7 generated/mod2.fpp
  4. 6
      test cases/fortran/7 generated/mod3.fpp
  5. 9
      test cases/fortran/7 generated/prog.f90

@ -6,6 +6,11 @@ project('generated', 'fortran')
conf_data = configuration_data()
conf_data.set('ONE', 1)
conf_data.set('TWO', 2)
conf_data.set('THREE', 3)
outfile = configure_file(
input : 'mod3.fpp', output : 'mod3.f90', configuration : conf_data)
three = library('mod3', meson.current_build_dir() / 'mod3.f90')
templates_basenames = ['mod2', 'mod1']
generated_sources = []
@ -18,5 +23,5 @@ foreach template_basename : templates_basenames
endforeach
sources = ['prog.f90'] + generated_sources
exe = executable('generated', sources)
exe = executable('generated', sources, link_with: three)
test('generated', exe)

@ -1,6 +1,6 @@
module mod1
implicit none
implicit none
integer, parameter :: modval1 = @ONE@
integer, parameter :: modval1 = @ONE@
end module mod1

@ -1,7 +1,7 @@
module mod2
use mod1
implicit none
use mod1, only : modval1
implicit none
integer, parameter :: modval2 = @TWO@
integer, parameter :: modval2 = @TWO@
end module mod2

@ -0,0 +1,6 @@
module mod3
implicit none
integer, parameter :: modval3 = @THREE@
end module mod3

@ -1,7 +1,8 @@
program prog
use mod2
program generated
use mod2, only : modval1, modval2
use mod3, only : modval3
implicit none
if (modval1 + modval2 /= 3) stop 1
if (modval1 + modval2 + modval3 /= 6) error stop
end program prog
end program generated

Loading…
Cancel
Save