Lines Matching full:self
34 def __init__(self, data) -> None: argument
35 self.d = None
36 self.signature = b"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
37 self.uid = b"1111111111111111"
40 def setUp(self) -> None: argument
41 self.d = open(DEVICE_NODE)
44 def tearDown(self) -> None: argument
45 if self.d:
46 self.d.close()
51 def setUp(self) -> None: argument
53 self.skipTest("system is supported")
54 with self.assertRaises(FileNotFoundError) as error:
56 self.assertEqual(error.exception.errno, 2)
58 def test_unauthenticated_nonce(self) -> None: argument
60 with self.assertRaises(ValueError) as error:
61 get_nonce(self.d, None)
65 def __init__(self, data) -> None: argument
66 self.data = invalid_param()
67 self.data.data = 1
70 def setUp(self) -> None: argument
72 self.skipTest("system is unsupported")
74 self.skipTest("unable to test IOCTLs without ioctl_opt")
78 def test_invalid_nonce_ioctl(self) -> None: argument
83 with self.assertRaises(OSError) as error:
84 fcntl.ioctl(self.d, INVALID1, self.data, True)
85 self.assertEqual(error.exception.errno, 22)
87 def test_invalid_setuid_ioctl(self) -> None: argument
92 with self.assertRaises(OSError) as error:
93 fcntl.ioctl(self.d, INVALID2, self.data, True)
94 self.assertEqual(error.exception.errno, 22)
96 def test_invalid_setuid_rw_ioctl(self) -> None: argument
101 with self.assertRaises(OSError) as error:
102 fcntl.ioctl(self.d, INVALID3, self.data, True)
103 self.assertEqual(error.exception.errno, 22)
105 def test_invalid_param_ioctl(self) -> None: argument
109 with self.assertRaises(OSError) as error:
110 fcntl.ioctl(self.d, INVALID4, self.data, True)
111 self.assertEqual(error.exception.errno, 22)
113 def test_invalid_call_ioctl(self) -> None: argument
117 with self.assertRaises(OSError) as error:
118 fcntl.ioctl(self.d, INVALID5, self.data, True)
119 self.assertEqual(error.exception.errno, 22)
123 def setUp(self) -> None: argument
125 self.skipTest("system is unsupported")
127 self.skipTest("system is unfused")
130 def test_unauthenticated_nonce(self) -> None: argument
132 get_nonce(self.d, None)
134 def test_multiple_unauthenticated_nonce(self) -> None: argument
137 get_nonce(self.d, None)
139 def test_authenticated_nonce(self) -> None: argument
141 with self.assertRaises(OSError) as error:
142 get_nonce(self.d, self.signature)
143 self.assertEqual(error.exception.errno, 1)
145 def test_set_uid(self) -> None: argument
147 with self.assertRaises(OSError) as error:
148 set_uid(self.d, self.uid, self.signature)
149 self.assertEqual(error.exception.errno, 1)
151 def test_get_param(self) -> None: argument
153 with self.assertRaises(OSError) as error:
154 process_param(self.d, PARAM_GET_SOC_PWR_CUR, self.signature)
155 self.assertEqual(error.exception.errno, 1)
157 def test_set_param(self) -> None: argument
159 with self.assertRaises(OSError) as error:
160 process_param(self.d, PARAM_SET_PWR_CAP, self.signature, 1000)
161 self.assertEqual(error.exception.errno, 1)
165 def setup_identity(self) -> None: argument
169 get_nonce(self.d, None)
173 set_uid(self.d, self.uid, self.signature)
177 get_nonce(self.d, self.signature)
181 def setUp(self) -> None: argument
183 self.skipTest("system is unsupported")
185 self.skipTest("system is fused")
187 self.setup_identity()
190 def test_get_valid_param(self) -> None: argument
193 soc_power_max = process_param(self.d, PARAM_GET_SOC_PWR_MAX, self.signature)
194 soc_power_min = process_param(self.d, PARAM_GET_SOC_PWR_MIN, self.signature)
195 self.assertGreater(soc_power_max[0], soc_power_min[0])
198 fmax_max = process_param(self.d, PARAM_GET_FMAX_MAX, self.signature)
199 fmax_min = process_param(self.d, PARAM_GET_FMAX_MIN, self.signature)
200 self.assertGreater(fmax_max[0], fmax_min[0])
210 result = process_param(self.d, keys[k], self.signature)
211 self.assertGreater(result[0], 0)
213 def test_get_invalid_param(self) -> None: argument
216 set_uid(self.d, self.uid, self.signature)
219 with self.assertRaises(OSError) as error:
220 process_param(self.d, (0xF,), self.signature)
221 self.assertEqual(error.exception.errno, 22)
223 def test_set_fmax(self) -> None: argument
226 original = process_param(self.d, PARAM_GET_FMAX_CAP, self.signature)
230 process_param(self.d, PARAM_SET_FMAX_CAP, self.signature, target)
232 new = process_param(self.d, PARAM_GET_FMAX_CAP, self.signature)
233 self.assertEqual(new[0], target)
236 process_param(self.d, PARAM_SET_FMAX_CAP, self.signature, original[0])
238 cur = process_param(self.d, PARAM_GET_FMAX_CAP, self.signature)
239 self.assertEqual(cur[0], original[0])
241 def test_set_power_cap(self) -> None: argument
244 original = process_param(self.d, PARAM_GET_PWR_CAP, self.signature)
248 process_param(self.d, PARAM_SET_PWR_CAP, self.signature, target)
250 new = process_param(self.d, PARAM_GET_PWR_CAP, self.signature)
251 self.assertEqual(new[0], target)
254 process_param(self.d, PARAM_SET_PWR_CAP, self.signature, original[0])
256 cur = process_param(self.d, PARAM_GET_PWR_CAP, self.signature)
257 self.assertEqual(cur[0], original[0])
259 def test_set_3d_graphics_mode(self) -> None: argument
263 with self.assertRaises(OSError) as error:
264 process_param(self.d, PARAM_GET_GFX_MODE, self.signature)
265 self.assertEqual(error.exception.errno, 2)
269 with self.assertRaises(OSError) as error:
270 process_param(self.d, PARAM_SET_GFX_MODE, self.signature, 1)
271 self.assertEqual(error.exception.errno, 2)