@@ -160,128 +160,3 @@ mod linux_ioctls {
160
160
161
161
// FIXME: Find a suitable example for readwrite_buf.
162
162
}
163
-
164
- // See C code for source of values for op calculations (does NOT work for mips/powerpc):
165
- // https://gist.github.com/posborne/83ea6880770a1aef332e
166
- //
167
- // TODO: Need a way to compute these constants at test time. Using precomputed
168
- // values is fragile and needs to be maintained.
169
-
170
- #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
171
- mod linux {
172
- #[ test]
173
- fn test_op_none ( ) {
174
- if cfg ! ( any( target_arch = "mips" , target_arch="powerpc" , target_arch="powerpc64" ) ) {
175
- assert_eq ! ( io!( b'q' , 10 ) , 0x2000710A ) ;
176
- assert_eq ! ( io!( b'a' , 255 ) , 0x200061FF ) ;
177
- } else {
178
- assert_eq ! ( io!( b'q' , 10 ) , 0x0000710A ) ;
179
- assert_eq ! ( io!( b'a' , 255 ) , 0x000061FF ) ;
180
- }
181
- }
182
-
183
- #[ test]
184
- fn test_op_write ( ) {
185
- if cfg ! ( any( target_arch = "mips" , target_arch="powerpc" , target_arch="powerpc64" ) ) {
186
- assert_eq ! ( iow!( b'z' , 10 , 1 ) , 0x80017A0A ) ;
187
- assert_eq ! ( iow!( b'z' , 10 , 512 ) , 0x82007A0A ) ;
188
- } else {
189
- assert_eq ! ( iow!( b'z' , 10 , 1 ) , 0x40017A0A ) ;
190
- assert_eq ! ( iow!( b'z' , 10 , 512 ) , 0x42007A0A ) ;
191
- }
192
- }
193
-
194
- #[ cfg( target_pointer_width = "64" ) ]
195
- #[ test]
196
- fn test_op_write_64 ( ) {
197
- if cfg ! ( any( target_arch="powerpc64" ) ) {
198
- assert_eq ! ( iow!( b'z' , 10 , ( 1 as u64 ) << 32 ) , 0x80007A0A ) ;
199
- } else {
200
- assert_eq ! ( iow!( b'z' , 10 , ( 1 as u64 ) << 32 ) , 0x40007A0A ) ;
201
- }
202
-
203
- }
204
-
205
- #[ test]
206
- fn test_op_read ( ) {
207
- if cfg ! ( any( target_arch = "mips" , target_arch="powerpc" , target_arch="powerpc64" ) ) {
208
- assert_eq ! ( ior!( b'z' , 10 , 1 ) , 0x40017A0A ) ;
209
- assert_eq ! ( ior!( b'z' , 10 , 512 ) , 0x42007A0A ) ;
210
- } else {
211
- assert_eq ! ( ior!( b'z' , 10 , 1 ) , 0x80017A0A ) ;
212
- assert_eq ! ( ior!( b'z' , 10 , 512 ) , 0x82007A0A ) ;
213
- }
214
- }
215
-
216
- #[ cfg( target_pointer_width = "64" ) ]
217
- #[ test]
218
- fn test_op_read_64 ( ) {
219
- if cfg ! ( any( target_arch="powerpc64" ) ) {
220
- assert_eq ! ( ior!( b'z' , 10 , ( 1 as u64 ) << 32 ) , 0x40007A0A ) ;
221
- } else {
222
- assert_eq ! ( ior!( b'z' , 10 , ( 1 as u64 ) << 32 ) , 0x80007A0A ) ;
223
- }
224
- }
225
-
226
- #[ test]
227
- fn test_op_read_write ( ) {
228
- assert_eq ! ( iorw!( b'z' , 10 , 1 ) , 0xC0017A0A ) ;
229
- assert_eq ! ( iorw!( b'z' , 10 , 512 ) , 0xC2007A0A ) ;
230
- }
231
-
232
- #[ cfg( target_pointer_width = "64" ) ]
233
- #[ test]
234
- fn test_op_read_write_64 ( ) {
235
- assert_eq ! ( iorw!( b'z' , 10 , ( 1 as u64 ) << 32 ) , 0xC0007A0A ) ;
236
- }
237
- }
238
-
239
- #[ cfg( any( target_os = "macos" ,
240
- target_os = "ios" ,
241
- target_os = "netbsd" ,
242
- target_os = "openbsd" ,
243
- target_os = "freebsd" ,
244
- target_os = "dragonfly" ) ) ]
245
- mod bsd {
246
- #[ test]
247
- fn test_op_none ( ) {
248
- assert_eq ! ( io!( b'q' , 10 ) , 0x2000710A ) ;
249
- assert_eq ! ( io!( b'a' , 255 ) , 0x200061FF ) ;
250
- }
251
-
252
- #[ test]
253
- fn test_op_write ( ) {
254
- assert_eq ! ( iow!( b'z' , 10 , 1 ) , 0x80017A0A ) ;
255
- assert_eq ! ( iow!( b'z' , 10 , 512 ) , 0x82007A0A ) ;
256
- }
257
-
258
- #[ cfg( target_pointer_width = "64" ) ]
259
- #[ test]
260
- fn test_op_write_64 ( ) {
261
- assert_eq ! ( iow!( b'z' , 10 , ( 1 as u64 ) << 32 ) , 0x80007A0A ) ;
262
- }
263
-
264
- #[ test]
265
- fn test_op_read ( ) {
266
- assert_eq ! ( ior!( b'z' , 10 , 1 ) , 0x40017A0A ) ;
267
- assert_eq ! ( ior!( b'z' , 10 , 512 ) , 0x42007A0A ) ;
268
- }
269
-
270
- #[ cfg( target_pointer_width = "64" ) ]
271
- #[ test]
272
- fn test_op_read_64 ( ) {
273
- assert_eq ! ( ior!( b'z' , 10 , ( 1 as u64 ) << 32 ) , 0x40007A0A ) ;
274
- }
275
-
276
- #[ test]
277
- fn test_op_read_write ( ) {
278
- assert_eq ! ( iorw!( b'z' , 10 , 1 ) , 0xC0017A0A ) ;
279
- assert_eq ! ( iorw!( b'z' , 10 , 512 ) , 0xC2007A0A ) ;
280
- }
281
-
282
- #[ cfg( target_pointer_width = "64" ) ]
283
- #[ test]
284
- fn test_op_read_write_64 ( ) {
285
- assert_eq ! ( iorw!( b'z' , 10 , ( 1 as u64 ) << 32 ) , 0xC0007A0A ) ;
286
- }
287
- }
0 commit comments