New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Death tests fail in a macOS sandbox #2195
Comments
I have just encountered a seemingly similar/same problem with a sandboxed app (crashing as I'm using 391ce62 and the macro has changed... But reading the 2019 change above, and the current code... it feels like that the fix was maybe lost over the years?
This GTEST_CHECK fails (Unfortuntely I can't see the contents of The interesting(?) thing about this... I can run my app from the terminal Noticed that console.app has a line
So, (and I suspect it's something with how I've got sandbox setup) but running from Another update: removing all my googletest |
Adding the macro I assume this isn't really the intention, and maybe the system should work under some extreme sandboxing (my particular tests work, but not explicitly using any tmp filesystem test stuff) |
I'm working on porting a system that works on iOS and Linux to macOS (firebase/firebase-ios-sdk#434). We've written some death tests that work on Linux but are skipped on iOS because that platform doesn't support the mechanism. Now that we're trying macOS these tests are enabled, but failing.
Our system still has considerable Objective-C code, so on iOS and macOS we're running Googletest via XCTest, Apple's testing framework for Objective-C. We've written a bridge that allows our Objective-C and C++ tests to run together in one pass under Xcode.
This works swimmingly on iOS, but on macOS this ends up running XCTest-based tests in an app sandbox, where it fails because
/tmp
isn't writeable from a sandbox. In this configuration themkstemp
in gtest-port.cc at line 1115, fails witherrno
= 1 (Operation not permitted).Apparently the right thing to do is use the value of
TMPDIR
from the environment, which will point somewhere else. On my host on one run its value looked like/var/folders/60/8r_t5wts5rn8bqz2l90c6ncm00380s/T/
. Adding some logic to compute the temporary directory prior to callingmkstemp
allows the death tests to succeed.I've cooked up a PR to fix this and will submit it shortly.
The text was updated successfully, but these errors were encountered: