Skip to contentSkip to conversation

enable passing multiple collections/tests to suboptions

PATCH In review Sevinj Aghayeva 2 participants 3 messages Apr 17, 2022 – Apr 18, 2022

lore
Share & tools
lore
#0 lore raw

cover enable passing multiple collections/tests to suboptions

Enable mbuto's -C and -T options accept multiple collection names and test names, similar to the -c and -t options of run_kselftest.sh.

Sevinj Aghayeva (4):
mbuto: fix the help error message
mbuto: undo commit 6199e368
mbuto: quote variables when calling eval
mbuto: enable passing multiple collections and tests to suboptions

 mbuto | 71 ++++++++++++++++++++++++++++++++++++-----------------------
 1 file changed, 43 insertions(+), 28 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw
Quoted 2 lines · On Sun, 17 Apr 2022 13:27:17 -0400 Sevinj Aghayeva <[email protected]>…

Enable mbuto's -C and -T options accept multiple collection names and test names, similar to the -c and -t options of run_kselftest.sh.

Thanks, this looks rather complete now. I just started reviewing the series and I plan to finish reviewing/testing later today or early tomorrow as I'm adding this kind of usage to demos and documentation (also in progress).

Two smaller things I think we're missing:

- your patch 2/4 reverts the fix for "mbuto -h" with no fakeroot available (sorry, commit message of 6199e368 wasn't exceedingly clear). If fakeroot is not there, you don't even get a help message.

Perhaps we could handle that as special case (in a second revision of patch 2, or as another patch), something on the lines of:

	if ! FAKEROOT="$(command -v fakeroot)"; then
		__missing_fakeroot=1
	fi

	...

	# after parsing options, and displaying usage if needed
	if [ ${__missing_fakeroot} -eq 1 ]; then
		err "Not root and no fakeroot available, exiting"
	fi

- with the 'kvm/qemu-kvm ... -initrd $(mbuto) ...' usage, we leave the image we built around. It could be deleted as soon as qemu is done reading it. I have two ideas (more welcome of course):

1. use inotifywait(1) if available, use it (in a subshell) to watch for the IN_CLOSE_NOWRITE event on the file, then delete it after the event and close the subshell. If it's not available, 'sleep 60' (perhaps with a warning) looks reasonable

2. or check the parent PID from mbuto, once it terminates, delete the file and exit the subshell. I think it's more portable, but it might require some tricks (I haven't tried at all) to keep the subshell alive as long as it's needed

...in both cases, deletion should be configurable, I guess enabled by default if and only if we're running from a non-interactive context, that is, '$(mbuto)' as opposed to 'mbuto' on a command line. Check with [ ! -t 0 ]: if stdin (file descriptor 0) is not open, the user didn't start mbuto directly.

Signature · 1 line
Stefano
#2 lore raw
Quoted 21 lines · Stefano Brivio
Quoted 2 lines · On Sun, 17 Apr 2022 13:27:17 -0400 Sevinj Aghayeva <[email protected]>…

Enable mbuto's -C and -T options accept multiple collection names and test names, similar to the -c and -t options of run_kselftest.sh.

Thanks, this looks rather complete now. I just started reviewing the series and I plan to finish reviewing/testing later today or early tomorrow as I'm adding this kind of usage to demos and documentation (also in progress).

Two smaller things I think we're missing:

- your patch 2/4 reverts the fix for "mbuto -h" with no fakeroot available (sorry, commit message of 6199e368 wasn't exceedingly clear). If fakeroot is not there, you don't even get a help message.

Perhaps we could handle that as special case (in a second revision of patch 2, or as another patch), something on the lines of:

Quoted 10 lines
        if ! FAKEROOT="$(command -v fakeroot)"; then
                __missing_fakeroot=1
        fi

        ...

        # after parsing options, and displaying usage if needed
        if [ ${__missing_fakeroot} -eq 1 ]; then
                err "Not root and no fakeroot available, exiting"
        fi

Sounds good. Just sent a patch to do this.

Quoted 15 lines

- with the 'kvm/qemu-kvm ... -initrd $(mbuto) ...' usage, we leave the image we built around. It could be deleted as soon as qemu is done reading it. I have two ideas (more welcome of course):

1. use inotifywait(1) if available, use it (in a subshell) to watch for the IN_CLOSE_NOWRITE event on the file, then delete it after the event and close the subshell. If it's not available, 'sleep 60' (perhaps with a warning) looks reasonable

2. or check the parent PID from mbuto, once it terminates, delete the file and exit the subshell. I think it's more portable, but it might require some tricks (I haven't tried at all) to keep the subshell alive as long as it's needed

Quoted 5 lines

...in both cases, deletion should be configurable, I guess enabled by default if and only if we're running from a non-interactive context, that is, '$(mbuto)' as opposed to 'mbuto' on a command line. Check with [ ! -t 0 ]: if stdin (file descriptor 0) is not open, the user didn't start mbuto directly.

I'll need to experiment with that to see what works. I'll ping you in IRC.

Thanks!

Quoted 4 lines

--
Stefano

Signature · 1 line
Sevinj.Aghayeva