| 140 | } // namespace |
| 141 | |
| 142 | int main(int argc, char *argv[]) { |
| 143 | #ifndef _WIN32 |
| 144 | std::signal(SIGTERM, termination_signal_handler); |
| 145 | #endif |
| 146 | |
| 147 | // Setup for TEST_CASE in test_interpreter.cpp, tagging on a large random number: |
| 148 | std::string updated_pythonpath("pybind11_test_with_catch_PYTHONPATH_2099743835476552"); |
| 149 | const char *preexisting_pythonpath = getenv("PYTHONPATH"); |
| 150 | if (preexisting_pythonpath != nullptr) { |
| 151 | #if defined(_WIN32) |
| 152 | updated_pythonpath += ';'; |
| 153 | #else |
| 154 | updated_pythonpath += ':'; |
| 155 | #endif |
| 156 | updated_pythonpath += preexisting_pythonpath; |
| 157 | } |
| 158 | #if defined(_WIN32) |
| 159 | _putenv_s("PYTHONPATH", updated_pythonpath.c_str()); |
| 160 | #else |
| 161 | setenv("PYTHONPATH", updated_pythonpath.c_str(), /*replace=*/1); |
| 162 | #endif |
| 163 | |
| 164 | std::cout << "[ STARTING ] " << get_utc_timestamp() << '\n'; |
| 165 | std::cout.flush(); |
| 166 | |
| 167 | py::scoped_interpreter guard{}; |
| 168 | |
| 169 | auto result = Catch::Session().run(argc, argv); |
| 170 | |
| 171 | std::cout << "[ DONE ] " << get_utc_timestamp() << " (result " << result << ")\n"; |
| 172 | std::cout.flush(); |
| 173 | |
| 174 | return result < 0xff ? result : 0xff; |
| 175 | } |
no test coverage detected