| 1319 | } |
| 1320 | |
| 1321 | int main(int argc, char ** argv) { |
| 1322 | if (argc > 2) { |
| 1323 | print_usage(); |
| 1324 | return 1; |
| 1325 | } |
| 1326 | |
| 1327 | std::random_device rd; |
| 1328 | const unsigned int seed = argc < 2 ? rd() : std::stoi(argv[1]); |
| 1329 | |
| 1330 | // Initialize ggml backends early so the prints aren't interleaved with the test results: |
| 1331 | ggml_backend_dev_count(); |
| 1332 | fprintf(stderr, "\n"); |
| 1333 | |
| 1334 | int npass = 0; |
| 1335 | int ntest = 0; |
| 1336 | { |
| 1337 | std::pair<int, int> result = test_handcrafted_file(seed); |
| 1338 | npass += result.first; |
| 1339 | ntest += result.second; |
| 1340 | } |
| 1341 | |
| 1342 | for (size_t i = 0; i < ggml_backend_dev_count(); ++i) { |
| 1343 | ggml_backend_dev_t dev = ggml_backend_dev_get(i); |
| 1344 | |
| 1345 | for (bool only_meta : {true, false}) { |
| 1346 | std::pair<int, int> result = test_roundtrip(dev, seed, only_meta); |
| 1347 | npass += result.first; |
| 1348 | ntest += result.second; |
| 1349 | } |
| 1350 | |
| 1351 | { |
| 1352 | std::pair<int, int> result = test_gguf_set_kv(dev, seed); |
| 1353 | npass += result.first; |
| 1354 | ntest += result.second; |
| 1355 | } |
| 1356 | } |
| 1357 | |
| 1358 | printf("%d/%d tests passed\n", npass, ntest); |
| 1359 | if (npass != ntest) { |
| 1360 | printf("\033[1;31mFAIL\033[0m\n"); |
| 1361 | return 1; |
| 1362 | } |
| 1363 | printf("\033[1;32mOK\033[0m\n"); |
| 1364 | return 0; |
| 1365 | } |
nothing calls this directly
no test coverage detected