diff mbox

[1/4] iotests: add migration corner cases test

Message ID 20170225193155.447462-2-vsementsov@virtuozzo.com
State New
Headers show

Commit Message

Vladimir Sementsov-Ogievskiy Feb. 25, 2017, 7:31 p.m. UTC
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
 tests/qemu-iotests/175     | 71 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/qemu-iotests/175.out |  5 ++++
 tests/qemu-iotests/group   |  1 +
 3 files changed, 77 insertions(+)
 create mode 100644 tests/qemu-iotests/175
 create mode 100644 tests/qemu-iotests/175.out

Comments

Fam Zheng March 7, 2017, 9:14 a.m. UTC | #1
On Sat, 02/25 22:31, Vladimir Sementsov-Ogievskiy wrote:
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
>  tests/qemu-iotests/175     | 71 ++++++++++++++++++++++++++++++++++++++++++++++
>  tests/qemu-iotests/175.out |  5 ++++
>  tests/qemu-iotests/group   |  1 +
>  3 files changed, 77 insertions(+)
>  create mode 100644 tests/qemu-iotests/175
>  create mode 100644 tests/qemu-iotests/175.out
> 
> diff --git a/tests/qemu-iotests/175 b/tests/qemu-iotests/175
> new file mode 100644
> index 0000000000..ef86c70db5
> --- /dev/null
> +++ b/tests/qemu-iotests/175
> @@ -0,0 +1,71 @@
> +#!/usr/bin/env python
> +#
> +# Test migration corner-cases
> +#
> +# Copyright (C) Vladimir Sementsov-Ogievskiy 2017
> +#
> +# This program is free software; you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License as published by
> +# the Free Software Foundation; either version 2 of the License, or
> +# (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
> +#
> +
> +import os
> +import iotests
> +import time
> +from iotests import qemu_img
> +
> +disk = os.path.join(iotests.test_dir, 'disk')
> +
> +class TestMigrationCornerCases(iotests.QMPTestCase):
> +    def setUp(self):
> +        qemu_img('create', '-f', iotests.imgfmt, disk, '10M')
> +        self.vm = iotests.VM().add_drive(disk)
> +        self.vm.launch()
> +
> +    def tearDown(self):
> +        self.vm.shutdown()
> +        os.remove(disk)
> +
> +    def test_migrate_reset_cont_write(self):
> +        result = self.vm.qmp('migrate', uri='exec:cat>/dev/null')
> +        self.assert_qmp(result, 'return', {})
> +        time.sleep(4)

Should you query the migration status instead of blink sleep?

> +
> +        result = self.vm.qmp('human-monitor-command',
> +                             command_line='system_reset')
> +        self.assert_qmp(result, 'return', '')
> +
> +        result = self.vm.qmp('cont')
> +        self.assert_qmp(result, 'return', {})
> +
> +        result = self.vm.qmp('human-monitor-command',
> +                             command_line='qemu-io drive0 "write 0 512"')
> +        self.assert_qmp(result, 'return', '')
> +
> +    def test_migrate_savevm(self):
> +        result = self.vm.qmp('migrate', uri='exec:cat>/dev/null')
> +        self.assert_qmp(result, 'return', {})
> +        time.sleep(4)

Ditto.

> +
> +        result = self.vm.qmp('human-monitor-command', command_line='savevm')
> +        self.assert_qmp(result, 'return', '')
> +
> +    def test_savevm_set_speed_savevm(self):
> +        for i in range(10):
> +            result = self.vm.qmp('human-monitor-command', command_line='savevm')
> +            self.assert_qmp(result, 'return', '')
> +
> +            result = self.vm.qmp('migrate_set_speed', value=9223372036853727232)
> +            self.assert_qmp(result, 'return', {})
> +
> +if __name__ == '__main__':
> +    iotests.main()
> diff --git a/tests/qemu-iotests/175.out b/tests/qemu-iotests/175.out
> new file mode 100644
> index 0000000000..8d7e996700
> --- /dev/null
> +++ b/tests/qemu-iotests/175.out
> @@ -0,0 +1,5 @@
> +...
> +----------------------------------------------------------------------
> +Ran 3 tests
> +
> +OK
> diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
> index 985b9a6a36..1f4bf03185 100644
> --- a/tests/qemu-iotests/group
> +++ b/tests/qemu-iotests/group
> @@ -167,3 +167,4 @@
>  172 auto
>  173 rw auto
>  174 auto
> +175 auto quick

Not sure it still qualifies as "quick" given the two "time.sleep(4)", but more
importantly I wonder if the sleep should be improved.

Fam
Dr. David Alan Gilbert March 7, 2017, 11:23 a.m. UTC | #2
* Vladimir Sementsov-Ogievskiy (vsementsov@virtuozzo.com) wrote:
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>

If I understand this correctly, these are tests that currently fail and
are fixed by the following patches;  in which case it needs reordering
to keep stuff bisectable.

Dave

