From a18479f1300ee3aa300789734a2be1cdbacf1b66 Mon Sep 17 00:00:00 2001 From: mpi Date: Wed, 21 Apr 2021 10:30:46 +0000 Subject: [PATCH] Test local variables, boolean and print() of variables other than maps. --- regress/usr.sbin/btrace/Makefile | 5 +++-- regress/usr.sbin/btrace/arithm.bt | 4 ++-- regress/usr.sbin/btrace/boolean.bt | 8 +++++++- regress/usr.sbin/btrace/boolean.ok | 4 +++- regress/usr.sbin/btrace/print.bt | 7 +++++++ regress/usr.sbin/btrace/print.ok | 3 +++ 6 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 regress/usr.sbin/btrace/print.bt create mode 100644 regress/usr.sbin/btrace/print.ok diff --git a/regress/usr.sbin/btrace/Makefile b/regress/usr.sbin/btrace/Makefile index 251163dd58b..9310d320247 100644 --- a/regress/usr.sbin/btrace/Makefile +++ b/regress/usr.sbin/btrace/Makefile @@ -1,10 +1,11 @@ -# $OpenBSD: Makefile,v 1.8 2020/12/16 18:44:55 bluhm Exp $ +# $OpenBSD: Makefile,v 1.9 2021/04/21 10:30:46 mpi Exp $ BTRACE?= /usr/sbin/btrace # scripts that don't need /dev/dt BT_LANG_SCRIPTS= arithm beginend boolean comments delete exit map \ - map-unnamed maxoperand min+max+sum multismts nsecs+var + map-unnamed maxoperand min+max+sum multismts nsecs+var \ + print BT_KERN_SCRIPTS= diff --git a/regress/usr.sbin/btrace/arithm.bt b/regress/usr.sbin/btrace/arithm.bt index 552ce9082f0..e2d35a83a1b 100644 --- a/regress/usr.sbin/btrace/arithm.bt +++ b/regress/usr.sbin/btrace/arithm.bt @@ -10,6 +10,6 @@ END { printf("a - b = %d\n", @a - @b); - @c = @a + 2 * @b; - printf("c = %d, total = %d\n", @c, (@c - @b) / 5); + $c = @a + 2 * @b; + printf("c = %d, total = %d\n", $c, ($c - @b) / 5); } diff --git a/regress/usr.sbin/btrace/boolean.bt b/regress/usr.sbin/btrace/boolean.bt index 4de756f9187..41f02f4521d 100644 --- a/regress/usr.sbin/btrace/boolean.bt +++ b/regress/usr.sbin/btrace/boolean.bt @@ -1,8 +1,14 @@ BEGIN { - @a = 9; + @a = 8; @b = 1; printf("a & b = %d\n", @a & @b); printf("a | b = %d\n", @a | @b); } + +END +{ + printf("a && b = %d\n", @a && @b); + printf("a || b = %d\n", @a || @b); +} diff --git a/regress/usr.sbin/btrace/boolean.ok b/regress/usr.sbin/btrace/boolean.ok index 68b70a4e3fc..6fa0b9007eb 100644 --- a/regress/usr.sbin/btrace/boolean.ok +++ b/regress/usr.sbin/btrace/boolean.ok @@ -1,2 +1,4 @@ -a & b = 1 +a & b = 0 a | b = 9 +a && b = 1 +a || b = 1 diff --git a/regress/usr.sbin/btrace/print.bt b/regress/usr.sbin/btrace/print.bt new file mode 100644 index 00000000000..622f9c61a28 --- /dev/null +++ b/regress/usr.sbin/btrace/print.bt @@ -0,0 +1,7 @@ +BEGIN { + $str = "string"; + + print(890); + print($str); + print(comm); +} diff --git a/regress/usr.sbin/btrace/print.ok b/regress/usr.sbin/btrace/print.ok new file mode 100644 index 00000000000..0da183e9001 --- /dev/null +++ b/regress/usr.sbin/btrace/print.ok @@ -0,0 +1,3 @@ +890 +string +btrace -- 2.20.1