Skip to content

Commit 3b6d738

Browse files
fix(editorconfig): remove trailing whitespace in CMakeLists.txt
Co-Authored-By: Jaime Mizrachi <[email protected]>
1 parent 4ebd917 commit 3b6d738

File tree

2 files changed

+17
-24
lines changed

2 files changed

+17
-24
lines changed

common/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ if (LLAMA_BUILD_TOOLS)
145145
set(YAML_CPP_BUILD_TOOLS OFF CACHE BOOL "" FORCE)
146146
set(YAML_CPP_BUILD_CONTRIB OFF CACHE BOOL "" FORCE)
147147
FetchContent_MakeAvailable(yaml-cpp)
148-
149148
# Suppress all warnings for yaml-cpp to avoid -Werror failures
150149
if(TARGET yaml-cpp)
151150
target_compile_options(yaml-cpp PRIVATE -w)

tests/test-config-yaml.cpp

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@ namespace fs = std::filesystem;
99

1010
static void test_minimal_config() {
1111
common_params params;
12-
1312
fs::path temp_dir = fs::temp_directory_path() / "llama_test";
1413
fs::create_directories(temp_dir);
15-
14+
1615
std::string config_content = R"(
1716
model:
1817
path: test_model.gguf
@@ -24,47 +23,45 @@ prompt: "Test prompt"
2423
n_predict: 64
2524
simple_io: true
2625
)";
27-
26+
2827
fs::path config_path = temp_dir / "test_config.yaml";
2928
std::ofstream config_file(config_path);
3029
config_file << config_content;
3130
config_file.close();
32-
31+
3332
bool result = common_load_yaml_config(config_path.string(), params);
3433
assert(result);
3534
(void)result;
36-
35+
3736
assert(params.model.path == (temp_dir / "test_model.gguf").string());
3837
assert(params.n_ctx == 512);
3938
assert(params.sampling.seed == 123);
4039
assert(params.sampling.temp == 0.5f);
4140
assert(params.prompt == "Test prompt");
4241
assert(params.n_predict == 64);
4342
assert(params.simple_io == true);
44-
4543
fs::remove_all(temp_dir);
46-
44+
4745
std::cout << "test_minimal_config: PASSED\n";
4846
}
4947

5048
static void test_unknown_key_error() {
5149
common_params params;
52-
5350
fs::path temp_dir = fs::temp_directory_path() / "llama_test";
5451
fs::create_directories(temp_dir);
55-
52+
5653
std::string config_content = R"(
5754
model:
5855
path: test_model.gguf
5956
unknown_key: "should fail"
6057
n_ctx: 512
6158
)";
62-
59+
6360
fs::path config_path = temp_dir / "test_config.yaml";
6461
std::ofstream config_file(config_path);
6562
config_file << config_content;
6663
config_file.close();
67-
64+
6865
bool threw_exception = false;
6966
try {
7067
common_load_yaml_config(config_path.string(), params);
@@ -74,45 +71,42 @@ n_ctx: 512
7471
assert(error_msg.find("Unknown YAML keys") != std::string::npos);
7572
assert(error_msg.find("valid keys are") != std::string::npos);
7673
}
77-
74+
7875
assert(threw_exception);
7976
(void)threw_exception;
80-
8177
fs::remove_all(temp_dir);
82-
78+
8379
std::cout << "test_unknown_key_error: PASSED\n";
8480
}
8581

8682
static void test_relative_path_resolution() {
8783
common_params params;
88-
8984
fs::path temp_dir = fs::temp_directory_path() / "llama_test";
9085
fs::path config_dir = temp_dir / "configs";
9186
fs::create_directories(config_dir);
92-
87+
9388
std::string config_content = R"(
9489
model:
9590
path: ../models/test_model.gguf
9691
prompt_file: prompts/test.txt
9792
)";
98-
93+
9994
fs::path config_path = config_dir / "test_config.yaml";
10095
std::ofstream config_file(config_path);
10196
config_file << config_content;
10297
config_file.close();
103-
98+
10499
bool result = common_load_yaml_config(config_path.string(), params);
105100
assert(result);
106101
(void)result;
107-
102+
108103
fs::path expected_model = temp_dir / "models" / "test_model.gguf";
109104
fs::path expected_prompt = config_dir / "prompts" / "test.txt";
110-
105+
111106
assert(params.model.path == expected_model.lexically_normal().string());
112107
assert(params.prompt_file == expected_prompt.lexically_normal().string());
113-
114108
fs::remove_all(temp_dir);
115-
109+
116110
std::cout << "test_relative_path_resolution: PASSED\n";
117111
}
118112

@@ -121,7 +115,7 @@ int main() {
121115
test_minimal_config();
122116
test_unknown_key_error();
123117
test_relative_path_resolution();
124-
118+
125119
std::cout << "All tests passed!\n";
126120
return 0;
127121
} catch (const std::exception & e) {

0 commit comments

Comments
 (0)