test-cli: add llama-cli as order-only prerequisite in Makefile

This commit is contained in:
ochafik 2024-10-31 02:03:35 +00:00
parent 82d5e91a6f
commit ca512cc934
2 changed files with 5 additions and 2 deletions

View file

@ -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)

View file

@ -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;