diff --git a/Makefile b/Makefile index 4b3940e28..001fa58dc 100644 --- a/Makefile +++ b/Makefile @@ -1641,7 +1641,7 @@ tests/test-chat-template: tests/test-chat-template.cpp \ $(CXX) $(CXXFLAGS) $(filter-out %.h $<,$^) $(call GET_OBJ_FILE, $<) -o $@ $(LDFLAGS) tests/test-cli: tests/test-cli.cpp \ - $(OBJ_ALL) + $(OBJ_ALL) | llama-cli $(CXX) $(CXXFLAGS) -c $< -o $(call GET_OBJ_FILE, $<) $(CXX) $(CXXFLAGS) $(filter-out %.h $<,$^) $(call GET_OBJ_FILE, $<) -o $@ $(LDFLAGS) diff --git a/tests/test-cli.cpp b/tests/test-cli.cpp index 8be29c6f8..de249a921 100644 --- a/tests/test-cli.cpp +++ b/tests/test-cli.cpp @@ -54,7 +54,8 @@ int main(int argc, char ** argv) { std::string cli_bin = argc == 2 ? argv[1] : "./llama-cli"; try { - std::system("mkdir out/"); + if (std::system("mkdir -p out/") != 0) + throw std::runtime_error("Failed to create out/ directory."); { auto p = run(cli_bin + " --help"); @@ -74,6 +75,8 @@ int main(int argc, char ** argv) { assert_equals(" hello was a big, red ball. He", p.out); assert_equals("", p.err); } + + return 0; } catch (const std::exception & ex) { std::cerr << "[test-cli] Error: " << ex.what() << std::endl; return 1;