ninja check-libcxx failing when running under sudo


It seems that several of libcxx unit tests are failing when running under sudo (sudo ninja check-libcxx). For example, some of the tests check the permission of the file/directory after the filesystem operation, but sudo privilege overrides it. I wonder if it’s possible to guard a test based on the user’s privilege? Thanks!



Do you have a list of the tests that fail, and why? It would be interesting to understand whether those failures are accurate (and we should fix libc++), or whether the tests are erroneous.

It seems like a bad idea to run tests under sudo… but we probably should look into why you’re seeing that behavior.

A list can be found in

– Marshall

The tests fail because they’re trying to cause errors and test error reporting in filesystem. Normally via removing permissions from a filesystem entity, then attempting to read or manipulate it.
Testing for error conditions in filesystem is tricky. For example, you can’t reasonable test for an out-of-space condition. The EPERM tests are often the only tests that exercise the failure paths.