Re: relative line numbers and dg-line directive

Tom de Vries <[email protected]>
Newsgroups gmane.comp.sysutils.dejagnu.general
Message-ID <[email protected]>
On 05/24/2017 12:18 AM, Ben Elliston wrote:
> On Tue, May 23, 2017 at 03:11:28PM +0200, Tom de Vries wrote:
> 
>> Is there any interest in having either or both of these concepts
>> added to dejagnu's dg.exp?
> 
> Yes, patches welcome. :)
> 

I managed to:
- check out sources,
- configure and build them, and
- check and install the build.

My next step was to see where to add a dg-error testcase, but I didn't 
find a place.

Attached is a patch that creates a standalone test-case testing dg-error 
using a dummy tool.

Output is as follows:
...
Test Run By vries on Wed May 24 14:46:00 2017
Native configuration is x86_64-unknown-linux-gnu

		=== dummy tests ===

Schedule of variations:
     unix

Running target unix
Using /usr/share/dejagnu/baseboards/unix.exp as board description file 
for target.
Using /usr/share/dejagnu/config/unix.exp as generic interface file for 
target.
Using /home/vries/dejagnu/standalone/testsuite/config/default.exp as 
tool-and-target-specific interface file.
Running /home/vries/dejagnu/standalone/testsuite/dummy.dg/dg.exp ...

		=== dummy Summary ===

# of expected passes		2
...

If something like this is good to have in the dejagnu sources, I could 
use some pointers on where and how to integrate this.

Thanks,
- Tom

_______________________________________________
DejaGnu mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/dejagnu
tmp.patch (text/x-patch, 1.2 KB)
Add testing of dg-error

diff --git a/test.sh b/test.sh
new file mode 100755
index 0000000..81112ea
--- /dev/null
+++ b/test.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+pwd=$(pwd -P)
+src=$pwd/testsuite
+
+rm -Rf run
+mkdir run
+cd run
+
+runtest \
+    --tool dummy \
+    --srcdir $src
+
diff --git a/testsuite/config/default.exp b/testsuite/config/default.exp
new file mode 100644
index 0000000..e1b4fee
--- /dev/null
+++ b/testsuite/config/default.exp
@@ -0,0 +1,5 @@
+proc dummy-dg-test { prog do_what extra_tool_flags } {
+    set output [exec /bin/sh $prog]
+    return [list $output ""]
+}
+
diff --git a/testsuite/dummy.dg/dg-error.test b/testsuite/dummy.dg/dg-error.test
new file mode 100644
index 0000000..c25b6a8
--- /dev/null
+++ b/testsuite/dummy.dg/dg-error.test
@@ -0,0 +1 @@
+echo "first.test:1: error: bla" # { dg-error "bla" "" }
diff --git a/testsuite/dummy.dg/dg.exp b/testsuite/dummy.dg/dg.exp
new file mode 100644
index 0000000..52e8ab9
--- /dev/null
+++ b/testsuite/dummy.dg/dg.exp
@@ -0,0 +1,7 @@
+load_lib dg.exp
+dg-init
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.test]] \
+    "" \
+    ""
+dg-finish
+
diff --git a/testsuite/lib/dummy.exp b/testsuite/lib/dummy.exp
new file mode 100644
index 0000000..e69de29
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.