aboutgitcode
Commit message (Collapse)AuthorAgeFilesLines
* mbuto: Add -L documentation for kselftests profileSevinj Aghayeva2022-06-142-0/+6
| | | | | | Signed-off-by: Sevinj Aghayeva <sevinj.aghayeva@gmail.com> [sbrivio: fix commit title] Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* mbuto: Add -L suboption to kselftests for listing available collectionsSevinj Aghayeva2022-06-141-1/+10
| | | | | | Signed-off-by: Sevinj Aghayeva <sevinj.aghayeva@gmail.com> [sbrivio: pass output to 'fmt -t' for readability] Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* mbuto: Add support for suboptions with optional argsSevinj Aghayeva2022-06-141-10/+14
| | | | | | | | Signed-off-by: Sevinj Aghayeva <sevinj.aghayeva@gmail.com> [sbrivio: OPTIND is reset on function return on dash and zsh: don't change it directly from subopts_get(), rather in the main getopts loop] Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* mbuto: call cmd_check before option processingSevinj Aghayeva2022-06-141-5/+5
| | | | | | | ${AWK} is needed when parsing options. Call cmd_check before option processing to make ${AWK} available. Signed-off-by: Sevinj Aghayeva <sevinj.aghayeva@gmail.com>
* mbuto: Drop -x set by mistake in previous commitStefano Brivio2022-05-191-2/+1
| | | | | Fixes: 1e4032296c38 ("mbuto: Return 0 from cleanup function") Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* mbuto: Return 0 from cleanup functionStefano Brivio2022-05-151-6/+9
| | | | | | | Otherwise, exit code if compression method is not automatic will be 1, even if we don't hit any error. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* mbuto: Don't strip kernel modules on -d, avoid variable name clashStefano Brivio2022-05-101-3/+3
| | | | | | | | | The kselftests profile shouldn't strip modules if the -d flag is passed. While at it, rename STRIP (set to 'n' if stripping is disabled) to NOSTRIP (set to 'y' if stripping is disabled), to avoid a name clash with the variable holding the 'strip' command path. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* mbuto: Add /usr/local/sbin to PATH, in pre-init script and on fakeroot callStefano Brivio2022-05-101-22/+4
| | | | | | | | | | | Otherwise, we'll source executables from /sbin or /usr/sbin first, which is of course not desirable. While at it, remove a mostly duplicated definition of FIXUP for the kselftests profile, so that we just need to fix this in the first FIXUP block. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* mbuto: In prog_add(), look for executable path in output from whichStefano Brivio2022-05-051-1/+9
| | | | | | | | | ...instead of just picking the output: on Fedora and RHEL 'which' itself is an alias, but its actual path will also be reported by 'which -a'. Reported-by: Cornelia Huck <cohuck@redhat.com> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* mbuto: Add Sevinj Aghayeva as authorStefano Brivio2022-04-292-4/+5
| | | | | | The kselftests implementation is mostly her stuff. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* demo: Add some updated kselftests examples using -C and -TStefano Brivio2022-04-291-8/+30
| | | | | | ...and, while at it, use @ to denote a enter key in demo scripts. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* mbuto: Add pre-push hook: build demos, render man page, and uploadStefano Brivio2022-04-292-0/+18
| | | | Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* mbuto: Add LICENSE fileStefano Brivio2022-04-291-0/+661
| | | | | | | The licensing terms are already clear from the SPDX tags, but adding a LICENSE file should make packaging easier. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* mbuto: kselftests: Skip modules that don't have a corresponding .ko fileStefano Brivio2022-04-291-16/+21
| | | | | | | | This might happen e.g. if we find a 'builtin' token in a multi-line modprobe output: the modprobe command will succeed, but that doesn't necessarily correspond to a module file. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* mbuto: kselftests: Check if no collections are given after adding single testsStefano Brivio2022-04-291-3/+4
| | | | | | | | ...and not before -- otherwise a -T option without -C will cause all collections to be enabled. Fixes: 2584ae2bd68b ("mbuto: kselftests: Fill in collections if none are given") Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* README: Drop some vertical spacingStefano Brivio2022-04-291-3/+0
| | | | Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* mbuto: Add Makefile to install/uninstallStefano Brivio2022-04-291-0/+19
| | | | Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* mbuto: Add man pageStefano Brivio2022-04-291-0/+273
| | | | Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* mbuto: kselftests: If all tests pass, terminate the guestStefano Brivio2022-04-251-2/+6
| | | | | | This is nice for demos but should also be quite practical. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* mbuto: kselftests: Refresh kselftest_install directory before sourcing from itStefano Brivio2022-04-251-0/+2
| | | | | | | | If we keep the existing directory and just install over it, all the programs from previous runs will be sourced from there, too. Suggested-by: Sevinj Aghayeva <sevinj.aghayeva@gmail.com> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* mbuto: kselftests: $__colls might have multiple tokensStefano Brivio2022-04-251-1/+1
| | | | | | | Quote it, when checking if it's empty. Fixes: 2584ae2bd68b ("mbuto: kselftests: Fill in collections if none are given") Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* mbuto: quote variable assignmentsSevinj Aghayeva2022-04-221-11/+11
| | | | | | Add missing quotes around variable assignments. Signed-off-by: Sevinj Aghayeva <sevinj.aghayeva@gmail.com>
* mbuto: handle collections that don't require any modulesSevinj Aghayeva2022-04-221-4/+3
| | | | | | | | | Currently we assume that given a test collection, there will always be some set of kernel modules required for running the tests in the collection. This assumption is false for some collection, such as seccomp, and this patch handles such cases. Signed-off-by: Sevinj Aghayeva <sevinj.aghayeva@gmail.com>
* mbuto: kselftests: Fill in collections if none are givenStefano Brivio2022-04-221-1/+6
| | | | | | | This fixes the case where just the profile is given, i.e. ./mbuto -p kselftests Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* mbuto: Display help message even if fakeroot is not foundStefano Brivio2022-04-221-3/+9
| | | | | | | | | The aim is the same as commit 6199e368f68d ("mbuto: Parse options before fakeroot check"), without, however, touching arguments before calling the script itself, which was the problem highlighted by commit 2458f4064b63 ("mbuto: undo commit 6199e368"). Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* mbuto: enable passing multiple collections and tests to suboptionsSevinj Aghayeva2022-04-211-15/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The run_kselftest.sh script, which is run upon booting the image created by mbuto, allows specifying multiple collections and specific tests, as in: run_kselftest.sh -c "net proc" -t "x86:iopl_32 timers:rtcpie" The above command runs (1) all the tests in the net collection, (2) all the tests in the proc collection, (3) the iopl_32 test from the x86 collection, and (4) the rtcpie test from the timers collection. This patch enables the same functionality in mbuto. Now users can run mbuto as follows: mbuto -p kselftests -C "net proc" -T "x86:iopl_32 timers:rtcpie" and mbuto generates an image that runs the same set of tests. In addition, mbuto installs only the tests in the specified collections in the image. For example, for the above command line, mbuto will install all the tests in the net, proc, x86, and timers collections (but it will only run iopl_32 and rtcpie test from the last two). Mbuto also installs only the modules needed for running these tests and warns the user if there are missing modules. Mbuto also warns the user if an invalid collection name is passed to the -C suboption. Due to irregular structure of Makefiles in selftest directories, it is hard to warn the user if an invalid test name is passed to the -T option. In this case the user will find out about the mistake after the kernel boots and run_kselftest.sh fails to run the test. Signed-off-by: Sevinj Aghayeva <sevinj.aghayeva@gmail.com>
* mbuto: quote variables when calling evalSevinj Aghayeva2022-04-211-1/+1
| | | | | | | | | | | | | | We need to pass suboptions multiple arguments as a single string, as in SUBOPT_collection="net proc" Without these quotes the result of eval becomes SUBOPT_collection=net proc which assings only the value "net" to SUBOPT_collection. Signed-off-by: Sevinj Aghayeva <sevinj.aghayeva@gmail.com>
* mbuto: undo commit 6199e368Sevinj Aghayeva2022-04-211-10/+8
| | | | | | | | | | Commit 6199e368 moves argument parsing before checking fakeroot and saves the arguments in ARGS variable. Unfortunately, passing ARGS to the recursive call flattens and removes quotes, which disables passing multiple arguments to suboptions, as in -C "net proc". For now we undo this commit to enable multiple argument passing to suboptions. Signed-off-by: Sevinj Aghayeva <sevinj.aghayeva@gmail.com>
* mbuto: fix the help error messageSevinj Aghayeva2022-04-211-2/+2
| | | | | | | | The examples in the help error message still show -c and -t suboptions when choosing specific kselftest collections and tests. Capitalize them to match the actual suboptions. Signed-off-by: Sevinj Aghayeva <sevinj.aghayeva@gmail.com>
* mbuto: add a function to join elements of a list into a stringSevinj Aghayeva2022-04-151-15/+20
| | | | | | | | In multiple places we loop over a list by joining its elements with a prefix, suffix, and a delimiter into a single string. Add a function for this functionality and replace these loops with a function. Signed-off-by: Sevinj Aghayeva <sevinj.aghayeva@gmail.com>
* mbuto: add a function to find the difference of two listsSevinj Aghayeva2022-04-151-9/+17
| | | | | | | Add a function to find the difference of two lists and use that function to determine the list of missing modules. Signed-off-by: Sevinj Aghayeva <sevinj.aghayeva@gmail.com>
* mbuto: support building a minimal image for kernel selftestsSevinj Aghayeva2022-04-151-27/+154
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add suboption -C for the case of -p kselftests for choosing a test collection to run. For example, specifying "-p kselftests -C net" creates an image that contains only the tests from the net collection and only the kernel modules needed to run those tests. If there are missing modules for running the tests, a warning will be emitted showing missing modules names. The -C option is similar to the -c option of run_kselftests.sh, but unlike run_kselftest.sh's option it currently doesn't support specifying multiple collections. This will be fixed later. Also add suboption -T for the case of -p kselftests for choosing a specific test. For example, specifying: -p kselftests -T net:ip_defrag.sh" create an image that runs only the single test when booted. This option is also similar to run_kselftest.sh's -t option, but it lacks some functionality, which will be added later. Signed-off-by: Sevinj Aghayeva <sevinj.aghayeva@gmail.com> v1 -> v2: Update TOOLS, Use variable names for commands, and use capitalized versions of run_kselftests.sh options (-C and -T).
* mbuto: misc cleanupSevinj Aghayeva2022-04-081-2/+2
| | | | | | Redirect modprobe to /dev/null to avoid verbose output. Remove unnecessary "/". Signed-off-by: Sevinj Aghayeva <sevinj.aghayeva@gmail.com>
* mbuto: handle adding built-in modulesSevinj Aghayeva2022-04-081-15/+20
| | | | | | | | We first assign the output of modprobe to a string and check if it is a built-in module and add its node if so. Otherwise, we process every token in modprobe output and try to see if it is a module. Signed-off-by: Sevinj Aghayeva <sevinj.aghayeva@gmail.com>
* mbuto: handle tokens that start with --Sevinj Aghayeva2022-04-081-3/+3
| | | | | | | | | Since we are going over the output of modprobe and trying to figure out if the token is a module name, sometimes we get strings like "--install", which breaks basename and modprobe commands. To fix this problem, we append "--" to these commands. Signed-off-by: Sevinj Aghayeva <sevinj.aghayeva@gmail.com>
* mbuto: add the -d switch back, but remove it from the variableSevinj Aghayeva2022-04-081-4/+4
| | | | | | | | | When specify -d as part of __d_opt variable, it is passed as a single string to modprobe, like "-d /foo/bar", and modprobe fails to figure out the directory name correctly. With this patch, we pass it as two different strings, like "-d" "/foo/bar", and modprobe works correctly. Signed-off-by: Sevinj Aghayeva <sevinj.aghayeva@gmail.com>
* mbuto: remove redundant -d switchSevinj Aghayeva2022-04-081-2/+2
| | | | | | with two -d switches no modprobe produces wrong output. Signed-off-by: Sevinj Aghayeva <sevinj.aghayeva@gmail.com>
* web: Add demo script and READMEStefano Brivio2022-04-072-0/+146
| | | | | | Just base and kselftests profile demos so far. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* mbuto: Discard stdout and stderr from selftests installStefano Brivio2022-04-071-18/+18
| | | | | | ...we don't want any of that in the output. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* mbuto: Make sure kselftests are "installed" before building imageStefano Brivio2022-04-061-0/+3
| | | | | | | | | We need to make sure test programs are built and everything is included in tools/testing/selftests/kselftest_install before we can include that in the guest image. Reported-by: Sevinj Aghayeva <sevinj.aghayeva@gmail.com> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* mbuto: Fix binary size calculation for librariesStefano Brivio2022-04-061-2/+2
| | | | | | | If modules are installed in subdirectories of lib/modules, we need to pass a matching wildcard to du(1). Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* mbuto: Add IFS-setting wrapper for libs_copy()Stefano Brivio2022-04-061-11/+11
| | | | | | | This avoids the need to set IFS and reset it around libs_copy() calls. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* mbuto: Create working directory before profiles are sourcedStefano Brivio2022-04-061-3/+4
| | | | | | | This offers some flexibility to source things from profile definitions themselves. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* mbuto: Use which(1) instead of 'command -v' to look for program pathsStefano Brivio2022-04-061-3/+2
| | | | | | | The output of 'command -v' varies widely across shells, which(1) output looks relatively consistent. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* mbuto: Fix up some issues from profile restructuringStefano Brivio2022-04-061-7/+5
| | | | | | | Make indentation of FIXUP definitions consistent. Add /usr/local/bin to PATH, and drop device nodes the 'passt' profile doesn't need. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* mbuto: Add draft support to run Linux kernel selftestsStefano Brivio2022-04-061-11/+134
| | | | | | | | | | This can be used to run kselftests from a kernel tree without having to install kernel and modules onto a distribution image, for example: kvm -m 8192 -cpu host -smp 2 -kernel arch/x86/boot/bzImage -initrd $(mbuto -p kselftests) -nographic -nodefaults -serial stdio -append "console=ttyS0" Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* mbuto: Make NODES and LINKS simple listsStefano Brivio2022-04-061-36/+17
| | | | | | | | | | | | | Instead of having one device node per line, use commas to separate attributes, if given. Take links as pairs of tokens, instead of requiring one line for each. This makes command-line overrides actually usable without the need to resort to printf(1) tricks. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* mbuto: Parse options before fakeroot checkStefano Brivio2022-04-061-9/+10
| | | | | | | | ...so that we can display the help message even if fakeroot is not available. Suggested-by: Wainer dos Santos Moschetta <wmoschet@redhat.com> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* mbuto: Default to 'none' for compressionStefano Brivio2022-04-051-3/+3
| | | | | | | It's typically faster also to boot, and we don't want to take seconds when running in a subshell on qemu's command line. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
* mbuto: Fix lz4 command lineStefano Brivio2022-04-051-2/+5
| | | | | | lz4 needs an explicit output file if we're not compressing to stdout. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>