A few more trivial tests.
Based on gaps in the list of functions not referenced by the test
executable.
Bug: N/A
Test: ran tests
Change-Id: I73c238e7cf360f94670c7cd13eb954341c940b7b
diff --git a/tests/utils.h b/tests/utils.h
index 410b427..a5783af 100644
--- a/tests/utils.h
+++ b/tests/utils.h
@@ -18,6 +18,7 @@
#define __TEST_UTILS_H
#include <dlfcn.h>
+#include <fcntl.h>
#include <inttypes.h>
#include <sys/mman.h>
#include <sys/types.h>
@@ -151,6 +152,12 @@
}
}
+static inline void AssertCloseOnExec(int fd, bool close_on_exec) {
+ int flags = fcntl(fd, F_GETFD);
+ ASSERT_NE(flags, -1);
+ ASSERT_EQ(close_on_exec ? FD_CLOEXEC : 0, flags & FD_CLOEXEC);
+}
+
// The absolute path to the executable
const std::string& get_executable_path();