summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2021-09-07 19:30:45 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2021-09-07 19:30:45 +0000
commit508793a9f93408367b983c6a41ef6dbab63d6226 (patch)
tree25c1f319204f32cff736272c001b04d3b66f751a /regress
parentb64715b2bd3fa8d5eade02d512f11263dd2075c2 (diff)
Check that clear() and zero() only work with map.
Diffstat (limited to 'regress')
-rw-r--r--regress/usr.sbin/btrace/Makefile8
-rw-r--r--regress/usr.sbin/btrace/mapclear.bt9
-rw-r--r--regress/usr.sbin/btrace/mapclear.ok1
-rw-r--r--regress/usr.sbin/btrace/mapsyntax.bt7
-rw-r--r--regress/usr.sbin/btrace/mapsyntax.ok6
-rw-r--r--regress/usr.sbin/btrace/mapzero.bt9
-rw-r--r--regress/usr.sbin/btrace/mapzero.ok1
7 files changed, 38 insertions, 3 deletions
diff --git a/regress/usr.sbin/btrace/Makefile b/regress/usr.sbin/btrace/Makefile
index 8fd429e24a5..6025e775a4c 100644
--- a/regress/usr.sbin/btrace/Makefile
+++ b/regress/usr.sbin/btrace/Makefile
@@ -1,12 +1,14 @@
-# $OpenBSD: Makefile,v 1.13 2021/09/07 19:20:22 mpi Exp $
+# $OpenBSD: Makefile,v 1.14 2021/09/07 19:30:44 mpi Exp $
BTRACE?= /usr/sbin/btrace
# scripts that don't need /dev/dt
-BT_LANG_SCRIPTS= arithm beginend boolean comments delete exit if map \
- map-unnamed maxoperand min+max+sum multismts nsecs+var \
+BT_LANG_SCRIPTS= arithm beginend boolean comments delete exit if \
+ map mapclear mapsyntax mmapzero ap-unnamed \
+ maxoperand min+max+sum multismts nsecs+var \
precedence print read-map-after-clear syntaxerror
+
BT_KERN_SCRIPTS=
REGRESS_EXPECTED_FAILURES= run-maxoperand
diff --git a/regress/usr.sbin/btrace/mapclear.bt b/regress/usr.sbin/btrace/mapclear.bt
new file mode 100644
index 00000000000..22a4b6edfee
--- /dev/null
+++ b/regress/usr.sbin/btrace/mapclear.bt
@@ -0,0 +1,9 @@
+BEGIN {
+ @notamap = 123;
+
+ /*
+ * Parser doesn't know the type of a variable and these check
+ * are performed at run-time.
+ */
+ clear(@notamap);
+}
diff --git a/regress/usr.sbin/btrace/mapclear.ok b/regress/usr.sbin/btrace/mapclear.ok
new file mode 100644
index 00000000000..20c759da82d
--- /dev/null
+++ b/regress/usr.sbin/btrace/mapclear.ok
@@ -0,0 +1 @@
+btrace: invalid variable type for clear(@notamap)
diff --git a/regress/usr.sbin/btrace/mapsyntax.bt b/regress/usr.sbin/btrace/mapsyntax.bt
new file mode 100644
index 00000000000..31073b4f394
--- /dev/null
+++ b/regress/usr.sbin/btrace/mapsyntax.bt
@@ -0,0 +1,7 @@
+BEGIN {
+ zero(42);
+}
+
+END {
+ clear(0);
+}
diff --git a/regress/usr.sbin/btrace/mapsyntax.ok b/regress/usr.sbin/btrace/mapsyntax.ok
new file mode 100644
index 00000000000..09ce285cc32
--- /dev/null
+++ b/regress/usr.sbin/btrace/mapsyntax.ok
@@ -0,0 +1,6 @@
+/usr/src/regress/usr.sbin/btrace/mapsyntax.bt:2:8: syntax error:
+ zero(42);
+ ^
+/usr/src/regress/usr.sbin/btrace/mapsyntax.bt:6:8: syntax error:
+ clear(0);
+ ^
diff --git a/regress/usr.sbin/btrace/mapzero.bt b/regress/usr.sbin/btrace/mapzero.bt
new file mode 100644
index 00000000000..f2f21f1d1f8
--- /dev/null
+++ b/regress/usr.sbin/btrace/mapzero.bt
@@ -0,0 +1,9 @@
+BEGIN {
+ @notamap = "bob";
+
+ /*
+ * Parser doesn't know the type of a variable and these check
+ * are performed at run-time.
+ */
+ zero(@notamap);
+}
diff --git a/regress/usr.sbin/btrace/mapzero.ok b/regress/usr.sbin/btrace/mapzero.ok
new file mode 100644
index 00000000000..75615480d61
--- /dev/null
+++ b/regress/usr.sbin/btrace/mapzero.ok
@@ -0,0 +1 @@
+btrace: invalid variable type for zero(@notamap)