File tree Expand file tree Collapse file tree 1 file changed +32
-1
lines changed
Expand file tree Collapse file tree 1 file changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ use std::collections::BTreeSet;
22use std:: ffi:: OsStr ;
33use xattr:: FileExt ;
44
5- use tempfile:: { tempfile, NamedTempFile } ;
5+ use tempfile:: { tempfile, tempfile_in , NamedTempFile } ;
66
77#[ test]
88#[ cfg( any(
@@ -171,6 +171,37 @@ fn test_multi() {
171171 assert ! ( items. is_empty( ) ) ;
172172}
173173
174+ // This test is skipped on android because the /data/tmp filesystem doesn't support >4kib of
175+ // extended attributes.
176+ #[ test]
177+ #[ cfg( any( target_os = "linux" , target_os = "freebsd" , target_os = "macos" ) ) ]
178+ fn test_large ( ) {
179+ use std:: ffi:: OsString ;
180+ use std:: os:: unix:: ffi:: OsStrExt ;
181+ // On Linux, this only works in tmpfs!
182+ let tmp = if cfg ! ( target_os = "linux" ) {
183+ tempfile_in ( "/dev/shm" )
184+ } else {
185+ tempfile ( )
186+ }
187+ . unwrap ( ) ;
188+ let mut items: BTreeSet < OsString > = ( 0 ..100 )
189+ . map ( |i| format ! ( "user.test{i:0100}" ) . into ( ) )
190+ . collect ( ) ;
191+
192+ for it in & items {
193+ tmp. set_xattr ( it, b"value" ) . unwrap ( ) ;
194+ }
195+ for it in tmp
196+ . list_xattr ( )
197+ . unwrap ( )
198+ . filter ( |x| x. as_bytes ( ) . starts_with ( b"user." ) )
199+ {
200+ assert ! ( items. remove( & * it) ) ;
201+ }
202+ assert ! ( items. is_empty( ) ) ;
203+ }
204+
174205// Tests the deref API variants - regression test for
175206// https://github.com/Stebalien/xattr/issues/57
176207#[ test]
You can’t perform that action at this time.
0 commit comments