public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [review] gdb/testsuite: Use -J option when compiling Fortran tests
@ 2019-11-28  0:24 Andrew Burgess (Code Review)
  2019-12-04 18:14 ` Tom Tromey (Code Review)
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Andrew Burgess (Code Review) @ 2019-11-28  0:24 UTC (permalink / raw)
  To: gdb-patches

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/733
......................................................................

gdb/testsuite: Use -J option when compiling Fortran tests

When compiling Fortran tests (e.g. gdb.fortran/info-modules.exp), the
Fotran compile produces .mod files.  These files contain details of
compiled modules that are then consumed by the compiler when compiling
other files that USE a module.

Currently the compiler writes the .mod files into its current
directory, so for us this turns out to be 'build/gdb/testsuite/'.
This means that .mod files can be shared between tests, which seems
against the spirit of the GDB testsuite; source files should be
compiled fresh for each test.

This commit adds the -J option to the compiler flags whenever we
compile a Fortran file, this option tells the compiler where to write,
and look for, .mod files.

After this commit there was one Fortran test that needed fixing, with
that fix in place all of the Fortran tests pass again, but now the
.mod files are now produced in the per-test output directories.

gdb/testsuite/ChangeLog:

	* lib/gdb.exp (gdb_compile): Add -J compiler option when building
	Fortran tests.
	* gdb.mi/mi-fortran-modules.exp: Compile source files in correct
	order.

Change-Id: I99444cf22d80e320093d3f3ed9abb8825f378e0b
---
M gdb/testsuite/ChangeLog
M gdb/testsuite/gdb.mi/mi-fortran-modules.exp
M gdb/testsuite/lib/gdb.exp
3 files changed, 18 insertions(+), 1 deletion(-)



diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 86f2130..3f67f73 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2019-11-28  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+	* lib/gdb.exp (gdb_compile): Add -J compiler option when building
+	Fortran tests.
+	* gdb.mi/mi-fortran-modules.exp: Compile source files in correct
+	order.
+
 2019-11-27  Andrew Burgess  <andrew.burgess@embecosm.com>
 
 	* gdb.fortran/info-modules.exp: Compile source files in correct
diff --git a/gdb/testsuite/gdb.mi/mi-fortran-modules.exp b/gdb/testsuite/gdb.mi/mi-fortran-modules.exp
index 640bb12..e979ab5 100644
--- a/gdb/testsuite/gdb.mi/mi-fortran-modules.exp
+++ b/gdb/testsuite/gdb.mi/mi-fortran-modules.exp
@@ -22,7 +22,7 @@
 standard_testfile "mi-fortran-modules.f90" "mi-fortran-modules-2.f90"
 
 if {[prepare_for_testing "failed to prepare" ${testfile} \
-	 [list $srcfile $srcfile2] {debug f90}]} {
+	 [list $srcfile2 $srcfile] {debug f90}]} {
     return -1
 }
 
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 828c91d..e743f11 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -3719,6 +3719,16 @@
     } else {
 	set new_options [universal_compile_options]
     }
+
+    # Place (and look for) Fortran `.mod` files in the output
+    # directory for this specific test.
+    if {[lsearch -exact $options f77] != -1 \
+	    || [lsearch -exact $options f90] != -1 } {
+	# Fortran compile.
+	set mod_path [standard_output_file ""]
+	lappend new_options "additional_flags=-J${mod_path}"
+    }
+
     set shlib_found 0
     set shlib_load 0
     set getting_compiler_info 0

-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I99444cf22d80e320093d3f3ed9abb8825f378e0b
Gerrit-Change-Number: 733
Gerrit-PatchSet: 1
Gerrit-Owner: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-MessageType: newchange

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [review] gdb/testsuite: Use -J option when compiling Fortran tests
  2019-11-28  0:24 [review] gdb/testsuite: Use -J option when compiling Fortran tests Andrew Burgess (Code Review)
@ 2019-12-04 18:14 ` Tom Tromey (Code Review)
  2019-12-04 20:37 ` [pushed] " Sourceware to Gerrit sync (Code Review)
  2019-12-04 20:37 ` Sourceware to Gerrit sync (Code Review)
  2 siblings, 0 replies; 4+ messages in thread
From: Tom Tromey (Code Review) @ 2019-12-04 18:14 UTC (permalink / raw)
  To: Andrew Burgess, gdb-patches

Tom Tromey has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/733
......................................................................


Patch Set 1: Code-Review+2

Thank you very much for doing this.  I vaguely recall wanting to do this
when I changed the test suite to use the "output/" directory, but I couldn't
figure out how.


-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I99444cf22d80e320093d3f3ed9abb8825f378e0b
Gerrit-Change-Number: 733
Gerrit-PatchSet: 1
Gerrit-Owner: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Reviewer: Tom Tromey <tromey@sourceware.org>
Gerrit-Comment-Date: Wed, 04 Dec 2019 18:13:58 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pushed] gdb/testsuite: Use -J option when compiling Fortran tests
  2019-11-28  0:24 [review] gdb/testsuite: Use -J option when compiling Fortran tests Andrew Burgess (Code Review)
  2019-12-04 18:14 ` Tom Tromey (Code Review)
@ 2019-12-04 20:37 ` Sourceware to Gerrit sync (Code Review)
  2019-12-04 20:37 ` Sourceware to Gerrit sync (Code Review)
  2 siblings, 0 replies; 4+ messages in thread
From: Sourceware to Gerrit sync (Code Review) @ 2019-12-04 20:37 UTC (permalink / raw)
  To: Andrew Burgess, Tom Tromey, gdb-patches

The original change was created by Andrew Burgess.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/733
......................................................................

gdb/testsuite: Use -J option when compiling Fortran tests

When compiling Fortran tests (e.g. gdb.fortran/info-modules.exp), the
Fotran compile produces .mod files.  These files contain details of
compiled modules that are then consumed by the compiler when compiling
other files that USE a module.

Currently the compiler writes the .mod files into its current
directory, so for us this turns out to be 'build/gdb/testsuite/'.
This means that .mod files can be shared between tests, which seems
against the spirit of the GDB testsuite; source files should be
compiled fresh for each test.

This commit adds the -J option to the compiler flags whenever we
compile a Fortran file, this option tells the compiler where to write,
and look for, .mod files.

After this commit there was one Fortran test that needed fixing, with
that fix in place all of the Fortran tests pass again, but now the
.mod files are now produced in the per-test output directories.

gdb/testsuite/ChangeLog:

	* lib/gdb.exp (gdb_compile): Add -J compiler option when building
	Fortran tests.
	* gdb.mi/mi-fortran-modules.exp: Compile source files in correct
	order.

Change-Id: I99444cf22d80e320093d3f3ed9abb8825f378e0b
---
M gdb/testsuite/ChangeLog
M gdb/testsuite/gdb.mi/mi-fortran-modules.exp
M gdb/testsuite/lib/gdb.exp
3 files changed, 18 insertions(+), 1 deletion(-)



diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 8df282c..173e82d 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,12 @@
 2019-12-04  Andrew Burgess  <andrew.burgess@embecosm.com>
 
+	* lib/gdb.exp (gdb_compile): Add -J compiler option when building
+	Fortran tests.
+	* gdb.mi/mi-fortran-modules.exp: Compile source files in correct
+	order.
+
+2019-12-04  Andrew Burgess  <andrew.burgess@embecosm.com>
+
 	* gdb.fortran/type-kinds.exp (test_cast_1_to_type_kind): Handle
 	casting to type with no kind specified.
 	(test_basic_parsing_of_type_kinds): Additional tests for types
diff --git a/gdb/testsuite/gdb.mi/mi-fortran-modules.exp b/gdb/testsuite/gdb.mi/mi-fortran-modules.exp
index 12a81a6..df48324 100644
--- a/gdb/testsuite/gdb.mi/mi-fortran-modules.exp
+++ b/gdb/testsuite/gdb.mi/mi-fortran-modules.exp
@@ -22,7 +22,7 @@
 standard_testfile "mi-fortran-modules.f90" "mi-fortran-modules-2.f90"
 
 if {[prepare_for_testing "failed to prepare" ${testfile} \
-	 [list $srcfile $srcfile2] {debug f90}]} {
+	 [list $srcfile2 $srcfile] {debug f90}]} {
     return -1
 }
 
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 4682f5d..aa77446 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -3719,6 +3719,16 @@
     } else {
 	set new_options [universal_compile_options]
     }
+
+    # Place (and look for) Fortran `.mod` files in the output
+    # directory for this specific test.
+    if {[lsearch -exact $options f77] != -1 \
+	    || [lsearch -exact $options f90] != -1 } {
+	# Fortran compile.
+	set mod_path [standard_output_file ""]
+	lappend new_options "additional_flags=-J${mod_path}"
+    }
+
     set shlib_found 0
     set shlib_load 0
     set getting_compiler_info 0

-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I99444cf22d80e320093d3f3ed9abb8825f378e0b
Gerrit-Change-Number: 733
Gerrit-PatchSet: 2
Gerrit-Owner: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Reviewer: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: newpatchset

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pushed] gdb/testsuite: Use -J option when compiling Fortran tests
  2019-11-28  0:24 [review] gdb/testsuite: Use -J option when compiling Fortran tests Andrew Burgess (Code Review)
  2019-12-04 18:14 ` Tom Tromey (Code Review)
  2019-12-04 20:37 ` [pushed] " Sourceware to Gerrit sync (Code Review)
@ 2019-12-04 20:37 ` Sourceware to Gerrit sync (Code Review)
  2 siblings, 0 replies; 4+ messages in thread
