]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* gch981.{ch,exp}, gch1041.{ch,exp}: New test cases.
authorWilfried Moser <moser@cygnus>
Tue, 9 Apr 1996 08:19:58 +0000 (08:19 +0000)
committerWilfried Moser <moser@cygnus>
Tue, 9 Apr 1996 08:19:58 +0000 (08:19 +0000)
gdb/testsuite/gdb.chill/.Sanitize
gdb/testsuite/gdb.chill/ChangeLog
gdb/testsuite/gdb.chill/gch1041.ch [new file with mode: 0644]
gdb/testsuite/gdb.chill/gch1041.exp [new file with mode: 0644]
gdb/testsuite/gdb.chill/gch981.ch [new file with mode: 0644]
gdb/testsuite/gdb.chill/gch981.exp [new file with mode: 0644]

index a60b78d7f406062bea8555afae0d17b75004d0b5..11c9ab5e73dee667ba075b33477d3419d349f7b6 100644 (file)
@@ -42,6 +42,10 @@ extstruct.exp
 func1.ch
 gch922.ch
 gch922.exp
+gch981.ch
+gch981.exp
+gch1041.ch
+gch1041.exp
 misc.ch
 misc.exp
 powerset.ch
index ecdf78245ad52a5e0c19c799656e78fabf6da320..f9aa517d07e8a5045e8ad4a68871154be3e3d8d5 100644 (file)
@@ -1,3 +1,7 @@
+Tue Apr  9 01:18:04 1996  Wilfried Moser (Alcatel)  <moser@rtl.cygnus.com>
+
+       * gch981.{ch,exp}, gch1041.{ch,exp}: New test cases.
+
 Wed Mar  6 00:29:35 1996  Wilfried Moser (Alcatel)  <moser@rtl.cygnus.com>
 
        * powerset.exp: Add test.
