<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Luke,</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Mar 17, 2022 at 5:47 AM Luke Nowakowski-Krijger <<a href="mailto:luke.nowakowskikrijger@canonical.com">luke.nowakowskikrijger@canonical.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi Richard and Li, <br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Mar 16, 2022 at 2:46 AM Li Wang <<a href="mailto:liwang@redhat.com" target="_blank">liwang@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div style="font-size:small">Richard Palethorpe <<a href="mailto:rpalethorpe@suse.de" target="_blank">rpalethorpe@suse.de</a>> wrote:<br></div></div><div class="gmail_quote"><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
>> +<br>
>> + _cgroup_state=$(tst_cgctl require "$ctrl" $$)<br>
>> +<br>
>> + [ "$_cgroup_state" = "" ] && tst_brk TBROK "cgroup_require: No<br>
>state was set after call. Controller '$ctrl' maybe does not exist?"<br>
<br>
Perhaps we can just check the return status of tst_cgctl and exit the<br>
script if it is >0?<br></blockquote><div><br></div><div style="font-size:small">That should be work, but we need to check the _cgrou_state</div><div style="font-size:small">at other places because many shell APIs require getting Cgroup</div><div style="font-size:small">info, I guess this does not make things more easily if check the</div><div style="font-size:small">return value only one time.</div><div style="font-size:small"><br></div></div><div><br></div></div></blockquote><div><br></div><div>An idea I had to make the failure of tst_cgctl more graceful when there is a tst_brk and when it exits is to check the return of tst_cgctl and basically just mirror the error with a better message. E.g. <br></div><div><br></div><div><div style="font-size:small">tst_cgroup.c:702: TCONF: IO controller found on V2 root, skipping blkio mount that would unmount IO controller</div>cgroup_fj_function 1 TCONF: cgroup_require: tst_cgtl require exited<br></div><div><br></div><div>Something that would look like this:</div><div>_cgroup_state=$(tst_cgctl require "$ctrl" $$)<br><br> _cgroup_check_return "$?" "cgroup_require: tst_cgctl require exited"<br><br> [ "$_cgroup_state" = "" ] && tst_brk TBROK "cgroup_require: No state was set after call to tst_cgctl require?"</div><div><br></div><div>Where in _cgroup_check_return we would do the appropriate tst_brk for the return and then return a nice message (not exactly sure what it should be but it should be obvious that one error is caused by the other). Because if there was an error in tst_cgroup we would definitely want to break the test because the _cgroup_state was most likely not set. Then it would fall through to checking the _cgroup_state if everything looked good per normal which now should never happen if tst_cgctl returned a non error. <br></div><div><br></div><div>Let me know what you think :)<br></div></div></div></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">That sounds good to me.</div></div><div><br></div></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div>