BMCWEB debug question

Ed Tanous ed at tanous.net
Mon Nov 18 07:13:45 AEDT 2024


On Tue, Nov 12, 2024 at 2:39 PM 喻柏炜 <yubowei0982 at phytium.com.cn> wrote:
>
> Hello,pm
>
>
> Each time debuging a funcion of one line code will cost me too much time.
> 1.type "bitbake bmcweb",this action will cost me 5 minutes.
> 2.Replace bmcweb binary file.
> 3.reboot bmcweb.

First of all, the ideal workflow involves not building all of bmcweb
in your "main" work loop.  Write unit tests, and develop the unit
tests until you have confidence in your code.

If you have ubuntu 24.04 or newer, you can do this simply with:
# configure the project
meson builddir --buildtype=debug

# build the specific unit test
ninja -C builddir utility_test (replace with name of test you want to build)

# run the unit test
./builddir/utility_test

This loop on my machine takes about 90 seconds if I'm making edits to
the shared library code, and ~25 seconds if I'm only updating the unit
test code, which doesn't require a shared-file recompile.  This is
still too long (ideally it would be a few seconds), but it's
significantly shorter than your workflow now.

Once that is done, I will generally switch to qemu, which is faster to
boot up, and can test non-hardware changes quickly.

After that I will generally run on real hardware.

>
> This seriers of actions cost me too much time.I don't think it is a right develop flow as a web engineer.Could u show me right way for debuging?
>
>
> The second question is that I didn't find any action relate with "meson setup buildder && ninja " in bmcweb.bb.How does it work?how can I use “Incremental Implementation” to decrease waste time in action "bitbake bmcweb" which cost me too much time.

Take a look at the meson.bbclass in yocto, and it will give you an
idea of how it works.
There's a tradeoff made here between binary size and link time.
bmcweb enables LTO, and builds most of the application logic into a
single library that's then static linked into the executable and the
unit tests.  b_lto controls this setting in yocto, and is disabled
implicitly in debug build types.  You could try both of these things
in your workflow and see if it's better.

>
>
> The third question.Dose bmcweb have Hot Deployment method?Must I replace binary bmcweb in obmc-phosphor-image for detectting writing result?

https://github.com/openbmc/bmcweb/blob/02c1e29fceae14aa5cb7a1b3d6bcaa4c0a256f2e/TESTING.md?plain=1#L42

I suspect is what you're looking for?  bmcweb will happily run from
tmp, detect the "normal" binary running, and start on a different
port.  If you're really needing to make quick edits on hardware, this
is generally faster than loading a full image, but has some caveats.

>
> Dose it exist a function to detect result more convinently like npm run serve in webui-vue,that is more convenient and more safe.It used proxy and will never replace binary file in obmc.

If you build with the instructions above, bmcweb will happily launch
from your desktop, although without dbus services, there's not a lot
you can test when running in that mode unless you set up more services
on your desktop (user auth, etc)



If you have any patches that would improve your workflow, please send
them to gerrit.

>
>
> Thanks!
>
>
>
>
> 信息安全声明:本邮件包含信息归发件人所在组织所有,发件人所在组织对该邮件拥有所有权利。请接收者注意保密,未经发件人书面许可,不得向任何第三方组织和个人透露本邮件所含信息。
> Information Security Notice: The information contained in this mail is solely property of the sender's organization.This mail communication is confidential.Recipients named above are obligated to maintain secrecy and are not permitted to disclose the contents of this communication to others.


More information about the openbmc mailing list