Message ID | 20210323221539.3532660-6-crosa@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Acceptance Test: introduce base class for Linux based tests | expand |
Hi On Wed, Mar 24, 2021 at 2:23 AM Cleber Rosa <crosa@redhat.com> wrote: > For users of the LinuxTest class, let's set up the VM with the port > redirection for SSH, instead of requiring each test to set the same > arguments. > > Signed-off-by: Cleber Rosa <crosa@redhat.com> > --- > tests/acceptance/avocado_qemu/__init__.py | 4 +++- > tests/acceptance/virtiofs_submounts.py | 4 ---- > 2 files changed, 3 insertions(+), 5 deletions(-) > > diff --git a/tests/acceptance/avocado_qemu/__init__.py > b/tests/acceptance/avocado_qemu/__init__.py > index 67f75f66e5..e75b002c70 100644 > --- a/tests/acceptance/avocado_qemu/__init__.py > +++ b/tests/acceptance/avocado_qemu/__init__.py > @@ -309,10 +309,12 @@ class LinuxTest(Test, LinuxSSHMixIn): > timeout = 900 > chksum = None > > - def setUp(self, ssh_pubkey=None): > + def setUp(self, ssh_pubkey=None, network_device_type='virtio-net'): > super(LinuxTest, self).setUp() > self.vm.add_args('-smp', '2') > self.vm.add_args('-m', '1024') > + self.vm.add_args('-netdev', 'user,id=vnet,hostfwd=:127.0.0.1:0 > -:22', > + '-device', '%s,netdev=vnet' % > network_device_type) > self.set_up_boot() > if ssh_pubkey is None: > ssh_pubkey, self.ssh_key = self.set_up_existing_ssh_keys() > diff --git a/tests/acceptance/virtiofs_submounts.py > b/tests/acceptance/virtiofs_submounts.py > index bed8ce44df..e10a935ac4 100644 > --- a/tests/acceptance/virtiofs_submounts.py > +++ b/tests/acceptance/virtiofs_submounts.py > @@ -207,10 +207,6 @@ def setUp(self): > self.vm.add_args('-kernel', vmlinuz, > '-append', 'console=ttyS0 root=/dev/sda1') > > - # Allow us to connect to SSH > - self.vm.add_args('-netdev', 'user,id=vnet,hostfwd=:127.0.0.1:0 > -:22', > - '-device', 'virtio-net,netdev=vnet') > - > self.require_accelerator("kvm") > self.vm.add_args('-accel', 'kvm') > > -- > 2.25.4 > > Looks fine, I suppose it could eventually be in LinuxSSHMixIn too for other users. Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Hi Cleber, On 3/23/21 11:15 PM, Cleber Rosa wrote: > For users of the LinuxTest class, let's set up the VM with the port > redirection for SSH, instead of requiring each test to set the same also sets the network device to virtio-net. This may be worth mentioning here in the commit msg. > arguments. > > Signed-off-by: Cleber Rosa <crosa@redhat.com> Reviewed-by: Eric Auger <eric.auger@redhat.com> Thanks Eric > --- > tests/acceptance/avocado_qemu/__init__.py | 4 +++- > tests/acceptance/virtiofs_submounts.py | 4 ---- > 2 files changed, 3 insertions(+), 5 deletions(-) > > diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py > index 67f75f66e5..e75b002c70 100644 > --- a/tests/acceptance/avocado_qemu/__init__.py > +++ b/tests/acceptance/avocado_qemu/__init__.py > @@ -309,10 +309,12 @@ class LinuxTest(Test, LinuxSSHMixIn): > timeout = 900 > chksum = None > > - def setUp(self, ssh_pubkey=None): > + def setUp(self, ssh_pubkey=None, network_device_type='virtio-net'): > super(LinuxTest, self).setUp() > self.vm.add_args('-smp', '2') > self.vm.add_args('-m', '1024') > + self.vm.add_args('-netdev', 'user,id=vnet,hostfwd=:127.0.0.1:0-:22', > + '-device', '%s,netdev=vnet' % network_device_type) > self.set_up_boot() > if ssh_pubkey is None: > ssh_pubkey, self.ssh_key = self.set_up_existing_ssh_keys() > diff --git a/tests/acceptance/virtiofs_submounts.py b/tests/acceptance/virtiofs_submounts.py > index bed8ce44df..e10a935ac4 100644 > --- a/tests/acceptance/virtiofs_submounts.py > +++ b/tests/acceptance/virtiofs_submounts.py > @@ -207,10 +207,6 @@ def setUp(self): > self.vm.add_args('-kernel', vmlinuz, > '-append', 'console=ttyS0 root=/dev/sda1') > > - # Allow us to connect to SSH > - self.vm.add_args('-netdev', 'user,id=vnet,hostfwd=:127.0.0.1:0-:22', > - '-device', 'virtio-net,netdev=vnet') > - > self.require_accelerator("kvm") > self.vm.add_args('-accel', 'kvm') > >
Hi Cleber, On 3/23/21 11:15 PM, Cleber Rosa wrote: > For users of the LinuxTest class, let's set up the VM with the port > redirection for SSH, instead of requiring each test to set the same > arguments. > > Signed-off-by: Cleber Rosa <crosa@redhat.com> > --- > tests/acceptance/avocado_qemu/__init__.py | 4 +++- > tests/acceptance/virtiofs_submounts.py | 4 ---- > 2 files changed, 3 insertions(+), 5 deletions(-) > > diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py > index 67f75f66e5..e75b002c70 100644 > --- a/tests/acceptance/avocado_qemu/__init__.py > +++ b/tests/acceptance/avocado_qemu/__init__.py > @@ -309,10 +309,12 @@ class LinuxTest(Test, LinuxSSHMixIn): > timeout = 900 > chksum = None > > - def setUp(self, ssh_pubkey=None): > + def setUp(self, ssh_pubkey=None, network_device_type='virtio-net'): I would be interested in testing with HW bridging too, when a bridge is available. Do you think we could have the netdev configurable too? This would be helpful to test vhost for instance. With respect the network device type, I am currently working on SMMU test and I need to call the parent setUp-) with the following args now: super(IOMMU, self).setUp(pubkey, 'virtio-net-pci,iommu_platform=on,disable-modern=off,disable-legacy=on') It works but I am not sure you had such kind of scenario in mind? Thanks Eric > super(LinuxTest, self).setUp() > self.vm.add_args('-smp', '2') > self.vm.add_args('-m', '1024') > + self.vm.add_args('-netdev', 'user,id=vnet,hostfwd=:127.0.0.1:0-:22', > + '-device', '%s,netdev=vnet' % network_device_type) > self.set_up_boot() > if ssh_pubkey is None: > ssh_pubkey, self.ssh_key = self.set_up_existing_ssh_keys() > diff --git a/tests/acceptance/virtiofs_submounts.py b/tests/acceptance/virtiofs_submounts.py > index bed8ce44df..e10a935ac4 100644 > --- a/tests/acceptance/virtiofs_submounts.py > +++ b/tests/acceptance/virtiofs_submounts.py > @@ -207,10 +207,6 @@ def setUp(self): > self.vm.add_args('-kernel', vmlinuz, > '-append', 'console=ttyS0 root=/dev/sda1') > > - # Allow us to connect to SSH > - self.vm.add_args('-netdev', 'user,id=vnet,hostfwd=:127.0.0.1:0-:22', > - '-device', 'virtio-net,netdev=vnet') > - > self.require_accelerator("kvm") > self.vm.add_args('-accel', 'kvm') > >
On Tue, Mar 23, 2021 at 7:16 PM Cleber Rosa <crosa@redhat.com> wrote: > > For users of the LinuxTest class, let's set up the VM with the port > redirection for SSH, instead of requiring each test to set the same > arguments. > > Signed-off-by: Cleber Rosa <crosa@redhat.com> > --- > tests/acceptance/avocado_qemu/__init__.py | 4 +++- > tests/acceptance/virtiofs_submounts.py | 4 ---- > 2 files changed, 3 insertions(+), 5 deletions(-) > Reviewed-by: Willian Rampazzo <willianr@redhat.com>
On Wed, Mar 24, 2021 at 10:10:50AM +0100, Auger Eric wrote: > Hi Cleber, > > On 3/23/21 11:15 PM, Cleber Rosa wrote: > > For users of the LinuxTest class, let's set up the VM with the port > > redirection for SSH, instead of requiring each test to set the same > also sets the network device to virtio-net. This may be worth mentioning > here in the commit msg. Absolutely, I've added that note. > > arguments. > > > > Signed-off-by: Cleber Rosa <crosa@redhat.com> > Reviewed-by: Eric Auger <eric.auger@redhat.com> > > Thanks > > Eric > Thank you! - Cleber
On Wed, Mar 24, 2021 at 12:30:18PM +0400, Marc-André Lureau wrote: > Hi > > On Wed, Mar 24, 2021 at 2:23 AM Cleber Rosa <crosa@redhat.com> wrote: > > > For users of the LinuxTest class, let's set up the VM with the port > > redirection for SSH, instead of requiring each test to set the same > > arguments. > > > > Signed-off-by: Cleber Rosa <crosa@redhat.com> > > --- > > tests/acceptance/avocado_qemu/__init__.py | 4 +++- > > tests/acceptance/virtiofs_submounts.py | 4 ---- > > 2 files changed, 3 insertions(+), 5 deletions(-) > > > > diff --git a/tests/acceptance/avocado_qemu/__init__.py > > b/tests/acceptance/avocado_qemu/__init__.py > > index 67f75f66e5..e75b002c70 100644 > > --- a/tests/acceptance/avocado_qemu/__init__.py > > +++ b/tests/acceptance/avocado_qemu/__init__.py > > @@ -309,10 +309,12 @@ class LinuxTest(Test, LinuxSSHMixIn): > > timeout = 900 > > chksum = None > > > > - def setUp(self, ssh_pubkey=None): > > + def setUp(self, ssh_pubkey=None, network_device_type='virtio-net'): > > super(LinuxTest, self).setUp() > > self.vm.add_args('-smp', '2') > > self.vm.add_args('-m', '1024') > > + self.vm.add_args('-netdev', 'user,id=vnet,hostfwd=:127.0.0.1:0 > > -:22', > > + '-device', '%s,netdev=vnet' % > > network_device_type) > > self.set_up_boot() > > if ssh_pubkey is None: > > ssh_pubkey, self.ssh_key = self.set_up_existing_ssh_keys() > > diff --git a/tests/acceptance/virtiofs_submounts.py > > b/tests/acceptance/virtiofs_submounts.py > > index bed8ce44df..e10a935ac4 100644 > > --- a/tests/acceptance/virtiofs_submounts.py > > +++ b/tests/acceptance/virtiofs_submounts.py > > @@ -207,10 +207,6 @@ def setUp(self): > > self.vm.add_args('-kernel', vmlinuz, > > '-append', 'console=ttyS0 root=/dev/sda1') > > > > - # Allow us to connect to SSH > > - self.vm.add_args('-netdev', 'user,id=vnet,hostfwd=:127.0.0.1:0 > > -:22', > > - '-device', 'virtio-net,netdev=vnet') > > - > > self.require_accelerator("kvm") > > self.vm.add_args('-accel', 'kvm') > > > > -- > > 2.25.4 > > > > > Looks fine, I suppose it could eventually be in LinuxSSHMixIn too for other > users. > That's a good point, should be possible. I'll look into that. > Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> > > > -- > Marc-André Lureau Thanks, - Cleber.
On Wed, Mar 24, 2021 at 11:36:53AM +0100, Auger Eric wrote: > Hi Cleber, > On 3/23/21 11:15 PM, Cleber Rosa wrote: > > For users of the LinuxTest class, let's set up the VM with the port > > redirection for SSH, instead of requiring each test to set the same > > arguments. > > > > Signed-off-by: Cleber Rosa <crosa@redhat.com> > > --- > > tests/acceptance/avocado_qemu/__init__.py | 4 +++- > > tests/acceptance/virtiofs_submounts.py | 4 ---- > > 2 files changed, 3 insertions(+), 5 deletions(-) > > > > diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py > > index 67f75f66e5..e75b002c70 100644 > > --- a/tests/acceptance/avocado_qemu/__init__.py > > +++ b/tests/acceptance/avocado_qemu/__init__.py > > @@ -309,10 +309,12 @@ class LinuxTest(Test, LinuxSSHMixIn): > > timeout = 900 > > chksum = None > > > > - def setUp(self, ssh_pubkey=None): > > + def setUp(self, ssh_pubkey=None, network_device_type='virtio-net'): > I would be interested in testing with HW bridging too, when a bridge is > available. Do you think we could have the netdev configurable too? > This would be helpful to test vhost for instance. > Right, I knew from the start that the user mode network would only go so far. TBH, I think it went too further than I expected. But, requiring, or supporting, other network modes can add quite a bit of complexity, depending on how much you want the framework to do. Anyway, this is a valid point/request. For the lack of a better place, and given that this may be a larger effort, I'm tracking it here: https://gitlab.com/cleber.gnu/qemu/-/issues/3 > With respect the network device type, I am currently working on SMMU > test and I need to call the parent setUp-) with the following args now: > > super(IOMMU, self).setUp(pubkey, > 'virtio-net-pci,iommu_platform=on,disable-modern=off,disable-legacy=on') > > It works but I am not sure you had such kind of scenario in mind? > I see where you're coming from, and I share the slight feeling of abusing the feature... but I think it's OK at this point. I mean, I believe it's better to focus on say, the HW bridging support as this at least works. > Thanks > > Eric > Cheers, - Cleber.
Hi, On 3/24/21 6:10 AM, Auger Eric wrote: > Hi Cleber, > > On 3/23/21 11:15 PM, Cleber Rosa wrote: >> For users of the LinuxTest class, let's set up the VM with the port >> redirection for SSH, instead of requiring each test to set the same > also sets the network device to virtio-net. This may be worth mentioning > here in the commit msg. >> arguments. >> >> Signed-off-by: Cleber Rosa <crosa@redhat.com> > Reviewed-by: Eric Auger <eric.auger@redhat.com> > > Thanks > > Eric > >> --- >> tests/acceptance/avocado_qemu/__init__.py | 4 +++- >> tests/acceptance/virtiofs_submounts.py | 4 ---- >> 2 files changed, 3 insertions(+), 5 deletions(-) >> >> diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py >> index 67f75f66e5..e75b002c70 100644 >> --- a/tests/acceptance/avocado_qemu/__init__.py >> +++ b/tests/acceptance/avocado_qemu/__init__.py >> @@ -309,10 +309,12 @@ class LinuxTest(Test, LinuxSSHMixIn): >> timeout = 900 >> chksum = None >> >> - def setUp(self, ssh_pubkey=None): >> + def setUp(self, ssh_pubkey=None, network_device_type='virtio-net'): >> super(LinuxTest, self).setUp() >> self.vm.add_args('-smp', '2') >> self.vm.add_args('-m', '1024') >> + self.vm.add_args('-netdev', 'user,id=vnet,hostfwd=:127.0.0.1:0-:22', >> + '-device', '%s,netdev=vnet' % network_device_type) >> self.set_up_boot() >> if ssh_pubkey is None: >> ssh_pubkey, self.ssh_key = self.set_up_existing_ssh_keys() >> diff --git a/tests/acceptance/virtiofs_submounts.py b/tests/acceptance/virtiofs_submounts.py >> index bed8ce44df..e10a935ac4 100644 >> --- a/tests/acceptance/virtiofs_submounts.py >> +++ b/tests/acceptance/virtiofs_submounts.py >> @@ -207,10 +207,6 @@ def setUp(self): >> self.vm.add_args('-kernel', vmlinuz, >> '-append', 'console=ttyS0 root=/dev/sda1') >> >> - # Allow us to connect to SSH Somewhat related with Eric's suggestion: keep the above comment along with the netdev setup code. - Wainer >> - self.vm.add_args('-netdev', 'user,id=vnet,hostfwd=:127.0.0.1:0-:22', >> - '-device', 'virtio-net,netdev=vnet') >> - >> self.require_accelerator("kvm") >> self.vm.add_args('-accel', 'kvm') >> >> >
On Thu, Mar 25, 2021 at 02:57:48PM -0300, Wainer dos Santos Moschetta wrote: > Hi, > > On 3/24/21 6:10 AM, Auger Eric wrote: > > Hi Cleber, > > > > On 3/23/21 11:15 PM, Cleber Rosa wrote: > > > For users of the LinuxTest class, let's set up the VM with the port > > > redirection for SSH, instead of requiring each test to set the same > > also sets the network device to virtio-net. This may be worth mentioning > > here in the commit msg. > > > arguments. > > > > > > Signed-off-by: Cleber Rosa <crosa@redhat.com> > > Reviewed-by: Eric Auger <eric.auger@redhat.com> > > > > Thanks > > > > Eric > > > > > --- > > > tests/acceptance/avocado_qemu/__init__.py | 4 +++- > > > tests/acceptance/virtiofs_submounts.py | 4 ---- > > > 2 files changed, 3 insertions(+), 5 deletions(-) > > > > > > diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py > > > index 67f75f66e5..e75b002c70 100644 > > > --- a/tests/acceptance/avocado_qemu/__init__.py > > > +++ b/tests/acceptance/avocado_qemu/__init__.py > > > @@ -309,10 +309,12 @@ class LinuxTest(Test, LinuxSSHMixIn): > > > timeout = 900 > > > chksum = None > > > - def setUp(self, ssh_pubkey=None): > > > + def setUp(self, ssh_pubkey=None, network_device_type='virtio-net'): > > > super(LinuxTest, self).setUp() > > > self.vm.add_args('-smp', '2') > > > self.vm.add_args('-m', '1024') > > > + self.vm.add_args('-netdev', 'user,id=vnet,hostfwd=:127.0.0.1:0-:22', > > > + '-device', '%s,netdev=vnet' % network_device_type) > > > self.set_up_boot() > > > if ssh_pubkey is None: > > > ssh_pubkey, self.ssh_key = self.set_up_existing_ssh_keys() > > > diff --git a/tests/acceptance/virtiofs_submounts.py b/tests/acceptance/virtiofs_submounts.py > > > index bed8ce44df..e10a935ac4 100644 > > > --- a/tests/acceptance/virtiofs_submounts.py > > > +++ b/tests/acceptance/virtiofs_submounts.py > > > @@ -207,10 +207,6 @@ def setUp(self): > > > self.vm.add_args('-kernel', vmlinuz, > > > '-append', 'console=ttyS0 root=/dev/sda1') > > > - # Allow us to connect to SSH > > Somewhat related with Eric's suggestion: keep the above comment along with > the netdev setup code. > > - Wainer > Sure, good point. Thanks, - Cleber.
diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py index 67f75f66e5..e75b002c70 100644 --- a/tests/acceptance/avocado_qemu/__init__.py +++ b/tests/acceptance/avocado_qemu/__init__.py @@ -309,10 +309,12 @@ class LinuxTest(Test, LinuxSSHMixIn): timeout = 900 chksum = None - def setUp(self, ssh_pubkey=None): + def setUp(self, ssh_pubkey=None, network_device_type='virtio-net'): super(LinuxTest, self).setUp() self.vm.add_args('-smp', '2') self.vm.add_args('-m', '1024') + self.vm.add_args('-netdev', 'user,id=vnet,hostfwd=:127.0.0.1:0-:22', + '-device', '%s,netdev=vnet' % network_device_type) self.set_up_boot() if ssh_pubkey is None: ssh_pubkey, self.ssh_key = self.set_up_existing_ssh_keys() diff --git a/tests/acceptance/virtiofs_submounts.py b/tests/acceptance/virtiofs_submounts.py index bed8ce44df..e10a935ac4 100644 --- a/tests/acceptance/virtiofs_submounts.py +++ b/tests/acceptance/virtiofs_submounts.py @@ -207,10 +207,6 @@ def setUp(self): self.vm.add_args('-kernel', vmlinuz, '-append', 'console=ttyS0 root=/dev/sda1') - # Allow us to connect to SSH - self.vm.add_args('-netdev', 'user,id=vnet,hostfwd=:127.0.0.1:0-:22', - '-device', 'virtio-net,netdev=vnet') - self.require_accelerator("kvm") self.vm.add_args('-accel', 'kvm')
For users of the LinuxTest class, let's set up the VM with the port redirection for SSH, instead of requiring each test to set the same arguments. Signed-off-by: Cleber Rosa <crosa@redhat.com> --- tests/acceptance/avocado_qemu/__init__.py | 4 +++- tests/acceptance/virtiofs_submounts.py | 4 ---- 2 files changed, 3 insertions(+), 5 deletions(-)