public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/2] sim; testsuite: allow tests to set no output
@ 2015-03-29 20:47 Mike Frysinger
  2015-03-29 20:47 ` [PATCH 2/2] sim: microblaze: start a testsuite Mike Frysinger
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Frysinger @ 2015-03-29 20:47 UTC (permalink / raw)
  To: gdb-patches

If a test doesn't write anything at all to stdout, the current test
framework can't support that.  Even if you put a blank output line:
	# output:
the setup happily clobbers that with a default pass/fail string.

Tweak the parsing logic so we only set the output to pass/fail when
the test has no output marker.
---
 sim/testsuite/ChangeLog        | 6 ++++++
 sim/testsuite/lib/sim-defs.exp | 4 +++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/sim/testsuite/ChangeLog b/sim/testsuite/ChangeLog
index 6de8bdc..55ef169 100644
--- a/sim/testsuite/ChangeLog
+++ b/sim/testsuite/ChangeLog
@@ -1,5 +1,11 @@
 2015-03-29  Mike Frysinger  <vapier@gentoo.org>
 
+	* lib/sim-defs.exp (run_sim_test): Declare seen_output as 0.  When
+	the test has an output keyword, set it to 1.  Set default output only
+	when seen_output is 0.
+
+2015-03-29  Mike Frysinger  <vapier@gentoo.org>
+
 	* configure: Regenerate.
 
 2015-03-28  Mike Frysinger  <vapier@gentoo.org>
diff --git a/sim/testsuite/lib/sim-defs.exp b/sim/testsuite/lib/sim-defs.exp
index c8093a2..fb2346a 100644
--- a/sim/testsuite/lib/sim-defs.exp
+++ b/sim/testsuite/lib/sim-defs.exp
@@ -218,6 +218,7 @@ proc run_sim_test { name requested_machs } {
     set opts(xerror) "no"
     set opts(xfail) ""
     set opts(kfail) ""
+    set seen_output 0
 
     if ![info exists global_as_options] {
         set global_as_options ""
@@ -260,6 +261,7 @@ proc run_sim_test { name requested_machs } {
 	# Multiple "output" specifications concatenate, they don't override.
 	if { $opt_name == "output" } {
 	    set opt_val "$opts(output)$opt_val"
+	    set seen_output 1
 	}
 	# Similar with "xfail" and "kfail", but arguments are space-separated.
 	if { $opt_name == "xfail" || $opt_name == "kfail" } {
@@ -276,7 +278,7 @@ proc run_sim_test { name requested_machs } {
 
     set testname $name
     set sourcefile $file
-    if { $opts(output) == "" } {
+    if { $seen_output == 0 } {
 	if { "$opts(xerror)" == "no" } {
 	    set opts(output) "pass\n"
 	} else {
-- 
2.3.4

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

* [PATCH 2/2] sim: microblaze: start a testsuite
  2015-03-29 20:47 [PATCH 1/2] sim; testsuite: allow tests to set no output Mike Frysinger
@ 2015-03-29 20:47 ` Mike Frysinger
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Frysinger @ 2015-03-29 20:47 UTC (permalink / raw)
  To: gdb-patches

Since the sim doesn't have any debug support in it, we can only exit
cleanly.  But this is still better than nothing.

Change the default microblaze sim to not dump the debug load output
when running.  No other does this, and it breaks the testsuite.

Committed.
---
 sim/microblaze/ChangeLog                   |  4 ++++
 sim/microblaze/interp.c                    |  2 +-
 sim/testsuite/sim/microblaze/ChangeLog     |  3 +++
 sim/testsuite/sim/microblaze/allinsn.exp   | 15 +++++++++++++++
 sim/testsuite/sim/microblaze/pass.s        |  8 ++++++++
 sim/testsuite/sim/microblaze/testutils.inc | 29 +++++++++++++++++++++++++++++
 6 files changed, 60 insertions(+), 1 deletion(-)
 create mode 100644 sim/testsuite/sim/microblaze/ChangeLog
 create mode 100644 sim/testsuite/sim/microblaze/allinsn.exp
 create mode 100644 sim/testsuite/sim/microblaze/pass.s
 create mode 100644 sim/testsuite/sim/microblaze/testutils.inc