> ---
>  tests/qemu-iotests/175     | 71 ++++++++++++++++++++++++++++++++++++++++++++++
>  tests/qemu-iotests/175.out |  5 ++++
>  tests/qemu-iotests/group   |  1 +
>  3 files changed, 77 insertions(+)
>  create mode 100644 tests/qemu-iotests/175
>  create mode 100644 tests/qemu-iotests/175.out
> 
> diff --git a/tests/qemu-iotests/175 b/tests/qemu-iotests/175
> new file mode 100644
> index 0000000000..ef86c70db5
> --- /dev/null
> +++ b/tests/qemu-iotests/175
> @@ -0,0 +1,71 @@
> +#!/usr/bin/env python
> +#
> +# Test migration corner-cases
> +#
> +# Copyright (C) Vladimir Sementsov-Ogievskiy 2017
> +#
> +# This program is free software; you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License as published by
> +# the Free Software Foundation; either version 2 of the License, or
> +# (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
> +#
> +
> +import os
> +import iotests
> +import time
> +from iotests import qemu_img
> +
> +disk = os.path.join(iotests.test_dir, 'disk')
> +
> +class TestMigrationCornerCases(iotests.QMPTestCase):
> +    def setUp(self):
> +        qemu_img('create', '-f', iotests.imgfmt, disk, '10M')
> +        self.vm = iotests.VM().add_drive(disk)
> +        self.vm.launch()
> +
> +    def tearDown(self):
> +        self.vm.shutdown()
> +        os.remove(disk)
> +
> +    def test_migrate_reset_cont_write(self):
> +        result = self.vm.qmp('migrate', uri='exec:cat>/dev/null')
> +        self.assert_qmp(result, 'return', {})
> +        time.sleep(4)
> +
> +        result = self.vm.qmp('human-monitor-command',
> +                             command_line='system_reset')
> +        self.assert_qmp(result, 'return', '')
> +
> +        result = self.vm.qmp('cont')
> +        self.assert_qmp(result, 'return', {})
> +
> +        result = self.vm.qmp('human-monitor-command',
> +                             command_line='qemu-io drive0 "write 0 512"')
> +        self.assert_qmp(result, 'return', '')
> +
> +    def test_migrate_savevm(self):
> +        result = self.vm.qmp('migrate', uri='exec:cat>/dev/null')
> +        self.assert_qmp(result, 'return', {})
> +        time.sleep(4)
> +
> +        result = self.vm.qmp('human-monitor-command', command_line='savevm')
> +        self.assert_qmp(result, 'return', '')
> +
> +    def test_savevm_set_speed_savevm(self):
> +        for i in range(10):
> +            result = self.vm.qmp('human-monitor-command', command_line='savevm')
> +            self.assert_qmp(result, 'return', '')
> +
> +            result = self.vm.qmp('migrate_set_speed', value=9223372036853727232)
> +            self.assert_qmp(result, 'return', {})
> +
> +if __name__ == '__main__':
> +    iotests.main()
> diff --git a/tests/qemu-iotests/175.out b/tests/qemu-iotests/175.out
> new file mode 100644
> index 0000000000..8d7e996700
> --- /dev/null
> +++ b/tests/qemu-iotests/175.out
> @@ -0,0 +1,5 @@
> +...
> +----------------------------------------------------------------------
> +Ran 3 tests
> +
> +OK
> diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
> index 985b9a6a36..1f4bf03185 100644
> --- a/tests/qemu-iotests/group
> +++ b/tests/qemu-iotests/group
> @@ -167,3 +167,4 @@
>  172 auto
>  173 rw auto
>  174 auto
> +175 auto quick
> -- 
> 2.11.1
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
diff mbox

Patch

diff --git a/tests/qemu-iotests/175 b/tests/qemu-iotests/175
new file mode 100644
index 0000000000..ef86c70db5
--- /dev/null
+++ b/tests/qemu-iotests/175
@@ -0,0 +1,71 @@ 
+#!/usr/bin/env python
+#
+# Test migration corner-cases
+#
+# Copyright (C) Vladimir Sementsov-Ogievskiy 2017
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+import os
+import iotests
+import time
+from iotests import qemu_img
+
+disk = os.path.join(iotests.test_dir, 'disk')
+
+class TestMigrationCornerCases(iotests.QMPTestCase):
+    def setUp(self):
+        qemu_img('create', '-f', iotests.imgfmt, disk, '10M')
+        self.vm = iotests.VM().add_drive(disk)
+        self.vm.launch()
+
+    def tearDown(self):
+        self.vm.shutdown()
+        os.remove(disk)
+
+    def test_migrate_reset_cont_write(self):
+        result = self.vm.qmp('migrate', uri='exec:cat>/dev/null')
+        self.assert_qmp(result, 'return', {})
+        time.sleep(4)
+
+        result = self.vm.qmp('human-monitor-command',
+                             command_line='system_reset')
+        self.assert_qmp(result, 'return', '')
+
+        result = self.vm.qmp('cont')
+        self.assert_qmp(result, 'return', {})
+
+        result = self.vm.qmp('human-monitor-command',
+                             command_line='qemu-io drive0 "write 0 512"')
+        self.assert_qmp(result, 'return', '')
+
+    def test_migrate_savevm(self):
+        result = self.vm.qmp('migrate', uri='exec:cat>/dev/null')
+        self.assert_qmp(result, 'return', {})
+        time.sleep(4)
+
+        result = self.vm.qmp('human-monitor-command', command_line='savevm')
+        self.assert_qmp(result, 'return', '')
+
+    def test_savevm_set_speed_savevm(self):
+        for i in range(10):
+            result = self.vm.qmp('human-monitor-command', command_line='savevm')
+            self.assert_qmp(result, 'return', '')
+
+            result = self.vm.qmp('migrate_set_speed', value=9223372036853727232)
+            self.assert_qmp(result, 'return', {})
+
+if __name__ == '__main__':
+    iotests.main()
diff --git a/tests/qemu-iotests/175.out b/tests/qemu-iotests/175.out
new file mode 100644
index 0000000000..8d7e996700
--- /dev/null
+++ b/tests/qemu-iotests/175.out
@@ -0,0 +1,5 @@ 
+...
+----------------------------------------------------------------------
+Ran 3 tests
+
+OK
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
index 985b9a6a36..1f4bf03185 100644
--- a/tests/qemu-iotests/group
+++ b/tests/qemu-iotests/group
@@ -167,3 +167,4 @@ 
 172 auto
 173 rw auto
 174 auto
+175 auto quick