35 #include <gtest/gtest.h>
39 std::string
env(
const char* n) {
const char* v = getenv(n);
return v ? v :
""; }
40 std::string
cctlib_root() { std::string r =
env(
"CCTLIB_ROOT");
return r.empty() ?
"../.." : r; }
43 int run_pin(
const std::string& tool,
const std::vector<std::string>& args) {
44 std::string pin =
pin_root() +
"/pin";
45 std::vector<char*> argv;
46 argv.push_back(
const_cast<char*
>(pin.c_str()));
47 argv.push_back(
const_cast<char*
>(
"-t"));
48 argv.push_back(
const_cast<char*
>(tool.c_str()));
49 argv.push_back(
const_cast<char*
>(
"--"));
50 for (
auto&
a : args) argv.push_back(
const_cast<char*
>(
a.c_str()));
51 argv.push_back(
nullptr);
53 if (pid < 0)
return -1;
55 int devnull = open(
"/dev/null", O_WRONLY);
56 if (devnull >= 0) { dup2(devnull, 1); dup2(devnull, 2); close(devnull); }
57 execv(pin.c_str(), argv.data());
61 if (waitpid(pid, &
status, 0) < 0)
return -1;
73 tool_ = root_ +
"/clients/obj-intel64/cache_client.so";
74 ASSERT_EQ(0, access(tool_.c_str(), F_OK)) << tool_ <<
" missing";
75 ASSERT_EQ(0, chdir(root_.c_str())) <<
"chdir failed";
83 int rc =
run_pin(tool_, {
"/bin/echo",
"hi"});
87 <<
"cache_client returned 0 -- the TLS-descriptor bug documented "
88 "in the client's TODOs may be fixed. Remove the DISABLED_ prefix "
89 "from the semantic tests below and update this test to expect "
105 GTEST_SKIP() <<
"cache_client TLS bug prevents any real coverage";
110 GTEST_SKIP() <<
"cache_client TLS bug prevents any real coverage";
int run_pin(const std::string &tool, const std::vector< std::string > &args)
std::string cctlib_root()
TEST_F(CacheClientIntegration, DISABLED_DifferingCachelineWriteNotSilent)
std::string env(const char *n)