diff --git a/gdb/testsuite/gdb.chill/gch1041.ch b/gdb/testsuite/gdb.chill/gch1041.ch
new file mode 100644 (file)
index 0000000..a9ce80b
--- /dev/null
@@ -0,0 +1,17 @@
+arr: MODULE
+
+SYNMODE m_chars = CHARS(30) VARYING;
+SYNMODE m_s = STRUCT (l LONG, c m_chars, b BOOL);
+
+DCL a1 ARRAY (1:1000) LONG INIT := [(5:100): 33, (1:4): 44, (ELSE): 55 ];
+DCL a2 ARRAY (1:10) m_s INIT := [(*): [ 22, "mowi", TRUE ] ];
+DCL a3 ARRAY (CHAR) CHAR INIT := [(*): 'X'];
+
+SYNMODE m_set = SET (e1, e2, e3, e4, e5, e6, e7, e9, e10);
+DCL a4 ARRAY (m_set) BOOL INIT := [(*): TRUE];
+
+a1 := [(5:100): 33, (1:4): 44, (ELSE): 55 ];
+a1 := [ (*): 22 ];
+a2 := [(*): [ 22, "mowi", TRUE ] ];
+
+END arr;
diff --git a/gdb/testsuite/gdb.chill/gch1041.exp b/gdb/testsuite/gdb.chill/gch1041.exp
new file mode 100644 (file)
index 0000000..e6bb8f2
--- /dev/null
@@ -0,0 +1,76 @@
+# Copyright (C) 1995 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb@prep.ai.mit.edu
+
+# This file was written by Fred Fish. (fnf@cygnus.com)
+#                          Martin Pottendorfer (pottendo@aut.alcatel.at)
+#
+
+if $tracelevel then {
+       strace $tracelevel
+}
+
+if [skip_chill_tests] then { continue }
+
+set testfile "gch1041"
+set srcfile ${srcdir}/$subdir/${testfile}.ch
+set binfile ${objdir}/${subdir}/${testfile}.exe
+if  { [compile "${srcfile} -g -o ${binfile} ${CHILL_RT0} ${CHILL_LIB}"] != "" } {
+    perror "Couldn't compile ${srcfile}"
+    return -1
+}
+
+# Set the current language to chill.  This counts as a test.  If it
+# fails, then we skip the other tests.
+
+proc set_lang_chill {} {
+    global prompt
+    global binfile objdir subdir
+
+    verbose "loading file '$binfile'"
+    gdb_load $binfile
+
+    send "set language chill\n"
+    expect {
+       -re ".*$prompt $" {}
+       timeout { fail "set language chill (timeout)" ; return 0 }
+    }
+
+    return [gdb_test "show language" ".* source language is \"chill\".*" \
+       "set language to \"chill\""]
+}
+
+set prms_id 0
+set bug_id 0
+
+# Start with a fresh gdb.
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+
+send "set print sevenbit-strings\n" ; expect -re ".*$prompt $"
+
+if ![set_lang_chill] then {
+    runto arr_
+    # check if array slices print correct index
+    gdb_test {print a1(10:30)} { = \[\(10:30\): 33\]}
+    gdb_test {print a2(3:5)} { = \[\(3:5\): \[.l: 22, .c: "mowi", .b: TRUE\]\]}
+    gdb_test {print a3('a':'c')} { = \[\('a':'c'\): 'X'\]}
+    gdb_test {print a4(e2:e5)} { = \[\(e2:e5\): TRUE\]}
+}
diff --git a/gdb/testsuite/gdb.chill/gch981.ch b/gdb/testsuite/gdb.chill/gch981.ch
new file mode 100644 (file)
index 0000000..e8f0474
--- /dev/null
@@ -0,0 +1,60 @@
+xx: MODULE
+
+SYNMODE m_set1 = SET (e1, e2, e3, e4, e5);
+DCL v_set1 m_set1 INIT := e3;
+
+SYNMODE m_set2 = SET (a1=1, a2=2, a3=17, a4=9, a5=8, a6=0, a7=14, a8=33, a9=12);
+DCL v1_set2 m_set2 INIT := a1;
+DCL v2_set2 m_set2 INIT := a2;
+DCL v3_set2 m_set2 INIT := a3;
+DCL v4_set2 m_set2 INIT := a4;
+DCL v5_set2 m_set2 INIT := a5;
+DCL v6_set2 m_set2 INIT := a6;
+DCL v7_set2 m_set2 INIT := a7;
+DCL v8_set2 m_set2 INIT := a8;
+DCL v9_set2 m_set2 INIT := a9;
+
+SYNMODE m_set3 = SET (b1, b2, b3, b4, b5 = 4711, b6, b7 = 4713);
+DCL v_set3 m_set3 INIT := b7;
+
+SYNMODE m_set4 = SET(s1=111111, s2, s3, s4); 
+DCL v1_set4 m_set4 INIT := s1;
+
+SYNMODE m_set_range = m_set1(e2:e5);
+DCL v_set_range m_set_range INIT := e3;
+
+SYNMODE m_set_range_arr = ARRAY (m_set_range) BYTE;
+DCL v_set_range_arr ARRAY (m_set_range) BYTE;
+
+SYNMODE m_set_arr = ARRAY (m_set1) BYTE;
+DCL v_set_arr ARRAY (m_set1) BYTE;
+
+NEWMODE m_power1 = POWERSET m_set1;
+DCL v1_power1 READ m_power1 INIT := [e1,e2,e3,e4,e5];
+DCL v2_power1 m_power1 INIT := [];
+
+NEWMODE m_power2 = POWERSET m_set2;
+DCL v_power2 m_power2 INIT := [];
+
+NEWMODE m_power3 = POWERSET m_set3;
+DCL v_power3 m_power3 INIT := [b1:b2];
+
+NEWMODE m_power4 = POWERSET CHAR;
+DCL v_power4 m_power4 INIT := ['b':'x'];
+
+NEWMODE m_power5 = POWERSET INT (2:400);
+DCL v_power5 m_power5 INIT := [2:100];
+
+NEWMODE m_power6 = POWERSET INT;
+DCL v_power6 m_power6;
+
+NEWMODE m_power7 = POWERSET LONG;
+DCL v_power7 m_power7;
+
+
+v_set1:= e2;
+v2_power1:= [e1];
+
+v_set1:= e1;
+
+END xx;
diff --git a/gdb/testsuite/gdb.chill/gch981.exp b/gdb/testsuite/gdb.chill/gch981.exp
new file mode 100644 (file)
index 0000000..55d62fd
--- /dev/null
@@ -0,0 +1,249 @@
+# Copyright (C) 1995 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb@prep.ai.mit.edu
+
+# This file tests various Chill values, expressions, and types.
+
+# This file was written by Wilfried Moser (moser@aut.alcatel.at)
+#                         Kurt Fuchs (fuchs_k@aut.alcatel.at)
+#
+
+if $tracelevel then {
+       strace $tracelevel
+}
+
+if [skip_chill_tests] then { continue }
+
+set testfile "gch981"
+set srcfile ${srcdir}/$subdir/${testfile}.ch
+set binfile ${objdir}/${subdir}/${testfile}.exe
+if  { [compile "${srcfile} -g -w -o ${binfile} ${CHILL_RT0} ${CHILL_LIB}"] != "" } {
+    perror "Couldn't compile ${srcfile}"
+    return -1
+}
+
+# Set the current language to chill.  This counts as a test.  If it
+# fails, then we skip the other tests.
+
+proc set_lang_chill {} {
+    global prompt
+    global binfile objdir subdir
+
+    verbose "loading file '$binfile'"
+    gdb_load $binfile
+    send "set language chill\n"
+    expect {
+       -re ".*$prompt $" {}
+       timeout { fail "set language chill (timeout)" ; return 0 }
+    }
+
+    send "show language\n"
+    expect {
+       -re ".* source language is \"chill\".*$prompt $" {
+           pass "set language to \"chill\""
+           send "break xx_\n"
+           expect {
+               -re ".*$prompt $" {
+                   send "run\n" 
+                   expect -re ".*$prompt $" {}
+                   return 1
+               }
+               timeout {
+                   fail "can't set breakpoint (timeout)"
+                   return 0
+               }
+           }
+       }
+       -re ".*$prompt $" {
+           fail "setting language to \"chill\""
+           return 0
+       }
+       timeout {
+           fail "can't show language (timeout)"
+           return 0
+       }
+    }
+}
+
+# Testing printing of a specific value.  Increment passcount for
+# success or issue fail message for failure.  In both cases, return
+# a 1 to indicate that more tests can proceed.  However a timeout
+# is a serious error, generates a special fail message, and causes
+# a 0 to be returned to indicate that more tests are likely to fail
+# as well.
+#
+# Args are:
+#
+#      First one is string to send to gdb
+#      Second one is string to match gdb result to
+#      Third one is an optional message to be printed
+
+proc test_print_accept { args } {
+    global prompt
+    global passcount
+    global verbose
+
+    if [llength $args]==3 then {
+       set message [lindex $args 2]
+    } else {
+       set message [lindex $args 0]
+    }
+    set sendthis [lindex $args 0]
+    set expectthis [lindex $args 1]
+    set result [gdb_test $sendthis ".* = ${expectthis}" $message]
+    if $result==0 {incr passcount}
+    return $result
+}
+
+proc test_power {} {
+    global passcount prompt
+
+    verbose "Testing some POWERSET Stuff"
+    set passcount 0
+
+    test_print_accept "print v1_power1" {\[e1:e5\]}
+    test_print_accept "print v2_power1" {\[\]}
+    test_print_accept "print SIZE(v1_power1)" "1"
+
+    send "set v1_power1 := \[b1\] \n" ; expect -re "$prompt $"
+#   if GDB has rejected the improper values, we have to expect the same!
+    test_print_accept "print v1_power1" {\[e1:e5\]}
+
+    send "set v1_power1 := \[a1,a2\] \n" ; expect -re "$prompt $"
+    test_print_accept "print v1_power1" {\[e1:e5\]}
+    send "set v1_power1 := \[b1,b2,b3,e4\] \n" ; expect -re "$prompt $"
+    test_print_accept "print v1_power1" {\[e1:e5\]}
+    send "set v1_power1 := \[e4:e5\] \n" ; expect -re "$prompt $"
+    test_print_accept "print v1_power1" {\[e4:e5\]}
+    send "set v1_power1 := \[e1, e2:e3, e5\] \n" ; expect -re "$prompt $"
+    test_print_accept "print v1_power1" {\[e1:e3, e5\]}
+    send "set v1_power1 := \[e1, e2:e4, e4:e5\] \n" ; expect -re "$prompt $"
+    test_print_accept "print v1_power1" {\[e1:e5\]}
+    send "set v1_power1 := \[e1, e1:e3, e1:e2, e2:e3\] \n" ; expect -re "$prompt $"
+    test_print_accept "print v1_power1" {\[e1:e3\]}
+
+    send "set v_power2 := \[e2\] \n" ; expect -re "$prompt $"
+    test_print_accept "print v_power2" {\[\]}
+    send "set v_power2 := \[1,2,3\] \n" ; expect -re "$prompt $"
+    test_print_accept "print v_power2" {\[\]}
+    send "set v_power2 := \[e2, b2, b1\] \n" ; expect -re "$prompt $"
+    test_print_accept "print v_power2" {\[\]}
+
+# Note, that this is a numbered SET, so a1:a3 contains all elements (exept a6)
+    send "set v_power2 := \[a1:a3, a6:a4, a7:a9\] \n" ; expect -re "$prompt $"
+    test_print_accept "print v_power2" {\[a6:a3\]}
+    send "set v_power2 := \[a1, a4:a6, a9\] \n" ; expect -re "$prompt $"
+    test_print_accept "print v_power2" {\[a1, a9\]}
+    send "set v_power2 := \[a1:a2, a6, a9\] \n" ; expect -re "$prompt $"
+    test_print_accept "print v_power2" {\[a6:a2, a9\]}
+    send "set v_power2 := \[a1, a4, a7:a8, a9:a3\] \n" ; expect -re "$prompt $"
+    test_print_accept "print v_power2" {\[a1, a4, a9:a8\]}
+    send "set v_power2 := \[a1, a4:a8\] \n" ; expect -re "$prompt $"
+    test_print_accept "print v_power2" {\[a1, a4:a8\]}
+    send "set v_power2 := \[a8,a3,a7,a9,a5,a6\] \n" ; expect -re "$prompt $"
+    test_print_accept "print v_power2" {\[a6, a5, a9, a7, a3, a8\]}
+
+    send "set v_power3 := \[b1:b2,e1\] \n" ; expect -re "$prompt $"
+    test_print_accept "print v_power3" {\[b1:b2\]}
+    send "set v_power3 := \[b1, b3, b6:b7\] \n" ; expect -re "$prompt $"
+    test_print_accept "print v_power3" {\[b1, b3, b6:b7\]}
+    send "set v_power3 := \[b1, b3:b4, b7\] \n" ; expect -re "$prompt $"
+    test_print_accept "print v_power3" {\[b1, b3:b4, b7\]}
+    send "set v_power3 := \[b1, b4:b6, b7\] \n" ; expect -re "$prompt $"
+    test_print_accept "print v_power3" {\[b1, b4:b7\]}
+    send "set v_power3 := \[b1:b7\] \n" ; expect -re "$prompt $"
+    test_print_accept "print v_power3" {\[b1:b7\]}
+    send "set v_power3 := \[b5:b7, b1\] \n" ; expect -re "$prompt $"
+    test_print_accept "print v_power3" {\[b1, b5:b7\]}
+
+    send "set v_power4 := \[\"b\"\] \n" ; expect -re "$prompt $"
+    test_print_accept "print v_power4" {\['b':'x'\]}
+    send "set v_power4 := \[5\] \n" ; expect -re "$prompt $"
+    test_print_accept "print v_power4" {\['b':'x'\]}
+    send "set v_power4 := \['c':'f','g':'h','o':'t'\]\n"; expect -re "$prompt $"
+    test_print_accept "print v_power4" {\['c':'h', 'o':'t'\]}
+    send "set v_power4 := \['a','b','c','d','e','f'\]\n"; expect -re "$prompt $"
+    test_print_accept "print v_power4" {\['a':'f'\]}
+    send "set v_power4 := \['\^(0)':'\^(200)'\]\n"; expect -re "$prompt $"
+    test_print_accept "print v_power4" {\['\^\(0\)':'\^\(200\)'\]}
+
+    send "set v_power5 := \[a8\] \n" ; expect -re "$prompt $"
+    test_print_accept "print v_power5" {\[2:100\]}
+    send "set v_power5 := \[4\] \n" ; expect -re "$prompt $"
+    test_print_accept "print v_power5" {\[4\]}
+    send "set v_power5 := \[3:95,9:100,10:107,200:250\]\n" ; expect -re "$prompt $"
+    test_print_accept "print v_power5" {\[3:107, 200:250\]}
+    send "set v_power5 := \[2, 100:120, 350:400\] \n" ; expect -re "$prompt $"
+    test_print_accept "print v_power5" {\[2, 100:120, 350:400\]}
+    send "set v_power5 := \[2:64,65:127,128:256,256:399,400\]\n" ; expect -re "$prompt $"
+    test_print_accept "print v_power5" {\[2:400\]}
+    send "set v_power5 := \[3:95, 99:100, 101:107, 200:250\] \n" ; expect -re "$prompt $"
+    test_print_accept "print v_power5" {\[3:95, 99:107, 200:250\]}
+
+    send "set v_power6 := \[a8\] \n" ; expect -re "$prompt $"
+    test_print_accept "print v_power6" {\[\]}
+    send "set v_power6 := \[4\] \n" ; expect -re "$prompt $"
+    test_print_accept "print v_power6" {\[4\]}
+    send "set v_power6 := \[3:95, 99:100, 101:107, 200:250\] \n" ; expect -re "$prompt $"
+    test_print_accept "print v_power6" {\[3:95, 99:107, 200:250\]}
+    send "set v_power6 := \[-111:0, 1:112, 11111:22222\] \n" ; expect -re "$prompt $"
+    test_print_accept "print v_power6" {\[-111:112, 11111:22222\]}
+    send "set v_power6 := \[0, 200:4000, 6666:9999\] \n" ; expect -re "$prompt $"
+    test_print_accept "print v_power6" {\[0, 200:4000, 6666:9999\]}
+
+#    send "set v_power7 := \[a8\] \n" ; expect -re "$prompt $"
+#    test_print_accept "print v_power7" {\[2:100\]}
+#    send "set v_power7 := \[4\] \n" ; expect -re "$prompt $"
+#    test_print_accept "print v_power7" {\[4\]}
+#    send "set v_power7 := \[3:95, 99:100, 101:107, 200:250\]\n" ; expect -re "$prompt $"
+#    test_print_accept "print v_power7" {\[3:95, 99:107, 200:250\]}
+#    send "set v_power7 := \[0, 1000, 1000000, 10000000000\] \n" ; expect -re "$prompt $"
+#    test_print_accept "print v_power7" {\[0, 1000, 1000000, 1000000000\]}
+#    send "set v_power7 := \[-20000:100000, 111111:2222222\] \n" ; expect -re "$prompt $"
+#    test_print_accept "print v_power7" {\[-20000:100000, 111111:2222222\]}
+#    send "set v_power7 := \[\] \n" ; expect -re "$prompt $"
+#    test_print_accept "print v_power7" {\[3:95, 99:107, 200:250\]}
+#    send "set v_power7 := \[2:-500, -501:1, 20:370, -888:-920, 1000:2000, 1800:2500\]\ \n" ; expect -re "$prompt $"
+#    test_print_accept "print v_power7" {\[-920:-888, -501:2, 20:370, 1000:2500\]}
+#    test_print_accept "print SIZE(v_power7)" ""
+
+
+    runto 58
+    test_print_accept "print v_set1 IN v1_power1" "TRUE"
+    test_print_accept "print v_set1 IN v2_power1" "FALSE"
+
+}
+
+
+
+# Start with a fresh gdb.
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+
+send "set print sevenbit-strings\n" ; expect -re ".*$prompt $"
+
+
+if [set_lang_chill] then {
+    # test builtins as described in chapter 6.20.3 Z.200
+
+    test_power 
+} else {
+    warning "$test_name tests suppressed."
+}