From: Sourceware to Gerrit sync (Code Review) @ 2019-12-04 20:37 UTC (permalink / raw)
  To: Andrew Burgess, gdb-patches; +Cc: Tom Tromey

Sourceware to Gerrit sync has submitted this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/733
......................................................................

gdb/testsuite: Use -J option when compiling Fortran tests

When compiling Fortran tests (e.g. gdb.fortran/info-modules.exp), the
Fotran compile produces .mod files.  These files contain details of
compiled modules that are then consumed by the compiler when compiling
other files that USE a module.

Currently the compiler writes the .mod files into its current
directory, so for us this turns out to be 'build/gdb/testsuite/'.
This means that .mod files can be shared between tests, which seems
against the spirit of the GDB testsuite; source files should be
compiled fresh for each test.

This commit adds the -J option to the compiler flags whenever we
compile a Fortran file, this option tells the compiler where to write,
and look for, .mod files.

After this commit there was one Fortran test that needed fixing, with
that fix in place all of the Fortran tests pass again, but now the
.mod files are now produced in the per-test output directories.

gdb/testsuite/ChangeLog:

	* lib/gdb.exp (gdb_compile): Add -J compiler option when building
	Fortran tests.
	* gdb.mi/mi-fortran-modules.exp: Compile source files in correct
	order.

Change-Id: I99444cf22d80e320093d3f3ed9abb8825f378e0b
---
M gdb/testsuite/ChangeLog
M gdb/testsuite/gdb.mi/mi-fortran-modules.exp
M gdb/testsuite/lib/gdb.exp
3 files changed, 18 insertions(+), 1 deletion(-)


diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 8df282c..173e82d 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,12 @@
 2019-12-04  Andrew Burgess  <andrew.burgess@embecosm.com>
 
+	* lib/gdb.exp (gdb_compile): Add -J compiler option when building
+	Fortran tests.
+	* gdb.mi/mi-fortran-modules.exp: Compile source files in correct
+	order.
+
+2019-12-04  Andrew Burgess  <andrew.burgess@embecosm.com>
+
 	* gdb.fortran/type-kinds.exp (test_cast_1_to_type_kind): Handle
 	casting to type with no kind specified.
 	(test_basic_parsing_of_type_kinds): Additional tests for types
diff --git a/gdb/testsuite/gdb.mi/mi-fortran-modules.exp b/gdb/testsuite/gdb.mi/mi-fortran-modules.exp
index 12a81a6..df48324 100644
--- a/gdb/testsuite/gdb.mi/mi-fortran-modules.exp
+++ b/gdb/testsuite/gdb.mi/mi-fortran-modules.exp
@@ -22,7 +22,7 @@
 standard_testfile "mi-fortran-modules.f90" "mi-fortran-modules-2.f90"
 
 if {[prepare_for_testing "failed to prepare" ${testfile} \
-	 [list $srcfile $srcfile2] {debug f90}]} {
+	 [list $srcfile2 $srcfile] {debug f90}]} {
     return -1
 }
 
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 4682f5d..aa77446 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -3719,6 +3719,16 @@
     } else {
 	set new_options [universal_compile_options]
     }
+
+    # Place (and look for) Fortran `.mod` files in the output
+    # directory for this specific test.
+    if {[lsearch -exact $options f77] != -1 \
+	    || [lsearch -exact $options f90] != -1 } {
+	# Fortran compile.
+	set mod_path [standard_output_file ""]
+	lappend new_options "additional_flags=-J${mod_path}"
+    }
+
     set shlib_found 0
     set shlib_load 0
     set getting_compiler_info 0

-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I99444cf22d80e320093d3f3ed9abb8825f378e0b
Gerrit-Change-Number: 733
Gerrit-PatchSet: 2
Gerrit-Owner: Andrew Burgess <andrew.burgess@embecosm.com>
Gerrit-Reviewer: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: merged

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-12-04 20:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-28  0:24 [review] gdb/testsuite: Use -J option when compiling Fortran tests Andrew Burgess (Code Review)
2019-12-04 18:14 ` Tom Tromey (Code Review)
2019-12-04 20:37 ` [pushed] " Sourceware to Gerrit sync (Code Review)
2019-12-04 20:37 ` Sourceware to Gerrit sync (Code Review)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).