xref: /illumos-gate/usr/src/test/util-tests/tests/mdb/numbers/tst.bitfields.ksh (revision dd72704bd9e794056c558153663c739e2012d721)
1#!/usr/bin/ksh
2#
3#
4# This file and its contents are supplied under the terms of the
5# Common Development and Distribution License ("CDDL"), version 1.0.
6# You may only use this file in accordance with the terms of version
7# 1.0 of the CDDL.
8#
9# A full copy of the text of the CDDL should have accompanied this
10# source.  A copy of the CDDL is also available via the Internet at
11# http://www.illumos.org/license/CDDL.
12#
13
14#
15# Copyright 2022 Oxide Computer Company
16#
17
18#
19# Sanity check parts of bitfields.
20#
21
22set -o pipefail
23
24tst_root="$(dirname $0)/.."
25tst_prog="$tst_root/progs/bitfields"
26tst_outfile="/tmp/mdb.bitfield.out.$$"
27tst_exp="$0.out"
28
29#
30# Top level ::print
31#
32$MDB -e "first::print -t broken_t" $tst_prog > $ODIR/stdout
33$MDB -e "second::print -t broken6491_t" $tst_prog >> $ODIR/stdout
34
35#
36# ::print of specific members
37#
38$MDB -e "first::print broken_t brk_a" $tst_prog >> $ODIR/stdout
39$MDB -e "first::print broken_t brk_b" $tst_prog >> $ODIR/stdout
40$MDB -e "first::print broken_t brk_c" $tst_prog >> $ODIR/stdout
41$MDB -e "first::print broken_t brk_d" $tst_prog >> $ODIR/stdout
42$MDB -e "first::print broken_t brk_e" $tst_prog >> $ODIR/stdout
43$MDB -e "first::print broken_t brk_f" $tst_prog >> $ODIR/stdout
44$MDB -e "first::print broken_t brk_g" $tst_prog >> $ODIR/stdout
45$MDB -e "first::print broken_t brk_h" $tst_prog >> $ODIR/stdout
46$MDB -e "first::print broken_t brk_i" $tst_prog >> $ODIR/stdout
47$MDB -e "first::print broken_t brk_j" $tst_prog >> $ODIR/stdout
48$MDB -e "first::print broken_t brk_k" $tst_prog >> $ODIR/stdout
49$MDB -e "first::print broken_t brk_l" $tst_prog >> $ODIR/stdout
50$MDB -e "first::print broken_t brk_m" $tst_prog >> $ODIR/stdout
51$MDB -e "second::print broken6491_t a" $tst_prog >> $ODIR/stdout
52$MDB -e "second::print broken6491_t b" $tst_prog >> $ODIR/stdout
53$MDB -e "second::print broken6491_t c" $tst_prog >> $ODIR/stdout
54$MDB -e "second::print broken6491_t d" $tst_prog >> $ODIR/stdout
55$MDB -e "second::print broken6491_t e" $tst_prog >> $ODIR/stdout
56$MDB -e "second::print broken6491_t f" $tst_prog >> $ODIR/stdout
57
58#
59# ::printf of members. Note, if ::printf said '%x\n' below then we would
60# include the string "\n" (not a newline) in the output. Instead we rely
61# upon the implicit newline from mdb -e.
62#
63$MDB -e "first::printf '%x' broken_t brk_a" $tst_prog >> $ODIR/stdout
64$MDB -e "first::printf '%x' broken_t brk_b" $tst_prog >> $ODIR/stdout
65$MDB -e "first::printf '%x' broken_t brk_c" $tst_prog >> $ODIR/stdout
66$MDB -e "first::printf '%x' broken_t brk_d" $tst_prog >> $ODIR/stdout
67$MDB -e "first::printf '%x' broken_t brk_e" $tst_prog >> $ODIR/stdout
68$MDB -e "first::printf '%x' broken_t brk_f" $tst_prog >> $ODIR/stdout
69$MDB -e "first::printf '%x' broken_t brk_g" $tst_prog >> $ODIR/stdout
70$MDB -e "first::printf '%x' broken_t brk_h" $tst_prog >> $ODIR/stdout
71$MDB -e "first::printf '%x' broken_t brk_i" $tst_prog >> $ODIR/stdout
72$MDB -e "first::printf '%x' broken_t brk_j" $tst_prog >> $ODIR/stdout
73$MDB -e "first::printf '%x' broken_t brk_k" $tst_prog >> $ODIR/stdout
74$MDB -e "first::printf '%x' broken_t brk_l" $tst_prog >> $ODIR/stdout
75$MDB -e "first::printf '%x' broken_t brk_m" $tst_prog >> $ODIR/stdout
76$MDB -e "second::printf '%x' broken6491_t a" $tst_prog >> $ODIR/stdout
77$MDB -e "second::printf '%x' broken6491_t b" $tst_prog >> $ODIR/stdout
78$MDB -e "second::printf '%x' broken6491_t c" $tst_prog >> $ODIR/stdout
79$MDB -e "second::printf '%x' broken6491_t d" $tst_prog >> $ODIR/stdout
80$MDB -e "second::printf '%x' broken6491_t e" $tst_prog >> $ODIR/stdout
81$MDB -e "second::printf '%x' broken6491_t f" $tst_prog >> $ODIR/stdout
82
83#
84# If we pipe the output of ::print that is a different bitfield logic
85# path. So we take that all to a `::eval '.=K'` as a basic way to get it
86# out.
87#
88$MDB -e "first::print broken_t brk_a | ::eval '.=K'" $tst_prog >> $ODIR/stdout
89$MDB -e "first::print broken_t brk_b | ::eval '.=K'" $tst_prog >> $ODIR/stdout
90$MDB -e "first::print broken_t brk_c | ::eval '.=K'" $tst_prog >> $ODIR/stdout
91$MDB -e "first::print broken_t brk_d | ::eval '.=K'" $tst_prog >> $ODIR/stdout
92$MDB -e "first::print broken_t brk_e | ::eval '.=K'" $tst_prog >> $ODIR/stdout
93$MDB -e "first::print broken_t brk_f | ::eval '.=K'" $tst_prog >> $ODIR/stdout
94$MDB -e "first::print broken_t brk_g | ::eval '.=K'" $tst_prog >> $ODIR/stdout
95$MDB -e "first::print broken_t brk_h | ::eval '.=K'" $tst_prog >> $ODIR/stdout
96$MDB -e "first::print broken_t brk_i | ::eval '.=K'" $tst_prog >> $ODIR/stdout
97$MDB -e "first::print broken_t brk_j | ::eval '.=K'" $tst_prog >> $ODIR/stdout
98$MDB -e "first::print broken_t brk_k | ::eval '.=K'" $tst_prog >> $ODIR/stdout
99$MDB -e "first::print broken_t brk_l | ::eval '.=K'" $tst_prog >> $ODIR/stdout
100$MDB -e "first::print broken_t brk_m | ::eval '.=K'" $tst_prog >> $ODIR/stdout
101$MDB -e "second::print broken6491_t a | ::eval '.=K'" $tst_prog >> $ODIR/stdout
102$MDB -e "second::print broken6491_t b | ::eval '.=K'" $tst_prog >> $ODIR/stdout
103$MDB -e "second::print broken6491_t c | ::eval '.=K'" $tst_prog >> $ODIR/stdout
104$MDB -e "second::print broken6491_t d | ::eval '.=K'" $tst_prog >> $ODIR/stdout
105$MDB -e "second::print broken6491_t e | ::eval '.=K'" $tst_prog >> $ODIR/stdout
106$MDB -e "second::print broken6491_t f | ::eval '.=K'" $tst_prog >> $ODIR/stdout
107