* sim/cris/asm/opterr5.ms, sim/cris/asm/opterr4.ms,
authorHans-Peter Nilsson <hp@axis.com>
Sun, 18 Jan 2009 22:17:47 +0000 (22:17 +0000)
committerHans-Peter Nilsson <hp@axis.com>
Sun, 18 Jan 2009 22:17:47 +0000 (22:17 +0000)
sim/cris/asm/opterr3.ms, sim/cris/asm/bare3.ms: New tests.
* lib/sim-defs.exp (run_sim_test): New option progopts.

sim/testsuite/ChangeLog
sim/testsuite/lib/sim-defs.exp
sim/testsuite/sim/cris/asm/bare3.ms [new file with mode: 0644]
sim/testsuite/sim/cris/asm/opterr3.ms [new file with mode: 0644]
sim/testsuite/sim/cris/asm/opterr4.ms [new file with mode: 0644]
sim/testsuite/sim/cris/asm/opterr5.ms [new file with mode: 0644]

index 4ee0222329b94407e26d7f5a5d84770bb412d9e9..4d334e641d8e635cf90c13c76a18803aaa1bdbc6 100644 (file)
@@ -1,3 +1,9 @@
+2009-01-18  Hans-Peter Nilsson  <hp@axis.com>
+
+       * sim/cris/asm/opterr5.ms, sim/cris/asm/opterr4.ms,
+       sim/cris/asm/opterr3.ms, sim/cris/asm/bare3.ms: New tests.
+       * lib/sim-defs.exp (run_sim_test): New option progopts.
+
 2009-01-06  Hans-Peter Nilsson  <hp@axis.com>
 
        * sim/cris/c/mmap5.c, sim/cris/c/mmap6.c, sim/cris/c/mmap7.c,
index 521e0e33a2d76ba61045e649a65fde64c9e36c65..3cef3942321a83bbabfbdf5b2caa6f2b583db996 100644 (file)
@@ -161,6 +161,7 @@ proc sim_run { prog sim_opts prog_opts redir options } {
 # as[(mach-list)]: <assembler options>
 # ld[(mach-list)]: <linker options>
 # sim[(mach-list)]: <simulator options>
+# progopts: <arguments to the program being simulated>
 # output: program output pattern to match with string-match
 # xerror: program is expected to return with a "failure" exit code
 # xfail: <PRMS-opt> <target-triplets-where-test-fails>
@@ -197,6 +198,7 @@ proc run_sim_test { name requested_machs } {
     # Clear default options
     set opts(as) ""
     set opts(ld) ""
+    set opts(progopts) ""
     set opts(sim) ""
     set opts(output) ""
     set opts(mach) ""
@@ -330,7 +332,7 @@ proc run_sim_test { name requested_machs } {
            set options "$options timeout=$opts(timeout)"
        }
 
-       set result [sim_run ${name}.x "$opts(sim,$mach) $global_sim_options" "" "" "$options"]
+       set result [sim_run ${name}.x "$opts(sim,$mach) $global_sim_options" "$opts(progopts)" "" "$options"]
        set status [lindex $result 0]
        set output [lindex $result 1]
 
diff --git a/sim/testsuite/sim/cris/asm/bare3.ms b/sim/testsuite/sim/cris/asm/bare3.ms
new file mode 100644 (file)
index 0000000..103530d
--- /dev/null
@@ -0,0 +1,41 @@
+# mach: crisv32
+# ld: -N --oformat binary --section-start=.text=0x10000000
+# sim: --architecture crisv32 --target binary --cris-program-offset=0x10000000 --cris-start-address=0x10000040 --cris-naked --memory-region 0x10000000,0x1000
+ .include "testutils.inc"
+
+; Test that we can load a binary program at a non-zero address.
+; Also serves to exercise the --cris-program-offset and
+; --cris-start-address options.
+
+; Make sure starting at the first address does fail.
+ fail
+
+; ...and that we know an offset we can jump for it to work, and all we
+; have to assume is that "fail" takes no more than 64 bytes.
+ .p2align 6
+ ba _start
+ nop
+
+; 
+ start
+x:
+
+; Make sure we're loaded at the linked address.  Since we're re-used
+; in other tests, we have to provide for non-v32 as well.
+ .if ..asm.arch.cris.v32
+ lapcq .,$r0
+ .else
+ move.d $pc,$r0
+ subq .-x,$r0
+ .endif
+
+ cmp.d x,$r0
+ bne y
+ nop
+ pass
+y:
+ fail
+
+; Make sure we have enough contents for the mapping.
+ .data
+ .fill 4096,1,0
diff --git a/sim/testsuite/sim/cris/asm/opterr3.ms b/sim/testsuite/sim/cris/asm/opterr3.ms
new file mode 100644 (file)
index 0000000..8d602be
--- /dev/null
@@ -0,0 +1,10 @@
+# mach: crisv3 crisv8 crisv10 crisv32
+# ld: -N --oformat binary --section-start=.text=0x10000000
+# sim: --cris-naked --memory-mapfile
+# xerror:
+# output: Usage: run \[options\] program \[program args\]\n*\n
+# progopts: --memory-region 0x10000000,0x1000
+ .include "bare3.ms"
+
+; Check that we get an error for wrong usage, not a SEGV for lack of
+; bfd when missing the program argument (can't use *only* mapped files).
diff --git a/sim/testsuite/sim/cris/asm/opterr4.ms b/sim/testsuite/sim/cris/asm/opterr4.ms
new file mode 100644 (file)
index 0000000..a4ffc6b
--- /dev/null
@@ -0,0 +1,7 @@
+# mach: crisv3 crisv8 crisv10 crisv32
+# xerror:
+# output: Invalid option [`']--cris-start-address=x'\n
+# sim: --cris-start-address=x
+ .include "nopv32t.ms"
+
+; Check that we recognize wrong usage of the --cris-start-address option.
diff --git a/sim/testsuite/sim/cris/asm/opterr5.ms b/sim/testsuite/sim/cris/asm/opterr5.ms
new file mode 100644 (file)
index 0000000..3d1b591
--- /dev/null
@@ -0,0 +1,7 @@
+# mach: crisv3 crisv8 crisv10 crisv32
+# xerror:
+# output: Invalid option [`']--cris-program-offset=x'\n
+# sim: --cris-program-offset=x
+ .include "nopv32t.ms"
+
+; Check that we recognize wrong usage of the --cris-program-offset option.