diff --git a/flang/test/Semantics/modfile01.f90 b/flang/test/Semantics/modfile01.f90 --- a/flang/test/Semantics/modfile01.f90 +++ b/flang/test/Semantics/modfile01.f90 @@ -1,6 +1,20 @@ -! RUN: %S/test_modfile.sh %s %t %f18 +! RUN: mkdir -p %t.dir +! RUN: %f18 -module %t.dir -fdebug-resolve-names -fparse-only %s + +! Check that no additional module files have been created. +! RUN: ls -l %t.dir/*.mod | wc -l | FileCheck --check-prefix=NO_MODFILES %s +! NO_MODFILES: 4 + +! Module files start with a 3-byte UTF BOM which lit struggles with. Remove it +! with sed before lit sees it. +! RUN: FileCheck --input-file=%t.dir/m1.mod --check-prefix=MOD-M1 %s +! RUN: FileCheck --input-file=%t.dir/m2.mod --check-prefix=MOD-M2 %s +! RUN: FileCheck --input-file=%t.dir/m3.mod --check-prefix=MOD-M3 %s +! RUN: FileCheck --input-file=%t.dir/m4.mod --check-prefix=MOD-M4 %s + + ! Check correct modfile generation for type with private component. -module m +module m1 integer :: i integer, private :: j type :: t @@ -12,18 +26,17 @@ type(t) :: x end -!Expect: m.mod -!module m -!integer(4)::i -!integer(4),private::j -!type::t -!integer(4)::i -!integer(4),private::j -!end type -!type,private::u -!end type -!type(t)::x -!end +! MOD-M1: module m1 +! MOD-M1-NEXT: integer(4)::i +! MOD-M1-NEXT: integer(4),private::j +! MOD-M1-NEXT: type::t +! MOD-M1-NEXT: integer(4)::i +! MOD-M1-NEXT: integer(4),private::j +! MOD-M1-NEXT: end type +! MOD-M1-NEXT: type,private::u +! MOD-M1-NEXT: end type +! MOD-M1-NEXT: type(t)::x +! MOD-M1-NEXT: end ! Check correct modfile generation for type with private module procedure. @@ -36,15 +49,14 @@ end end -!Expect: m2.mod -!module m2 -! private::s1 -!contains -! subroutine s1() -! end -! subroutine s2() -! end -!end +! MOD-M2: module m2 +! MOD-M2-NEXT: private::s1 +! MOD-M2-NEXT: contains +! MOD-M2-NEXT: subroutine s1() +! MOD-M2-NEXT: end +! MOD-M2-NEXT: subroutine s2() +! MOD-M2-NEXT: end +! MOD-M2-NEXT: end module m3 private @@ -56,17 +68,16 @@ end end -!Expect: m3.mod -!module m3 -! private::f2 -!contains -! function f1() -! real(4)::f1 -! end -! function f2() -! real(4)::f2 -! end -!end +! MOD-M3: module m3 +! MOD-M3-NEXT: private::f2 +! MOD-M3-NEXT: contains +! MOD-M3-NEXT: function f1() +! MOD-M3-NEXT: real(4)::f1 +! MOD-M3-NEXT: end +! MOD-M3-NEXT: function f2() +! MOD-M3-NEXT: real(4)::f2 +! MOD-M3-NEXT: end +! MOD-M3-NEXT: end ! Test optional dummy procedure module m4 @@ -81,15 +92,15 @@ end end -!Expect: m4.mod -!module m4 -!contains -! subroutine s(f) -! optional::f -! interface -! recursive function f() -! logical(4)::f -! end -! end interface -! end -!end +! MOD-M4: module m4 +! MOD-M4-NEXT: contains +! MOD-M4-NEXT: subroutine s(f) +! MOD-M4-NEXT: optional::f +! MOD-M4-NEXT: interface +! MOD-M4-NEXT: recursive function f() +! MOD-M4-NEXT: logical(4)::f +! MOD-M4-NEXT: end +! MOD-M4-NEXT: end interface +! MOD-M4-NEXT: end +! MOD-M4-NEXT: end +