/* SPDX-License-Identifier: LicenseRef-Starship-1.0 * Copyright (c) 2023-2026 Robert A. James */ /* harness.h -- the kernel host tests' checks (docs/v4.0.0/plans/2026-11-12-kernel-host-tests.md). * * As v4's tests: CHECK(cond, fmt, ...) counts a check, prints FAIL with the file, line and message * when it fails; DONE() prints "N checks, M failures" and is main's return value. */ #ifndef KERNEL_TESTS_HARNESS_H #define KERNEL_TESTS_HARNESS_H #include static int harness_checks = 0, harness_failures = 0; #define CHECK(c, ...) do { harness_checks++; if (!(c)) { harness_failures++; \ printf("FAIL %s:%d: ", __FILE__, __LINE__); printf(__VA_ARGS__); printf("\n"); } } while (0) #define DONE() (printf(" %d checks, %d failures\n", harness_checks, harness_failures), harness_failures != 0) #endif