diff --git a/sim/microblaze/ChangeLog b/sim/microblaze/ChangeLog
index 7ee66c5..b2a5150 100644
--- a/sim/microblaze/ChangeLog
+++ b/sim/microblaze/ChangeLog
@@ -1,5 +1,9 @@
 2015-03-29  Mike Frysinger  <vapier@gentoo.org>
 
+	* interp.c (sim_load): Set verbose to 0 when calling sim_load_file.
+
+2015-03-29  Mike Frysinger  <vapier@gentoo.org>
+
 	* configure.ac: Call SIM_AC_OPTION_ENDIAN, SIM_AC_OPTION_ALIGNMENT,
 	SIM_AC_OPTION_HOSTENDIAN, SIM_AC_OPTION_ENVIRONMENT, and
 	SIM_AC_OPTION_INLINE.
diff --git a/sim/microblaze/interp.c b/sim/microblaze/interp.c
index ad6faaa..4e64932 100644
--- a/sim/microblaze/interp.c
+++ b/sim/microblaze/interp.c
@@ -820,7 +820,7 @@ sim_load (SIM_DESC sd, const char *prog, bfd *abfd, int from_tty)
   /* from sh -- dac */
   prog_bfd = sim_load_file (sd, myname, callback, prog, abfd,
 			    /* sim_kind == SIM_OPEN_DEBUG, */
-			    1,
+			    0,
 			    0, sim_write);
   if (prog_bfd == NULL)
     return SIM_RC_FAIL;
diff --git a/sim/testsuite/sim/microblaze/ChangeLog b/sim/testsuite/sim/microblaze/ChangeLog
new file mode 100644
index 0000000..2aa1f2c
--- /dev/null
+++ b/sim/testsuite/sim/microblaze/ChangeLog
@@ -0,0 +1,3 @@
+2015-03-29  Mike Frysinger  <vapier@gentoo.org>
+
+	* pass.s, allinsn.exp, testutils.inc: New files.
diff --git a/sim/testsuite/sim/microblaze/allinsn.exp b/sim/testsuite/sim/microblaze/allinsn.exp
new file mode 100644
index 0000000..f756914
--- /dev/null
+++ b/sim/testsuite/sim/microblaze/allinsn.exp
@@ -0,0 +1,15 @@
+# microblaze simulator testsuite
+
+if [istarget microblaze-*] {
+    # all machines
+    set all_machs "microblaze"
+
+    foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.s]] {
+	# If we're only testing specific files and this isn't one of them,
+	# skip it.
+	if ![runtest_file_p $runtests $src] {
+	    continue
+	}
+	run_sim_test $src $all_machs
+    }
+}
diff --git a/sim/testsuite/sim/microblaze/pass.s b/sim/testsuite/sim/microblaze/pass.s
new file mode 100644
index 0000000..93ed924
--- /dev/null
+++ b/sim/testsuite/sim/microblaze/pass.s
@@ -0,0 +1,8 @@
+# check that the sim doesn't die immediately.
+# mach: microblaze
+# output:
+
+.include "testutils.inc"
+
+	start
+	pass
diff --git a/sim/testsuite/sim/microblaze/testutils.inc b/sim/testsuite/sim/microblaze/testutils.inc
new file mode 100644
index 0000000..158a3c5
--- /dev/null
+++ b/sim/testsuite/sim/microblaze/testutils.inc
@@ -0,0 +1,29 @@
+# MACRO: exit
+	.macro exit nr
+	addi r3, r0, \nr;
+	bri 0;
+	.endm
+
+# MACRO: pass
+# Write 'pass' to stdout and quit
+	.macro pass
+	exit 0
+	.data
+	1: .asciz "pass\n"
+	.endm
+
+# MACRO: fail
+# Write 'fail' to stdout and quit
+	.macro fail
+	exit 1
+	.data
+	1: .asciz "fail\n"
+	.endm
+
+# MACRO: start
+# All assembler tests should start with a call to "start"
+	.macro start
+	.text
+.global _start
+_start:
+	.endm
-- 
2.3.4

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

end of thread, other threads:[~2015-03-29 20:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-29 20:47 [PATCH 1/2] sim; testsuite: allow tests to set no output Mike Frysinger
2015-03-29 20:47 ` [PATCH 2/2] sim: microblaze: start a testsuite Mike Frysinger

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).