| 35 | namespace tensorflow { |
| 36 | |
| 37 | TEST(FakePythonEnvTest, GetExecutablePath) { |
| 38 | // See if argc is greater than 1 and first arg is kPythonFile |
| 39 | // If not, rerun the executable with proper args. |
| 40 | if (myargc <= 1 || strstr(myargv[1], kMagicBazelDirSubstring) == nullptr) { |
| 41 | const char* filename = myargv[0]; |
| 42 | char* new_argv[] = { |
| 43 | myargv[0], |
| 44 | kPythonFile, |
| 45 | nullptr, |
| 46 | }; |
| 47 | |
| 48 | execv(filename, new_argv); |
| 49 | } |
| 50 | |
| 51 | Env* env = Env::Default(); |
| 52 | // We depend on the file/executable name to include python and fool the |
| 53 | // library to think this is running under the python interpreter. |
| 54 | string path = env->GetExecutablePath(); |
| 55 | EXPECT_TRUE(strstr(path.c_str(), kMagicBazelDirSubstring) != nullptr); |
| 56 | } |
| 57 | |
| 58 | } // namespace tensorflow |
| 59 |
nothing calls this directly
no test coverage detected