aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2015-11-24 22:59:21 +0200
committerArnold D. Robbins <arnold@skeeve.com>2015-11-24 22:59:21 +0200
commit20d333afbaadde8a8daa4091e22cf549c6954a6a (patch)
treeb9c237acaaaa5ea430e08557b75734d6639c114e /test
parent0300d4581c543ddbd2f307782650a0978ff6bdd8 (diff)
downloadegawk-20d333afbaadde8a8daa4091e22cf549c6954a6a.tar.gz
egawk-20d333afbaadde8a8daa4091e22cf549c6954a6a.tar.bz2
egawk-20d333afbaadde8a8daa4091e22cf549c6954a6a.zip
Make watchpoints fire before breakpoints in the debugger.
Diffstat (limited to 'test')
-rw-r--r--test/ChangeLog6
-rw-r--r--test/Makefile.am12
-rw-r--r--test/Makefile.in12
-rw-r--r--test/watchpoint1.awk14
-rw-r--r--test/watchpoint1.in8
-rw-r--r--test/watchpoint1.ok65
-rw-r--r--test/watchpoint1.script14
7 files changed, 129 insertions, 2 deletions
diff --git a/test/ChangeLog b/test/ChangeLog
index 83174b03..cc709b5c 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,9 @@
+2015-11-24 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.am (watchpoint1): New test.
+ * watchpoint1.awk, watchpoint1.in, watchpoint1.ok,
+ watchpoint1.script: New files.
+
2015-10-28 Arnold D. Robbins <arnold@skeeve.com>
* Makefile.am (nulinsrc): New test.
diff --git a/test/Makefile.am b/test/Makefile.am
index 97cf8d54..779a1063 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -987,6 +987,10 @@ EXTRA_DIST = \
uparrfs.awk \
uparrfs.in \
uparrfs.ok \
+ watchpoint1.awk \
+ watchpoint1.in \
+ watchpoint1.ok \
+ watchpoint1.script \
wideidx.awk \
wideidx.in \
wideidx.ok \
@@ -1084,7 +1088,8 @@ GAWK_EXT_TESTS = \
rsstart2 rsstart3 rstest6 shadow sortfor sortu split_after_fpat \
splitarg4 strftime \
strtonum switch2 symtab1 symtab2 symtab3 symtab4 symtab5 symtab6 \
- symtab7 symtab8 symtab9
+ symtab7 symtab8 symtab9 \
+ watchpoint1
EXTRA_TESTS = inftest regtest
@@ -2101,6 +2106,11 @@ muldimposix::
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk --posix >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+watchpoint1:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -D -f $@.awk $@.in < $@.script >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
# Targets generated for other tests:
include Maketests
diff --git a/test/Makefile.in b/test/Makefile.in
index 90b994c3..eb7748ab 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -1244,6 +1244,10 @@ EXTRA_DIST = \
uparrfs.awk \
uparrfs.in \
uparrfs.ok \
+ watchpoint1.awk \
+ watchpoint1.in \
+ watchpoint1.ok \
+ watchpoint1.script \
wideidx.awk \
wideidx.in \
wideidx.ok \
@@ -1340,7 +1344,8 @@ GAWK_EXT_TESTS = \
rsstart2 rsstart3 rstest6 shadow sortfor sortu split_after_fpat \
splitarg4 strftime \
strtonum switch2 symtab1 symtab2 symtab3 symtab4 symtab5 symtab6 \
- symtab7 symtab8 symtab9
+ symtab7 symtab8 symtab9 \
+ watchpoint1
EXTRA_TESTS = inftest regtest
INET_TESTS = inetdayu inetdayt inetechu inetecht
@@ -2539,6 +2544,11 @@ muldimposix::
@echo $@
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk --posix >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
+watchpoint1:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -D -f $@.awk $@.in < $@.script >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
Gt-dummy:
# file Maketests, generated from Makefile.am by the Gentests program
addcomma:
diff --git a/test/watchpoint1.awk b/test/watchpoint1.awk
new file mode 100644
index 00000000..5e7e9416
--- /dev/null
+++ b/test/watchpoint1.awk
@@ -0,0 +1,14 @@
+#! /usr/bin/gawk -f
+BEGIN {
+ c = 0
+}
+
+/apple/ {
+ nr = NR
+ c++
+ # printf "[c, NR] = [%s, %s]\n", c, NR
+}
+
+END {
+ print c
+}
diff --git a/test/watchpoint1.in b/test/watchpoint1.in
new file mode 100644
index 00000000..83ac6f43
--- /dev/null
+++ b/test/watchpoint1.in
@@ -0,0 +1,8 @@
+1 1 pear
+2 1 apple 4
+3 2 pear
+4 3 apple 9
+5 8 pear
+6 9 apple
+7 10 pear
+8 12 apple
diff --git a/test/watchpoint1.ok b/test/watchpoint1.ok
new file mode 100644
index 00000000..b1e7e53c
--- /dev/null
+++ b/test/watchpoint1.ok
@@ -0,0 +1,65 @@
+1 #! /usr/bin/gawk -f
+2 BEGIN {
+3 c = 0
+4 }
+5
+6 /apple/ {
+7 nr = NR
+8 c++
+9 # printf "[c, NR] = [%s, %s]\n", c, NR
+10 }
+11
+12 END {
+13 print c
+14 }
+Watchpoint 1: c
+1: c = untyped variable
+2: nr = untyped variable
+3: NR = 0
+Breakpoint 2 set at file `watchpoint1.awk', line 6
+Starting program:
+Stopping in Rule ...
+Watchpoint 1: c
+ Old value: untyped variable
+ New value: 0
+main() at `watchpoint1.awk':6
+6 /apple/ {
+1: c = 0
+2: nr = untyped variable
+3: NR = 1
+Breakpoint 2, main() at `watchpoint1.awk':6
+6 /apple/ {
+1: c = 0
+2: nr = untyped variable
+3: NR = 1
+Breakpoint 2, main() at `watchpoint1.awk':6
+6 /apple/ {
+1: c = 0
+2: nr = untyped variable
+3: NR = 2
+Watchpoint 1: c
+ Old value: 0
+ New value: 1
+main() at `watchpoint1.awk':6
+6 /apple/ {
+1: c = 1
+2: nr = 2
+3: NR = 3
+Breakpoint 2, main() at `watchpoint1.awk':6
+6 /apple/ {
+1: c = 1
+2: nr = 2
+3: NR = 3
+Breakpoint 2, main() at `watchpoint1.awk':6
+6 /apple/ {
+1: c = 1
+2: nr = 2
+3: NR = 4
+Watchpoint 1: c
+ Old value: 1
+ New value: 2
+main() at `watchpoint1.awk':6
+6 /apple/ {
+1: c = 2
+2: nr = 4
+3: NR = 5
diff --git a/test/watchpoint1.script b/test/watchpoint1.script
new file mode 100644
index 00000000..94897d11
--- /dev/null
+++ b/test/watchpoint1.script
@@ -0,0 +1,14 @@
+list
+watch c
+display c
+display nr
+display NR
+break 6
+run
+continue
+continue
+continue
+continue
+continue
+continue
+quit