-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Misc fixes and virtme-ng support #96
base: main
Are you sure you want to change the base?
Conversation
tests/ioctl/test_ioctl.c
Outdated
@@ -28,9 +28,9 @@ int main(int argc, char **argv) | |||
} | |||
|
|||
/* This one should hit the FILE__GETATTR or FILE__IOCTL test */ | |||
rc = ioctl(fd, FIGETBSZ, &val); | |||
rc = ioctl(fd, FS_IOC_GETFLAGS, &val); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't yet had a chance to go through all the changes, but this part seems to make the ioctl
test fail under NFS (see tools/nfs.sh
). Can you look into it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for spotting, fixed via
/*
* This one should hit the FILE__GETATTR or FILE__IOCTL test.
* FIGETBSZ is not available on overlayfs,
* and FS_IOC_GETFLAGS is not available on NFS.
*/
rc = ioctl(fd, FIGETBSZ, &val);
if( rc < 0 ) {
if(errno == EINVAL) {
rc = ioctl(fd, FS_IOC_GETFLAGS, &val);
}
if( rc < 0 ) {
perror("test_ioctl:FIGETBSZ/FS_IOC_GETFLAGS");
exit(1);
}
}
Pass make options, e.g. number of jobs, which allows to build multiple test executables in a single sub-directory in parallel. Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Reported by shellcheck(1). Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Improve portability and avoid actual issues being hidden. Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Signed-off-by: Christian Göttsche <cgzones@googlemail.com> --- v2: order targets alphabetically
OverlayFS does not support a couple of ioctl's and other features, like NFS, so skip and tweak relevant tests. Signed-off-by: Christian Göttsche <cgzones@googlemail.com> --- v2: fix support for NFS, by using FS_IOC_GETFLAGS only on FIGETBZ failure
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Also fix a typo in the unknown protocol case. Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
fsnotify support might be missing from the running kernel. Pre-load the loop module to ensure creating a loop device succeeds. Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Required for inet_socket/tcp checks. Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Required for netlink_socket tests. Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Be more cautious on unexpected failures and input: binder Avoid returning garbage value from binder_parse() in case of an unexpected (impossible?) empty buffer. Store create_bpf_*() results temporarily in an int to actually perform the error checks (they are currently no-ops on unsigned). bpf Initialize variable in case the program gets called without the associated option. cap_userns Use appropriate types and casts to avoid implicit conversions. execshare Avoid use of void pointer arithmetic. fdreceive Do not call non async-safe exit(3) in signal handler. Drop dead assignment. filesystem Initialize variables in case the programs get called without the associated options. inet_socket/unix_socket Declare usage() as noreturn to help compilers avoid issuing inaccurate warnings. inherit Use a large enough buffer for a potential huge PID. key_socket Avoid comparison of signed with unsigned integer. module_load Correctly check for an open(2) failure. nnp_nosuid Check if wait(2) succeeded before checking the child status. notify Check if opening file was successful. Use appropriate type for read(2) return value. prlimit Set all members of the new limit structure. sctp Use appropriate iterator type. Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Warnings issued by -Wall and -Wextra most of the time point to actual issues in the code. Treat the as error, so the resulting test run failure will be investigated and the issue handled. Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Clang does not support header files included in the compile command: clang -g -O2 -Werror -Wall -Wextra -Wno-error=unused-parameter -D_GNU_SOURCE -DHAVE_BPF -DHAVE_FS_WATCH_PERM -DHAVE_BPF bpf_test.c bpf_common.c bpf_common.h -lselinux -lbpf -o bpf_test clang: error: cannot specify -o when generating multiple output files Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
With the following patches the testsuite runs successfully in a virtme-ng environment. A minimal virtme-ng default kernel configuration was used combined with the testsuite's included defconfig.
Also while working on failed testcases I tweaked some scripts and test code.
Test result:
The included policy needs to be tweaked (not included in this pull request):
Also to speed up the development cycle I used the following two scripts:
tools/vng_stage1.sh
tools/vng_stage2.sh