Artifact d7ad52d192c30a7c4c73512dbe2cdce817777046c277336a91cc6191bc4e21d5:
- File
test/fuzz_stamp.c
— part of check-in
[3f905be4f2]
at
2026-11-12 21:17:36
on branch trunk
— Every branch of suit's own code is tested, and the gates that keep it so
make cover fails unless every function, line, region and branch in src/ is run by a test. Every system call goes through a wrapper in platform.c that a test build can make fail, so failed-call branches are tested too. The release binary carries none of that code, and a test checks it.
Also: ensure() for invariants, a wider warning set as errors, the clang static analyzer, a second fuzz target for the stamp reader, a replay binary for saved fuzz inputs, a release build that the speed budget now measures, and make ci for the forge's Linux runner: the suite under gcc's sanitizers, then under a pinned Fil-C.
210 unit checks and 214 shell cases. The no-change run measured 0.56 to 0.60 ms over an empty program with the release build.
The Fil-C run and the Linux build have not been run yet. They run first on the forge's runner.
Decisions recorded: the wardrobe is two repositories, libfossil is used through its C API with suit's own file writer, and where each gate runs. (user: dmestas, size: 1044) [annotate] [blame] [check-ins using]
// Fuzz target for the stamp reader: each input becomes the stamp file. #include "platform.h" #include "stamp.h" #include <fcntl.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size); static char stamp_path[4096]; static void setup(void) { const char *tmp = getenv("TMPDIR"); char dir[4096]; snprintf(dir, sizeof dir, "%s/suit-fuzz.XXXXXX", tmp != nullptr ? tmp : "/tmp"); if (mkdtemp(dir) == nullptr) abort(); setenv("SUIT_HOME", dir, 1); snprintf(stamp_path, sizeof stamp_path, "%s/stamp", dir); } int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { if (stamp_path[0] == '\0') setup(); int fd = open(stamp_path, O_WRONLY | O_CREAT | O_TRUNC, 0644); if (fd < 0 || (size > 0 && write(fd, data, size) != (ssize_t)size)) abort(); close(fd); [[maybe_unused]] int rc = stamp_run(); ensure(rc == EXIT_UNCHANGED || rc == EXIT_CHANGED || rc == EXIT_BAD_STAMP); return 0; }