| 32 | using namespace usbguard; |
| 33 | |
| 34 | static std::string createFile(const std::vector<std::string> lines) |
| 35 | { |
| 36 | std::string filepath("/tmp/usbguard-test.XXXXXX"); |
| 37 | const int fd = ::mkstemp(&filepath[0]); |
| 38 | |
| 39 | if (fd < 0) { |
| 40 | throw std::runtime_error("cannot create temporary file"); |
| 41 | } |
| 42 | |
| 43 | for (const auto& line : lines) { |
| 44 | ::write(fd, line.c_str(), line.size()); |
| 45 | ::write(fd, "\n", 1); |
| 46 | } |
| 47 | |
| 48 | ::close(fd); |
| 49 | return filepath; |
| 50 | } |
| 51 | |
| 52 | TEST_CASE("Regression: GitHub PR #209", "[regression]") |
| 53 | { |
no outgoing calls
no test coverage detected