045 (fef80ea073c4862bc9eaddb6ddb0ed970b8ad7c4) | 045 (b6aed193e5ecca32bb07e062f58f0daca06e7009) |
---|---|
1#!/usr/bin/env python3 2# group: rw quick 3# 4# Tests for fdsets and getfd. 5# 6# Copyright (C) 2012 IBM Corp. 7# 8# This program is free software; you can redistribute it and/or modify --- 63 unchanged lines hidden (view full) --- 72 self.assert_qmp(result, 'return[0]/fds[0]/opaque', 'image3:r') 73 self.assert_qmp(result, 'return[0]/fds[1]/opaque', 'image4:r') 74 self.assert_qmp(result, 'return[1]/fds[0]/opaque', 'image0:r') 75 self.assert_qmp(result, 'return[1]/fds[1]/opaque', 'image1:w+') 76 self.assert_qmp(result, 'return[2]/fds[0]/opaque', 'image2:r') 77 self.vm.shutdown() 78 79 def test_remove_fdset(self): | 1#!/usr/bin/env python3 2# group: rw quick 3# 4# Tests for fdsets and getfd. 5# 6# Copyright (C) 2012 IBM Corp. 7# 8# This program is free software; you can redistribute it and/or modify --- 63 unchanged lines hidden (view full) --- 72 self.assert_qmp(result, 'return[0]/fds[0]/opaque', 'image3:r') 73 self.assert_qmp(result, 'return[0]/fds[1]/opaque', 'image4:r') 74 self.assert_qmp(result, 'return[1]/fds[0]/opaque', 'image0:r') 75 self.assert_qmp(result, 'return[1]/fds[1]/opaque', 'image1:w+') 76 self.assert_qmp(result, 'return[2]/fds[0]/opaque', 'image2:r') 77 self.vm.shutdown() 78 79 def test_remove_fdset(self): |
80 result = self.vm.qmp('remove-fd', fdset_id=2) 81 self.assert_qmp(result, 'return', {}) | 80 self.vm.cmd('remove-fd', fdset_id=2) |
82 result = self.vm.qmp('query-fdsets') 83 self.assert_qmp(result, 'return[0]/fdset-id', 1) 84 self.assert_qmp(result, 'return[1]/fdset-id', 0) 85 self.assert_qmp(result, 'return[0]/fds[0]/opaque', 'image0:r') 86 self.assert_qmp(result, 'return[0]/fds[1]/opaque', 'image1:w+') 87 self.assert_qmp(result, 'return[1]/fds[0]/opaque', 'image2:r') 88 self.vm.shutdown() 89 90 def test_remove_fd(self): 91 result = self.vm.qmp('query-fdsets') 92 fd_image3 = result['return'][0]['fds'][0]['fd'] | 81 result = self.vm.qmp('query-fdsets') 82 self.assert_qmp(result, 'return[0]/fdset-id', 1) 83 self.assert_qmp(result, 'return[1]/fdset-id', 0) 84 self.assert_qmp(result, 'return[0]/fds[0]/opaque', 'image0:r') 85 self.assert_qmp(result, 'return[0]/fds[1]/opaque', 'image1:w+') 86 self.assert_qmp(result, 'return[1]/fds[0]/opaque', 'image2:r') 87 self.vm.shutdown() 88 89 def test_remove_fd(self): 90 result = self.vm.qmp('query-fdsets') 91 fd_image3 = result['return'][0]['fds'][0]['fd'] |
93 result = self.vm.qmp('remove-fd', fdset_id=2, fd=fd_image3) 94 self.assert_qmp(result, 'return', {}) | 92 self.vm.cmd('remove-fd', fdset_id=2, fd=fd_image3) |
95 result = self.vm.qmp('query-fdsets') 96 self.assert_qmp(result, 'return[0]/fdset-id', 2) 97 self.assert_qmp(result, 'return[1]/fdset-id', 1) 98 self.assert_qmp(result, 'return[2]/fdset-id', 0) 99 self.assert_qmp(result, 'return[0]/fds[0]/opaque', 'image4:r') 100 self.assert_qmp(result, 'return[1]/fds[0]/opaque', 'image0:r') 101 self.assert_qmp(result, 'return[1]/fds[1]/opaque', 'image1:w+') 102 self.assert_qmp(result, 'return[2]/fds[0]/opaque', 'image2:r') --- 43 unchanged lines hidden (view full) --- 146 147 def test_add_fd(self): 148 self._send_fd_by_SCM() 149 result = self.vm.qmp('add-fd', fdset_id=2, opaque='image0:r') 150 self.assert_qmp(result, 'return/fdset-id', 2) 151 152 def test_getfd(self): 153 self._send_fd_by_SCM() | 93 result = self.vm.qmp('query-fdsets') 94 self.assert_qmp(result, 'return[0]/fdset-id', 2) 95 self.assert_qmp(result, 'return[1]/fdset-id', 1) 96 self.assert_qmp(result, 'return[2]/fdset-id', 0) 97 self.assert_qmp(result, 'return[0]/fds[0]/opaque', 'image4:r') 98 self.assert_qmp(result, 'return[1]/fds[0]/opaque', 'image0:r') 99 self.assert_qmp(result, 'return[1]/fds[1]/opaque', 'image1:w+') 100 self.assert_qmp(result, 'return[2]/fds[0]/opaque', 'image2:r') --- 43 unchanged lines hidden (view full) --- 144 145 def test_add_fd(self): 146 self._send_fd_by_SCM() 147 result = self.vm.qmp('add-fd', fdset_id=2, opaque='image0:r') 148 self.assert_qmp(result, 'return/fdset-id', 2) 149 150 def test_getfd(self): 151 self._send_fd_by_SCM() |
154 result = self.vm.qmp('getfd', fdname='image0:r') 155 self.assert_qmp(result, 'return', {}) | 152 self.vm.cmd('getfd', fdname='image0:r') |
156 157 def test_getfd_invalid_fdname(self): 158 self._send_fd_by_SCM() 159 result = self.vm.qmp('getfd', fdname='0image0:r') 160 self.assert_qmp(result, 'error/class', 'GenericError') 161 self.assert_qmp(result, 'error/desc', 162 "Parameter 'fdname' expects a name not starting with a digit") 163 164 def test_closefd(self): 165 self._send_fd_by_SCM() | 153 154 def test_getfd_invalid_fdname(self): 155 self._send_fd_by_SCM() 156 result = self.vm.qmp('getfd', fdname='0image0:r') 157 self.assert_qmp(result, 'error/class', 'GenericError') 158 self.assert_qmp(result, 'error/desc', 159 "Parameter 'fdname' expects a name not starting with a digit") 160 161 def test_closefd(self): 162 self._send_fd_by_SCM() |
166 result = self.vm.qmp('getfd', fdname='image0:r') 167 self.assert_qmp(result, 'return', {}) 168 result = self.vm.qmp('closefd', fdname='image0:r') 169 self.assert_qmp(result, 'return', {}) | 163 self.vm.cmd('getfd', fdname='image0:r') 164 self.vm.cmd('closefd', fdname='image0:r') |
170 171 def test_closefd_fd_not_found(self): 172 fdname = 'image0:r' 173 result = self.vm.qmp('closefd', fdname=fdname) 174 self.assert_qmp(result, 'error/class', 'GenericError') 175 self.assert_qmp(result, 'error/desc', 176 "File descriptor named '%s' not found" % fdname) 177 178if __name__ == '__main__': 179 iotests.main(supported_fmts=['raw'], 180 supported_protocols=['file']) | 165 166 def test_closefd_fd_not_found(self): 167 fdname = 'image0:r' 168 result = self.vm.qmp('closefd', fdname=fdname) 169 self.assert_qmp(result, 'error/class', 'GenericError') 170 self.assert_qmp(result, 'error/desc', 171 "File descriptor named '%s' not found" % fdname) 172 173if __name__ == '__main__': 174 iotests.main(supported_fmts=['raw'], 175 supported_protocols=['file']) |