diff --git a/tests/test-chat-template.cpp b/tests/test-chat-template.cpp index 628f960b18ac6..484b18435cd95 100644 --- a/tests/test-chat-template.cpp +++ b/tests/test-chat-template.cpp @@ -63,6 +63,10 @@ static std::vector find_files(const std::string & folder, const std static std::string read_file(const std::string &path) { std::ifstream fs(path, std::ios_base::binary); if (!fs.is_open()) { + fs = std::ifstream("../" + path, std::ios_base::binary); + if (!fs.is_open()) { + throw std::runtime_error("Failed to open file: " + path); + } throw std::runtime_error("Failed to open file: " + path); } fs.seekg(0, std::ios_base::end); diff --git a/tests/test-tool-call.cpp b/tests/test-tool-call.cpp index b3a824db76435..85f4decf827cf 100644 --- a/tests/test-tool-call.cpp +++ b/tests/test-tool-call.cpp @@ -21,7 +21,10 @@ static void assert_equals(const std::string & expected, const std::string & actu static std::string read_file(const std::string &path) { std::ifstream fs(path, std::ios_base::binary); if (!fs.is_open()) { - throw std::runtime_error("Failed to open file: " + path); + fs = std::ifstream("../" + path, std::ios_base::binary); + if (!fs.is_open()) { + throw std::runtime_error("Failed to open file: " + path); + } } fs.seekg(0, std::ios_base::end); auto size = fs.tellg();