Fix unistd.execvpe_ENOEXEC and unistd.execvpe_failure.
These passed when run directly (as root) but failed in CTS' more restricted
environment.
Bug: http://b/33270012
Test: ran CTS tests
Change-Id: Iccb407769fe356c30d52a0a99fff11862134a250
diff --git a/tests/unistd_test.cpp b/tests/unistd_test.cpp
index f8b35cc..9d809f0 100644
--- a/tests/unistd_test.cpp
+++ b/tests/unistd_test.cpp
@@ -1347,7 +1347,8 @@
ExecTestHelper eth;
errno = 0;
ASSERT_EQ(-1, execvpe("this-does-not-exist", eth.GetArgs(), eth.GetEnv()));
- ASSERT_EQ(ENOENT, errno);
+ // Running in CTS we might not even be able to search all directories in $PATH.
+ ASSERT_TRUE(errno == ENOENT || errno == EACCES);
}
TEST(UNISTD_TEST, execvpe) {
@@ -1380,8 +1381,8 @@
ASSERT_EQ(-1, execvpe(basename(tf.filename), eth.GetArgs(), eth.GetEnv()));
ASSERT_EQ(EACCES, errno);
- // Make it executable.
- ASSERT_EQ(0, chmod(tf.filename, 0555));
+ // Make it executable (and keep it writable because we're going to rewrite it below).
+ ASSERT_EQ(0, chmod(tf.filename, 0777));
// TemporaryFile will have a writable fd, so we can test ETXTBSY while we're here...
errno = 0;