Commit 048a3ca
authored
tests: make xattr test more robust (#1509)
Currently the xattr test asserts that listxattr() on Cargo.toml returns
a length of 0.
This causes a spurious failure when Cargo.toml does have xattrs, and
this can happen in fairly normal situations like when a Linux
distribution enables selinux (as it does on an AlmaLinux 10 test system,
for example):
$ cat /etc/almalinux-release
AlmaLinux release 10.0 (Purple Lion)
$ getfattr -d -m - Cargo.toml
security.selinux=[...]
$ cargo test --features=fs,stdio xattr
[...]
thread 'xattr::xattr_basic' panicked at tests/fs/xattr.rs:88:5:
assertion `left == right` failed
left: 17
right: 0
This change fixes the failure by comparing the output of rustix
*listxattr() with an external implementation, the libc crate's
implementation of listxattr(). Rather than asserting a specific value
for rustix *listxattr(), it should match the value produced by libc
listxattr().1 parent 2a1846a commit 048a3ca
1 file changed
+34
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
89 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
90 | 96 | | |
91 | 97 | | |
92 | 98 | | |
| |||
113 | 119 | | |
114 | 120 | | |
115 | 121 | | |
116 | | - | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
117 | 126 | | |
118 | 127 | | |
119 | 128 | | |
120 | 129 | | |
121 | 130 | | |
122 | 131 | | |
123 | 132 | | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
0 commit comments