Skip to content
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

Add negative tests for vcpu ioctls on aarch64 #116

Open
andreeaflorescu opened this issue Sep 23, 2020 · 5 comments
Open

Add negative tests for vcpu ioctls on aarch64 #116

andreeaflorescu opened this issue Sep 23, 2020 · 5 comments
Labels
good first issue Good for newcomers

Comments

@andreeaflorescu
Copy link
Member

There are already negative tests for x86_64:

#[cfg(target_arch = "x86_64")]

We should make sure that we do not duplicate test code. We can do that by having a platform independent negative test with ioctls that are valid on all supported platforms, and 2 platform dependent tests (one for x86_64, and one for aarch64).

@andreeaflorescu andreeaflorescu added the good first issue Good for newcomers label Sep 23, 2020
@anth1y
Copy link

anth1y commented Mar 31, 2021

does this issue still need to be worked on? @andreeaflorescu

@andreeaflorescu
Copy link
Member Author

@anth1y yes, this is still relevant. We need to also provide negative tests (similar to those of x86) on aarch64.

@anth1y
Copy link

anth1y commented Mar 31, 2021

@andreeaflorescu thank you for getting back to me I'll take a look at this tonight. pardon my ignorance but what exactly is meant by "negative tests"?

@andreeaflorescu
Copy link
Member Author

Here we were referring to having similar negative tests as the existing one on x86_64. The test is called test_faulty_vcpu_fd and it is linked in the issue description.

That test is a "negative test" because it is using invalid FDs to check the return value of various ioctls.

        let faulty_vcpu_fd = VcpuFd {
            vcpu: unsafe { File::from_raw_fd(-1) },
            kvm_run_ptr: KvmRunWrapper {
                kvm_run_ptr: mmap_anonymous(10),
                mmap_size: 10,
            },
        };

        assert_eq!(faulty_vcpu_fd.get_regs().unwrap_err().errno(), badf_errno);

So we should create faulty vCPU, KVM, Device, and VM file descriptors (as you can see in the previous example), and run the appropriate ioctls on both x86_64 and aarch64. Does that make sense?

@anth1y
Copy link

anth1y commented Mar 31, 2021

https://www.youtube.com/watch?v=vhu3NTOHz-M I gotcha thank you sooo much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants