diff --git a/dist/freebsd/tracer.env.sample b/dist/freebsd/tracer.env.sample index d4cb4f2..b94b057 100644 --- a/dist/freebsd/tracer.env.sample +++ b/dist/freebsd/tracer.env.sample @@ -12,3 +12,5 @@ TRACER_URL=https:// # TRACER_ISSUES_LABELS=a,b the labels each issue gets (none without it) # TRACER_UPSTREAM_REPO=OWNER/NAME the repository whose main a report's build is compared with, its owner's nightly # the nightlies' (scarletnx/ScarletNX without it; asked with TRACER_ISSUES_TOKEN) +# TRACER_MIN_FREE=MiB the site's file system's MiB kept free: a report that would go under it is refused (1024 +# without it; 0 for no floor) diff --git a/docs/TESTING.md b/docs/TESTING.md index cfbda3c..9515604 100644 --- a/docs/TESTING.md +++ b/docs/TESTING.md @@ -76,7 +76,9 @@ temporary folder: brings screenshots to a report full of logs, one too large said with its size, one whose bytes fail the zip's check; the issue's screenshots as the site's pictures; - a database of the first schema upgraded, a deleted message, a report's number never reused, the hourly limit, the - JSON with no Discord id, the channels it answers in (a list, `all`, none, and other words refused); + site's disk kept free (a report and an update refused under `TRACER_MIN_FREE` before any download, with the MiB + said, one that fits taken, a disk that cannot be read, no floor), the JSON with no Discord id, the channels it + answers in (a list, `all`, none, and other words refused); - the issues an approval files, through a fake GitHub: an administrator's reaction files one, a second files none, anyone else's reaction or another emoji nothing, a refusal said and tried again, the settings and their refusals; - how old a report's build is, through a fake GitHub: behind main, the plurals, a commit asked once an hour, `-dirty` @@ -89,15 +91,18 @@ temporary folder: in; - the MCP server over that site: its handshake and protocol versions, notifications, broken and unknown requests, each tool's filters, limits and errors, and a query's 16 words at most; -- runs of edenprobe: edenprobe's families and which lose their detail, the drivers by the ban table's names and by - their own, each driver's version numbering both ways, the system's family; the cut of a log (the service, net, pad - and unknown suites' details and the net notes, every other byte as it was); ScarletNX's log, Eden's, rEden's and a - report.jsonl read, two copies of a run, a run cut short, a launch that went on after a crash, lines edenprobe does - not write; a run through JSON and the answers refused (another emulator, a detail the cut takes out, a case that is - none); the run in a Share Log zip, a run begun, none; whole runs as reports (the reply's counts and what was left - out, the database and the kept log without the player, no game's list, the same run again from one person and from - another, Eden's and the console's, deleted with their message, a resumed launch kept as a log, one through the - worker), and a report kept before made the run's at the next start; +- runs of Amberlith (edenprobe before its 1.0.0): its families and which lose their detail, the drivers by the ban + table's names and by their own, each driver's version numbering both ways, the system's family; the cut of a log + (the service, net, pad, libc and unknown suites' details and the net notes, every other byte as it was), Amberlith + 1.0.0's new suites in their families; ScarletNX's log, + Eden's, rEden's and a report.jsonl read, a run that Amberlith 1.0.0's note opens and a name that only begins like + it, two copies of a run, a run cut short, a launch that went on after a crash, lines Amberlith does not write; a run + through JSON and the answers refused (another emulator, another program or none, a detail the cut takes out, a case + that is none); the run in a Share Log zip, a run begun, none; whole runs as reports (the reply's counts and what was + left out, the database and the kept log without the player, no game's list, the same run again from one person and + from another, Eden's and the console's, deleted with their message, a resumed launch kept as a log, a run of + Amberlith named so in the reply, the title and the page, one kept before the database knew the program's name read + as edenprobe's, one through the worker), and a report kept before made the run's at the next start; - the rules over the runs ([What the runs say together](./TRACER.md#what-the-runs-say-together)), on fixtures that sit on each threshold: a candidate and its draft line, and none with one person, two failing reports, one other driver, two passing reports, a passing build eight days before or after (seven count), a failure Eden's or of another mode; @@ -115,8 +120,10 @@ temporary folder: tests to fail on each: `tracer/src/rules.c` (a threshold one off, a comparison that lets one more in, a condition left out: 19 mutants, `test_tracer --rules`); what a report keeps of its files, in `files.c`, `report.c` and `issues.c` (a zip's screenshots, a picture never read as a log, the paths outside a home, the limits said with their values: 30 -mutants, `test_tracer --files`); and the worker's locale for a zip's names, made before it shuts itself in (1 mutant, -the whole suite). A mutant they pass, or one whose text its file no longer has once, fails it. About 30 s. +mutants, `test_tracer --files`); what a log holds of a run, in `probe.c` (Amberlith's starting note, a name that only +begins like it, libc's detail kept, a worker's answer naming another program: 4 mutants, `test_tracer --probe`); and +the worker's locale for a zip's names, made before it shuts itself in (1 mutant, the whole suite). A mutant they pass, +or one whose text its file no longer has once, fails it. About 30 s. `make -C tracer bench [RUNS=1000] [FOLDER=/tmp/tracer-bench]` (`tracer/tests/bench_probe.c`, built by `make test`, run by hand) keeps RUNS runs like edenprobe 0.9.0's graphics run (1069 cases) on fifteen machines in a new database in diff --git a/docs/TRACER-MCP.md b/docs/TRACER-MCP.md index 6465e98..fdaf530 100644 --- a/docs/TRACER-MCP.md +++ b/docs/TRACER-MCP.md @@ -19,9 +19,9 @@ one either. It is built and packaged with Tracer ([Build](./BUILD.md#tracer)). | `read_log` | a log's lines with their numbers, from a line on or those that hold some text, and where to go on | | `get_screenshot` | one of a report's screenshots, as an image (8 MiB at most; a larger one is named by its address) | | `signatures` | the failures grouped by where they happened, across games, the most reported first | -| `probe_matrix` | edenprobe's cases by machine (an emulator, a driver and its version, a system), each case's results on each as `[pass, fail, skip, crashed]`; by words, suite, family, driver, emulator, the failing cases alone (the default) or all | -| `probe_case` | one case of edenprobe, by its key or by words of its suite and name (words that find several list them): its results on each machine and its newest failures and skips, each with its report, machine and detail | -| `ban_candidates` | what the runs of edenprobe say together ([What the runs say together](./TRACER.md#what-the-runs-say-together)): ban candidates with their draft lines, ScarletNX's own failures and regressions; by driver and by kind | +| `probe_matrix` | Amberlith's cases (edenprobe's, before its 1.0.0) by machine (an emulator, a driver and its version, a system), each case's results on each as `[pass, fail, skip, crashed]`; by words, suite, family, driver, emulator, the failing cases alone (the default) or all | +| `probe_case` | one case of Amberlith, by its key or by words of its suite and name (words that find several list them): its results on each machine and its newest failures and skips, each with its report, machine and detail | +| `ban_candidates` | what the runs of Amberlith say together ([What the runs say together](./TRACER.md#what-the-runs-say-together)): ban candidates with their draft lines, ScarletNX's own failures and regressions; by driver and by kind | An agent adds it by its address, Claude Code with: diff --git a/docs/TRACER.md b/docs/TRACER.md index b33b9ed..ba372ee 100644 --- a/docs/TRACER.md +++ b/docs/TRACER.md @@ -9,7 +9,7 @@ * [What a report keeps](#what-a-report-keeps) * [Adding to a report](#adding-to-a-report) * [A log sent without the mention](#a-log-sent-without-the-mention) - * [A run of edenprobe](#a-run-of-edenprobe) + * [A run of Amberlith](#a-run-of-amberlith) * [Deleting, and the hourly limit](#deleting-and-the-hourly-limit) * [Summarized and named again](#summarized-and-named-again) * [Commands](#commands) @@ -57,8 +57,8 @@ for it). The worker's answer is checked before any of its files moves from the w IPv4 address but the loopback's written as `[ip]` and each e-mail address as `[email]` (a network game's log names the player's address and the other players'), and summarized: the game, its title ID and version, the build, the system and GPU, how the run ended and where, the service commands and what else the runtime missed, the last lines. A file - that is no ScarletNX log, nor a run of edenprobe, is named in the reply and not kept. Of a `.zip`, the log is the - entry [a run of edenprobe](#a-run-of-edenprobe) is in, else its first `.log`, `.txt` or `.jsonl`, else its first + that is no ScarletNX log, nor a run of Amberlith, is named in the reply and not kept. Of a `.zip`, the log is the + entry [a run of Amberlith](#a-run-of-amberlith) is in, else its first `.log`, `.txt` or `.jsonl`, else its first file that is no picture or video; never one of its pictures, nor a Mac's `__MACOSX/` fork. A zip's names are read as UTF-8 whatever the worker's locale (ScarletNX's Share Log flags each name so), in a locale it makes before it shuts itself in; an entry whose name it cannot read is passed by, and the walk goes on. @@ -127,9 +127,10 @@ log line says which. A reply that brings files makes a report of those, as any m is part of a report already gets that report's link; a message of another channel or server, a bot's or a webhook's, one that is gone and one with no log are refused, each with why. -### A run of edenprobe +### A run of Amberlith -[edenprobe](https://github.com/scarletnx/edenprobe) checks an emulator against the console, case by case. A report +[Amberlith](https://github.com/scarletnx/amberlith) (named edenprobe before its 1.0.0) checks an emulator against the +console, case by case. A report whose first log holds a run of it is the run's, kept apart from the games: in no game's list, nor `all.html` and `api/reports.json`, but on the site's Probe pages ([The site](#the-site)), by machine: the emulator, the driver and its version, the system. A run comes in three forms: @@ -142,23 +143,27 @@ version, the system. A run comes in three forms: lines as `Debug.Emulated` ones. Eden logs no driver ID: it is read from the driver's name, and the reply says so; - the report itself, `report.jsonl`, which names no machine: it is kept as the console's reference. -A run begins at its note `edenprobe 0.9.0 (v0.9.0) starting`; of several in one file (the Share Log's `summary.txt` +A run begins at its note `Amberlith 1.0.0 (v1.0.0) starting`, or an older version's `edenprobe 0.9.0 (v0.9.0) +starting`; of several in one file (the Share Log's `summary.txt` holds a run's output and its log), the last whole one is read, one with its summary, else the last one. Kept of it: the machine (the system and its family, the GPU, the driver's VkDriverId, name and version as its vendor numbers it, -which are ScarletNX's ban table's), the emulator and its build, edenprobe's version, the words its mode note says ran -(`cpu graphics net notime`), and each case's suite, name, tier, result, reason, detail (its first 300 bytes) and time, -10000 cases at most. - -The detail of the cases of edenprobe's service, net and pad families, and of a suite its table does not have, is left -out, and so is the text of the net family's notes: the account cases name a user's id and nickname, the network ones -the addresses and sessions the net file names. They are taken out of every log a report keeps, wherever such a line -is, before anything reads it, so neither the database nor the site has them. - -The reply gives the counts and the suites that failed most, `edenprobe 0.9.0 on radv, Mesa 26.1.8 (Linux): 1034 +which are ScarletNX's ban table's), the emulator and its build, the program's name as that note gives it and its +version, the words its mode note says ran (`cpu graphics net notime`), and each case's suite, name, tier, result, +reason, detail (its first 300 bytes) and time, 10000 cases at most. Each case's family is its suite's in Amberlith +1.0.0's table (judge, cpu, pad, graphics, nvn, fs, kernel, display, video, audio, service, net, game, libc, demo, +music, pace), which has every suite edenprobe's had. + +The detail of the cases of Amberlith's service, net, pad and libc families, and of a suite its table does not have, is +left out, and so is the text of the net family's notes: the account cases name a user's id and nickname, the network +ones the addresses and sessions the net file names, libc's system and socket suites the machine and its network. They +are taken out of every log a report keeps, wherever such a line is, before anything reads it, so neither the database +nor the site has them. + +The reply gives the counts and the suites that failed most, `Amberlith 1.0.0 on radv, Mesa 26.1.8 (Linux): 1034 passed, 26 failed (astc 15, astcimage 9, tex8k 2), 6 skipped, 3 crashed`, and what the run lacks: no summary line, a summary that counts more cases than the file has (a launch that went on after a crash logs its own cases alone), lines -edenprobe does not write, a report.jsonl's machine. The same run sent again by the same person, line for line, is -answered with the first report's link and kept no more. A log whose lines of edenprobe have no run's start, a launch +Amberlith does not write, a report.jsonl's machine. The same run sent again by the same person, line for line, is +answered with the first report's link and kept no more. A log whose lines of Amberlith have no run's start, a launch that went on after a crash, is kept as the game's log, and the reply says why it is no run. ### Deleting, and the hourly limit @@ -171,12 +176,18 @@ it is deleted, as replies link to it. Ten reports and updates an hour from one person at most, counted as they are asked for: one whose files were no log counts, and so does one deleted since (its files were downloaded); a message with no file and no note does not. +A report or an update whose files (their sizes as Discord gives them) would leave the site's file system with less +free than `TRACER_MIN_FREE` (1024 MiB by default) is refused before anything is downloaded, and counts in no limit: +the reply and the log say the MiB free, the floor and the files' size (`the site's disk has 1030 MiB free, and Tracer +keeps 1024 MiB of it free; these files (10.0 MiB) would go under that`). A disk shared with other services never fills +with reports; the start's log line says how much is free. + ### Summarized and named again When the log summary or the list of names changes (`scripts/sync-logscan.sh`, `scripts/make-titles.py`), or what a report keeps of its logs (`TR_FACTS`), the next start summarizes each kept log again, draws each report's facts again from its first log, files a report whose first log now names another game under that game, names one its logs don't -name from the list, makes a report whose first log holds a run of edenprobe the run's, and takes out of each kept log +name from the list, makes a report whose first log holds a run of Amberlith the run's, and takes out of each kept log what a run's lines would say of the player and the paths outside a home. A report keeps no zip, only its log and screenshots: a zip's screenshots sent before Tracer read them are not found again, and are added by a reply with them. @@ -228,7 +239,7 @@ Without the token nothing is asked, and only a `-dirty` build is said. ## What the runs say together -Fixed rules over the runs of edenprobe (`tracer/src/rules.c`), each comparing one case of one edenprobe version run +Fixed rules over the runs of Amberlith (`tracer/src/rules.c`), each comparing one case of one version of it run with the same words, and counting ScarletNX's runs; Eden's are shown beside them, as a second emulator failing a case on the same driver points at the driver. A case fails where its result is `fail`; a skip, a crash among them, says nothing. Nothing here is applied: a person reads it and decides. @@ -248,7 +259,7 @@ nothing. Nothing here is applied: a person reads it and decides. the ban table's format (ScarletNX's `src/nx/gpu/vk/extension_bans.txt`), its key `` for a person to choose, as the runs cannot say which extension or feature breaks: - | off | radv | >= 26.1.0 < 26.2.0 | linux | * | fails edenprobe's astc case "..." | Tracer #12, #15, #18; edenprobe 0.9.0 "..." | edenprobe:astc: ... | 2026-11-07 broken on 26.1.8 | - + | off | radv | >= 26.1.0 < 26.2.0 | linux | * | fails edenprobe's astc case "..." | Tracer #12, #15, #18; Amberlith 1.0.0 "..." | edenprobe:astc: ... | 2026-11-07 broken on 26.1.8 | - - **ScarletNX's own failure**: a case that fails on 3 drivers or more, or on every driver seen when two or more are; a driver counts as failing when its runs fail the case and none passes it. Such a case is no ban candidate. Eden's @@ -280,11 +291,11 @@ Static files, drawn again where a report changes them, and all of them at each s | `all.html` | every report, the newest first | | `g/.html` | a game's reports: `` its title ID, or `n-` and its name's letters for a game known by name | | `r//` | a report: its facts, its screenshots (each shown small, and opened whole by a click), and each log with its summary, to read or download (a log sent in a `.zip` or a `.gz` is kept as its text and downloads as one: `logs.zip` as `logs.log`, `game.log.gz` as `game.log`); a run of edenprobe's has its counts and each case that did not pass | -| `probe/index.html` | the runs of edenprobe: the machines (an emulator, a driver and its version, a system), each case that fails somewhere with its results on each machine, each suite's, and each run | -| `probe/c/.html` | a case of edenprobe: `` 16 hex digits of its suite and name; its results on each machine, what the rules say of it, and its newest 200 failures and skips with their detail | +| `probe/index.html` | the runs of Amberlith: the machines (an emulator, a driver and its version, a system), each case that fails somewhere with its results on each machine, each suite's, and each run | +| `probe/c/.html` | a case of Amberlith: `` 16 hex digits of its suite and name; its results on each machine, what the rules say of it, and its newest 200 failures and skips with their detail | | `probe/d/.html` | a driver, by the ban table's name (`radv`, `nvidia`; `unknown` for the console's reports): its machines, the cases that fail on it, its ban candidates, its runs | | `probe/candidates.html` | [what the runs say together](#what-the-runs-say-together): ban candidates with their draft lines, ScarletNX's own failures, regressions | -| `api/` | the same as JSON: `games.json`, `reports.json`, `r/.json` (a report with its logs' summaries and the notes added later, a run of edenprobe's with its run); `probe/matrix.json`, `probe/c/.json`, `probe/d/.json`, `probe/candidates.json`; no Discord id | +| `api/` | the same as JSON: `games.json`, `reports.json`, `r/.json` (a report with its logs' summaries and the notes added later, a run of Amberlith's with its run, its `program` the name its starting note gives); `probe/matrix.json`, `probe/c/.json`, `probe/d/.json`, `probe/candidates.json`; no Discord id | | `style.css`, `site.js`, `tracer.svg` | copied from `TRACER_ASSETS` at each start | The lists filter in the browser (`site.js`: by words, outcome, branch, GPU; kept in the address's `#`) and work @@ -312,6 +323,7 @@ fill in; an empty value stops the service): | `TRACER_ISSUES_TOKEN` | none: needed with the repository | a fine-grained token of that repository alone, with Issues read and write and nothing else; never in the log | | `TRACER_ISSUES_EMOJI` | the check mark (U+2705) | the approval's emoji: its character, or a server emoji's name | | `TRACER_ISSUES_LABELS` | none | `label,label`: the labels each issue gets | +| `TRACER_MIN_FREE` | `1024` | the MiB the site's file system keeps free: a report whose files would go under it is refused ([above](#deleting-and-the-hourly-limit)); `0` for no floor; a value that is no whole number from 0 to 1048576 stops it, naming the value | | `TRACER_UPSTREAM_REPO` | `scarletnx/ScarletNX` | `OWNER/NAME`: the repository whose main a report's build is compared with, its owner's `nightly` the nightlies'; asked with `TRACER_ISSUES_TOKEN`, not at all without it | A `TRACER_` key it does not know stops it, naming the key; so does an id that is not one, an address that is not diff --git a/scripts/test-mutants.py b/scripts/test-mutants.py index 4a71ce0..2b5c348 100755 --- a/scripts/test-mutants.py +++ b/scripts/test-mutants.py @@ -6,7 +6,8 @@ lets one more in, a condition left out), and which files a report keeps and what of them (tracer/src/files.c, report.c and issues.c, tests run as test_tracer --files: a zip's screenshots, a picture never read as a log, the paths outside a home cut, the limits said with their values; the worker's locale for a zip's names, by the whole -suite). A mutant the tests pass is a rule nothing holds. Each runs in a copy of the tree in a temporary folder; the +suite), and what a log holds of a run of Amberlith (tracer/src/probe.c, test_tracer --probe: its starting note, a +worker's answer). A mutant the tests pass is a rule nothing holds. Each runs in a copy of the tree in a temporary folder; the checkout is never written. python3 scripts/test-mutants.py [--root DIR] [--cc CC] @@ -266,6 +267,34 @@ ), ) +# what a log holds of a run of Amberlith (tracer/src/probe.c, tests run as test_tracer --probe) +PROBE = ( + ( + "Amberlith's starting note opens no run", + 'probe.c', + 'static const char* const PROGRAMS[] = {"Amberlith", "edenprobe"};', + 'static const char* const PROGRAMS[] = {"edenprobe", "edenprobe"};', + ), + ( + "a name that only begins like the program's opens a run", + 'probe.c', + "if (!strncmp(t, PROGRAMS[i], strlen(PROGRAMS[i])) && t[strlen(PROGRAMS[i])] == ' ') return i;", + 'if (!strncmp(t, PROGRAMS[i], strlen(PROGRAMS[i]))) return i;', + ), + ( + "libc's cases keep their detail, which can name the machine and its network", + 'probe.c', + ' && f != PROBE_LIBC && f != PROBE_OTHER;', + ' && f != PROBE_OTHER;', + ), + ( + "a worker's answer names any program", + 'probe.c', + ' if (program_named(jstr(o, "program")) < 0) {', + ' if (0 && program_named(jstr(o, "program")) < 0) {', + ), +) + # what only the whole suite holds: the worker, a process of its own shut in its folder (test_worker) WORKER = ( ( @@ -280,6 +309,7 @@ GROUPS = ( (tuple((what, 'rules.c', old, new) for what, old, new in RULES), ['--rules']), (FILES, ['--files']), + (PROBE, ['--probe']), (WORKER, []), ) diff --git a/tracer/src/main.c b/tracer/src/main.c index 50f58e5..e618880 100644 --- a/tracer/src/main.c +++ b/tracer/src/main.c @@ -44,6 +44,7 @@ sends the text and the attachments of a message that mentions it */ static struct { const char *token, *url, *db, *site, *assets, *titles; + double min_free; /* bytes */ u64 channels[LISTED], admins[LISTED]; int nchannels, nadmins; } env; @@ -104,7 +105,7 @@ static void read_env(void) { known |= !strncmp(*e, KNOWN[k], strlen(KNOWN[k])) && (*e)[strlen(KNOWN[k])] == '='; if (!known) stop("%s: no such setting (TRACER_TOKEN, _URL, _CHANNELS, _ADMINS, _DB, _SITE, _ASSETS, _TITLES, " - "_ISSUES_REPO, _ISSUES_TOKEN, _ISSUES_EMOJI, _ISSUES_LABELS, _UPSTREAM_REPO)", + "_ISSUES_REPO, _ISSUES_TOKEN, _ISSUES_EMOJI, _ISSUES_LABELS, _UPSTREAM_REPO, _MIN_FREE)", *e); } env.token = setting("TRACER_TOKEN", NULL); @@ -122,6 +123,14 @@ static void read_env(void) { stop("%s", why); } env.nadmins = ids("TRACER_ADMINS", env.admins); + { /* the MiB the site's file system keeps free */ + const char* v = setting("TRACER_MIN_FREE", NULL); + char* end_of; + long mib = v ? strtol(v, &end_of, 10) : TR_MIN_FREE; + if (v && (*end_of || !isdigit((unsigned char)*v) || mib < 0 || mib > 1048576)) + stop("TRACER_MIN_FREE=%s is not a whole number of MiB from 0 (no floor) to 1048576", v); + env.min_free = (double)mib * 1048576; + } n = strlen(env.url); while (n && env.url[n - 1] == '/') --n; env.url = rei_format("%.*s", (int)n, env.url); @@ -425,6 +434,22 @@ int main(int argc, char** argv) { tracer.age = &age; tracer.message = message_got; tracer.content_intent = content_intent; + tracer.min_free = env.min_free; + { /* the disk the reports land on, said once */ + char* why; + double now = tr_free_bytes(env.site, &why); + if (!env.min_free) + rei_log("disk: TRACER_MIN_FREE=0 keeps none of the site's file system free, so a report may fill it"); + else if (now < 0) + rei_log("disk: the free space of the site's file system could not be read (%s): each report is refused " + "until it can", + why); + else + rei_log("disk: the site's file system has %.0f MiB free; a report that would leave less than %.0f MiB " + "(TRACER_MIN_FREE) is refused%s", + now / 1048576, env.min_free / 1048576, now < env.min_free ? ", as every one is now" : ""); + free(why); + } { /* what a reply alone to a message with a log gets, said once at the start; asked again at each such reply */ char* why; int sees = content_intent(NULL, &why); diff --git a/tracer/src/mcp.c b/tracer/src/mcp.c index 467e6ab..207c51c 100644 --- a/tracer/src/mcp.c +++ b/tracer/src/mcp.c @@ -18,7 +18,8 @@ static const char INSTRUCTIONS[] = "search_reports find reports; signatures groups the failures that happened in the same place, across games; " "get_report gives a report's facts and each log's summary (how the run ended and where, its frames, the service " "commands and what else the runtime missed, the last lines); read_log reads or searches the log itself; " - "get_screenshot shows a report's screenshot. Runs of edenprobe (its cases on each emulator, driver and system) are " + "get_screenshot shows a report's screenshot. Runs of Amberlith (edenprobe before its 1.0.0; its cases on each " + "emulator, driver and system) are " "reports of their own: probe_matrix lists the cases by machine, probe_case gives a case's results and failures, " "ban_candidates what the runs say together (drivers to ban, ScarletNX's own failures, regressions). " "Home folders in the logs are ~, and so are the folders of a path outside them (its file's name stays). A Switch " @@ -78,14 +79,14 @@ static const char TOOLS[] = /* the tools of the runs of edenprobe, apart: each string of the list stays within C99's 4095 bytes */ static const char PROBE_TOOLS[] = - "[{\"name\":\"probe_matrix\",\"title\":\"The runs of edenprobe by machine\",\"description\":\"edenprobe's " + "[{\"name\":\"probe_matrix\",\"title\":\"The runs of Amberlith by machine\",\"description\":\"Amberlith's " "cases by machine (an emulator, a driver and its version, a system), from the runs sent to Tracer: the machines, " "and each case's results on each of them as [pass, fail, skip, crashed], in the machines' order. Every version and " - "mode of edenprobe counted together.\",\"inputSchema\":{\"type\":\"object\",\"properties\":{" + "mode of Amberlith (and of edenprobe, its name before 1.0.0) counted together.\",\"inputSchema\":{\"type\":\"object\",\"properties\":{" "\"query\":{\"type\":\"string\",\"description\":\"words the case's suite or name holds, in any case\"}," "\"suite\":{\"type\":\"string\",\"description\":\"one suite: astc, tex8k, nifm...\"}," - "\"family\":{\"type\":\"string\",\"description\":\"one family: judge, cpu, graphics, fs, kernel, display, " - "video, audio, service, net, pad, game\"}," + "\"family\":{\"type\":\"string\",\"description\":\"one family: judge, cpu, graphics, nvn, fs, kernel, " + "display, video, audio, service, net, pad, game, libc, demo, music, pace\"}," "\"driver\":{\"type\":\"string\",\"description\":\"only the machines of this driver, by the ban table's name: " "radv, nvidia, qualcomm, turnip, mali...\"}," "\"emulator\":{\"type\":\"string\",\"description\":\"only this emulator's machines: ScarletNX, Eden, rEden, " @@ -94,14 +95,14 @@ static const char PROBE_TOOLS[] = "true when not given\"}," "\"limit\":{\"type\":\"integer\",\"minimum\":1,\"maximum\":1000,\"description\":\"100 when not given\"}}}," "\"annotations\":{\"readOnlyHint\":true,\"openWorldHint\":false}}," - "{\"name\":\"probe_case\",\"title\":\"A case of edenprobe\",\"description\":\"One case of edenprobe: its " + "{\"name\":\"probe_case\",\"title\":\"A case of Amberlith\",\"description\":\"One case of Amberlith: its " "results on each machine, the rules' word on it, and its newest failures and skips, each with its report, machine " "and detail. Given its key (16 hex digits, as probe_matrix names it), or words of its suite and name: words that " "find several cases list them.\",\"inputSchema\":{\"type\":\"object\",\"properties\":{" "\"case\":{\"type\":\"string\",\"description\":\"the case's key\"}," "\"query\":{\"type\":\"string\",\"description\":\"words its suite or name holds, in any case\"}}}," "\"annotations\":{\"readOnlyHint\":true,\"openWorldHint\":false}}," - "{\"name\":\"ban_candidates\",\"title\":\"What the runs of edenprobe say\",\"description\":\"By fixed " + "{\"name\":\"ban_candidates\",\"title\":\"What the runs of Amberlith say\",\"description\":\"By fixed " "rules over the runs: ban candidates (a case that fails on one driver's range of versions for several people and " "passes on other drivers), each with its draft line for ScarletNX's ban table, its key left for a person; " "ScarletNX's own failures (a case failing on most drivers); and regressions (a case a build broke on a driver). " diff --git a/tracer/src/probe.c b/tracer/src/probe.c index 636fd65..ea6d0bc 100644 --- a/tracer/src/probe.c +++ b/tracer/src/probe.c @@ -10,9 +10,10 @@ #include "files.h" -/* ---- edenprobe's families ---- */ +/* ---- Amberlith's families ---- */ -/* which family each suite is of, by the name its lines carry: edenprobe's ui.c, FAMILIES (edenprobe 86e1d11) */ +/* which family each suite is of, by the name its lines carry: Amberlith's ui.c, FAMILIES (Amberlith 1.0.0, 3c94c33), + which has every suite edenprobe's had */ static const struct { const char* suite; ProbeFamily family; @@ -30,11 +31,20 @@ static const struct { {"blend", PROBE_GRAPHICS}, {"depth", PROBE_GRAPHICS}, {"fixed", PROBE_GRAPHICS}, + {"stencil", PROBE_GRAPHICS}, + {"lod", PROBE_GRAPHICS}, + {"sampling", PROBE_GRAPHICS}, + {"coverage", PROBE_GRAPHICS}, + {"msaa", PROBE_GRAPHICS}, {"texture", PROBE_GRAPHICS}, {"coherence", PROBE_GRAPHICS}, {"fmath", PROBE_GRAPHICS}, {"order", PROBE_GRAPHICS}, + {"queue", PROBE_GRAPHICS}, + {"storage", PROBE_GRAPHICS}, {"index", PROBE_GRAPHICS}, + {"topology", PROBE_GRAPHICS}, + {"vertex", PROBE_GRAPHICS}, {"instance", PROBE_GRAPHICS}, {"bindless", PROBE_GRAPHICS}, {"astc", PROBE_GRAPHICS}, @@ -42,6 +52,7 @@ static const struct { {"eac", PROBE_GRAPHICS}, {"etc2", PROBE_GRAPHICS}, {"bcn", PROBE_GRAPHICS}, + {"bcnimage", PROBE_GRAPHICS}, {"zeta", PROBE_GRAPHICS}, {"swizzle", PROBE_GRAPHICS}, {"texel", PROBE_GRAPHICS}, @@ -51,12 +62,21 @@ static const struct { {"occlusion", PROBE_GRAPHICS}, {"drawtex", PROBE_GRAPHICS}, {"geometry", PROBE_GRAPHICS}, + {"xfb", PROBE_GRAPHICS}, {"query", PROBE_GRAPHICS}, {"dma", PROBE_GRAPHICS}, {"blit2d", PROBE_GRAPHICS}, + {"copy", PROBE_GRAPHICS}, {"tex8k", PROBE_GRAPHICS}, {"fs", PROBE_FS}, {"sched", PROBE_KERNEL}, + {"svc", PROBE_KERNEL}, + {"pace-cpu", PROBE_PACE}, + {"pace-mem", PROBE_PACE}, + {"pace-thread", PROBE_PACE}, + {"pace-timer", PROBE_PACE}, + {"pace-fs", PROBE_PACE}, + {"pace-gpu", PROBE_PACE}, {"binder", PROBE_DISPLAY}, {"vic", PROBE_VIDEO}, {"nvdec", PROBE_VIDEO}, @@ -96,15 +116,28 @@ static const struct { {"time-zone", PROBE_SERVICE}, {"time-perm", PROBE_SERVICE}, {"audout", PROBE_SERVICE}, + {"audin", PROBE_SERVICE}, + {"pctl", PROBE_SERVICE}, {"fs-file", PROBE_SERVICE}, {"acc-app", PROBE_SERVICE}, + {"sdk", PROBE_SERVICE}, {"nifm", PROBE_NET}, {"dns", PROBE_NET}, {"bsd", PROBE_NET}, {"ssl", PROBE_NET}, {"acc", PROBE_NET}, {"friend", PROBE_NET}, + {"libc", PROBE_LIBC}, + {"system", PROBE_LIBC}, + {"socket", PROBE_LIBC}, {"game", PROBE_GAME}, + {"wimsy", PROBE_GAME}, + {"mandelbrot", PROBE_DEMO}, + {"julia", PROBE_DEMO}, + {"fluid", PROBE_DEMO}, + {"fluid-alias", PROBE_DEMO}, + {"music", PROBE_MUSIC}, + {"nvn", PROBE_NVN}, }; ProbeFamily probe_family(const char* suite) { @@ -115,14 +148,15 @@ ProbeFamily probe_family(const char* suite) { } const char* probe_family_name(ProbeFamily f) { - static const char* const names[] = {"judge", "cpu", "pad", "graphics", "fs", "kernel", "display", - "video", "audio", "service", "net", "game", "other"}; + static const char* const names[] = {"judge", "cpu", "pad", "graphics", "fs", "kernel", + "display", "video", "audio", "service", "net", "game", + "nvn", "libc", "demo", "music", "pace", "other"}; return f >= PROBE_JUDGE && f <= PROBE_OTHER ? names[f] : "other"; } int probe_keeps_detail(const char* suite) { ProbeFamily f = probe_family(suite); - return f != PROBE_SERVICE && f != PROBE_NET && f != PROBE_PAD && f != PROBE_OTHER; + return f != PROBE_SERVICE && f != PROBE_NET && f != PROBE_PAD && f != PROBE_LIBC && f != PROBE_OTHER; } /* ---- the drivers: ScarletNX's ban table's names and numbering (src/nx/gpu/vk/extension_bans.c, #1390) ---- */ @@ -317,17 +351,42 @@ static cJSON* report_line(const char* s, size_t n) { return o; } -/* the note that begins a run: "edenprobe 0.9.0 (v0.9.0) starting", its version and describe owned when wanted */ -static int starting(const cJSON* o, char** version, char** describe) { - const char *t = jstr(o, "text"), *open, *close; +/* the names a run's starting note opens with: the program's since its 1.0.0, and the one before */ +static const char* const PROGRAMS[] = {"Amberlith", "edenprobe"}; + +/* the program whose name t opens with, then a space: its index in PROGRAMS, or -1 */ +static int program_at(const char* t) { + int i; + for (i = 0; t && i < (int)(sizeof PROGRAMS / sizeof *PROGRAMS); ++i) + if (!strncmp(t, PROGRAMS[i], strlen(PROGRAMS[i])) && t[strlen(PROGRAMS[i])] == ' ') return i; + return -1; +} + +/* name's index in PROGRAMS, or -1 */ +static int program_named(const char* name) { + int i; + for (i = 0; name && i < (int)(sizeof PROGRAMS / sizeof *PROGRAMS); ++i) + if (!strcmp(name, PROGRAMS[i])) return i; + return -1; +} + +const char* probe_program(const Probe* p) { return p && p->program ? p->program : "edenprobe"; } + +/* the note that begins a run: "Amberlith 1.0.0 (v1.0.0) starting", or "edenprobe 0.9.0 (v0.9.0) starting" of the + versions before; its program, version and describe owned when wanted */ +static int starting(const cJSON* o, char** program, char** version, char** describe) { + const char *t = jstr(o, "text"), *open, *close, *at; size_t n; - if (!t || strcmp(jstr(o, "type"), "note") || strncmp(t, "edenprobe ", 10)) return 0; + int which = t && !strcmp(jstr(o, "type"), "note") ? program_at(t) : -1; + if (which < 0) return 0; + at = t + strlen(PROGRAMS[which]) + 1; n = strlen(t); - if (n < 21 || strcmp(t + n - 10, ") starting")) return 0; - open = strstr(t + 10, " ("); + if (n < (size_t)(at - t) + 11 || strcmp(t + n - 10, ") starting")) return 0; + open = strstr(at, " ("); close = t + n - 10; - if (!open || open > close || open == t + 10) return 0; - if (version) *version = rei_format("%.*s", (int)(open - (t + 10)), t + 10); + if (!open || open > close || open == at) return 0; + if (program) *program = rei_strdup(PROGRAMS[which]); + if (version) *version = rei_format("%.*s", (int)(open - at), at); if (describe) *describe = rei_format("%.*s", (int)(close - (open + 2)), open + 2); return 1; } @@ -380,9 +439,9 @@ int probe_marks(const char* text, size_t n) { if (j >= 0 && len - (size_t)j > 30) { const char* s = text + at + j; size_t k = len - (size_t)j; - if (k > 35 && !memcmp(s, "{\"type\":\"note\",\"text\":\"edenprobe ", 33)) { + if (k > 35 && !memcmp(s, "{\"type\":\"note\",\"text\":\"", 23) && program_at(s + 23) >= 0) { cJSON* o = report_line(s, k); - if (o && starting(o, NULL, NULL)) marks = 1; + if (o && starting(o, NULL, NULL, NULL)) marks = 1; cJSON_Delete(o); } else if (marks && !memcmp(s, "{\"type\":\"summary\"", 17)) marks = 2; @@ -399,6 +458,7 @@ void probe_free(Probe* p) { free(p->emulator); free(p->emulator_version); free(p->commit); + free(p->program); free(p->version); free(p->describe); free(p->words); @@ -649,7 +709,7 @@ int probe_parse(const char* text, size_t n, Probe* p, char** why) { if (o) { const char* type = jstr(o, "type"); ++lines; - if (starting(o, NULL, NULL)) { + if (starting(o, NULL, NULL, NULL)) { if (open_run && (open_whole || !chosen_whole)) { run_start = start; run_end = at; @@ -678,7 +738,7 @@ int probe_parse(const char* text, size_t n, Probe* p, char** why) { } if (!runs) { if (lines && resumed) { - *why = rei_strdup("its edenprobe lines are a launch that went on with a run after a crash (its first note " + *why = rei_strdup("its Amberlith lines are a launch that went on with a run after a crash (its first note " "says \"journal: launch\"), without the run's start: send the run's report.jsonl, or the " "log of the run's first launch"); return -1; @@ -715,7 +775,7 @@ int probe_parse(const char* text, size_t n, Probe* p, char** why) { cJSON* o = j >= 0 ? report_line(text + at + j, len - (size_t)j) : NULL; const char* type = o ? jstr(o, "type") : NULL; if (!o) continue; - if (starting(o, &p->version, &p->describe)) + if (starting(o, &p->program, &p->version, &p->describe)) ; else if (!strcmp(type, "case")) { if (add_case(p, o, &cap)) ++p->unread; @@ -746,6 +806,7 @@ cJSON* probe_json(const Probe* p) { jset(o, "emulator_version", p->emulator_version); jset(o, "commit", p->commit); put_number(o, "built", p->built); + jset(o, "program", probe_program(p)); jset(o, "version", p->version); jset(o, "describe", p->describe); jset(o, "words", p->words); @@ -812,10 +873,16 @@ int probe_of_json(const cJSON* o, Probe* p, char** why) { } if (!jstr(o, "version") || !*jstr(o, "version") || strlen(jstr(o, "version")) > 40 || !jstr(o, "words") || !cJSON_IsArray(list) || id < 0 || id >= DRIVERS || version < 0 || version > 4294967295.0) { - *why = rei_strdup("its probe has no edenprobe version, mode or cases, or a driver that is none"); + *why = rei_strdup("its probe has no version, mode or cases, or a driver that is none"); + return -1; + } + if (program_named(jstr(o, "program")) < 0) { + *why = + rei_format("its probe names no program it may (%.40s)", jstr(o, "program") ? jstr(o, "program") : "none"); return -1; } p->emulator = rei_strdup(emulator); + p->program = rei_strdup(PROGRAMS[program_named(jstr(o, "program"))]); p->emulator_version = field(o, "emulator_version", 200); p->commit = field(o, "commit", 64); p->built = jnum(o, "built") > 0 ? jnum(o, "built") : 0; @@ -849,7 +916,7 @@ int probe_of_json(const cJSON* o, Probe* p, char** why) { p->over = (int)(count_of(o, "over") > 0 ? count_of(o, "over") : 0); cJSON_ArrayForEach(e, list) { if (add_case(p, e, &cap)) { - *why = rei_format("its probe's case %d is not one edenprobe writes", p->ncases + 1); + *why = rei_format("its probe's case %d is not one Amberlith writes", p->ncases + 1); probe_free(p); return -1; } diff --git a/tracer/src/probe.h b/tracer/src/probe.h index 68edb4b..4d72919 100644 --- a/tracer/src/probe.h +++ b/tracer/src/probe.h @@ -1,14 +1,15 @@ /* SPDX-License-Identifier: GPL-3.0-or-later Copyright 2026 the ScarletNX contributors */ -/* A run of edenprobe (github.com/scarletnx/edenprobe, the probe program that checks an emulator against the console) - found in a file a report brought, in any of the three forms one comes in: +/* A run of Amberlith (github.com/scarletnx/amberlith, the probe program that checks an emulator against the console, + named edenprobe before its 1.0.0) found in a file a report brought, in any of the three forms one comes in: - ScarletNX's log of the run: the machine in its header lines, each line of the report as "[game] {...}"; - Eden's log (rEden's too): the machine in its "Driver:", "Device:", "Host OS:" lines, each line of the report as "Debug.Emulated ...: {...}" (the debug string service, svc_debug_string.cpp); - the report itself, report.jsonl, a JSON object a line, which names no machine: the console's reference. - A run begins at its note "edenprobe 0.9.0 (v0.9.0) starting" and ends at its summary. What is read of it: the - machine (system, GPU, the driver's VkDriverId, name and version), the emulator and its build, edenprobe's version and - mode, and each case's suite, name, tier, result, reason and detail. + A run begins at its note "Amberlith 1.0.0 (v1.0.0) starting" (an older one's, "edenprobe 0.9.0 (v0.9.0) starting") + and ends at its summary. What is read of it: the machine (system, GPU, the driver's VkDriverId, name and version), + the emulator and its build, the program's name, version and mode, and each case's suite, name, tier, result, reason + and detail. The detail of the cases of edenprobe's service, net and pad families, and the net family's notes, can name the player (an account's id and nickname, a network's addresses, a session); probe_cut leaves them out of the text before it is kept or read. The driver's names and version numbering are ScarletNX's ban table's (extension_bans.c) */ @@ -20,7 +21,7 @@ #define PROBE_DETAIL 300 /* the bytes of a case's detail kept */ #define PROBE_KEY "probe" /* the reports' key (store.h's game) of a report that is a run of edenprobe */ -/* edenprobe's families, as its ui.c groups the suites (FAMILIES, edenprobe 86e1d11) */ +/* Amberlith's families, as its ui.c groups the suites (FAMILIES, Amberlith 1.0.0) */ typedef enum { PROBE_JUDGE, PROBE_CPU, @@ -34,14 +35,20 @@ typedef enum { PROBE_SERVICE, PROBE_NET, PROBE_GAME, + PROBE_NVN, + PROBE_LIBC, + PROBE_DEMO, + PROBE_MUSIC, + PROBE_PACE, PROBE_OTHER } ProbeFamily; ProbeFamily probe_family(const char* suite); /* the family's name: "judge", "graphics", ... "other" */ const char* probe_family_name(ProbeFamily f); /* whether a case of suite keeps its detail: the families whose cases name nothing of the player (the judge, cpu, - graphics, fs, kernel, display, video, audio, game). service, net and pad lose it, and so does a suite edenprobe's - table does not have, as nothing says what it holds */ + graphics, nvn, fs, kernel, display, video, audio, game, demo, music, pace). service, net, pad and libc (its system + and socket suites can name the machine and its network) lose it, and so does a suite Amberlith's table does not + have, as nothing says what it holds */ int probe_keeps_detail(const char* suite); /* the ban table's name of a VkDriverId ("radv", "nvidia"), NULL for one it has none for; its label ("RADV", "NVIDIA's @@ -81,7 +88,8 @@ typedef struct { char* emulator_version; /* its build: "main 3e7ffeb", "Eden Development Build | master-abc"; NULL for none */ char* commit; /* ScarletNX's commit, NULL for none */ double built; /* the day that commit was made (UTC, seconds since the epoch), 0 for none */ - char *version, *describe; /* edenprobe's: "0.9.0", "v0.9.0" */ + char* program; /* the name its starting note gives: "Amberlith", or "edenprobe" before 1.0.0 */ + char *version, *describe; /* its version: "1.0.0", "v1.0.0" */ char* words; /* what ran, from its mode note: the families, then fatal, hang, notime, retry, stress, frames=N */ char* system; /* the machine's system line; NULL for none */ char* os; /* probe_os's */ @@ -104,6 +112,9 @@ typedef struct { int ncases; } Probe; +/* p's program as its starting note names it, "edenprobe" for a run kept before the name was */ +const char* probe_program(const Probe* p); + /* the last whole run in the n bytes of text (else the last run begun), as probe_cut left it, into *p, with the machine its log names before the run begins (the last of each line). 1 for a run, 0 for none, -1 for report lines with no run's start in front of them (a launch that went on with a run after a crash, which says so in its first diff --git a/tracer/src/report.c b/tracer/src/report.c index 6031396..4929515 100644 --- a/tracer/src/report.c +++ b/tracer/src/report.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include "common/utilities/demangle.h" @@ -237,9 +238,10 @@ static cJSON* help(void) { "Mention me with a ScarletNX log attached (.log, .txt, .gz or .zip), and screenshots if you have " "them, attached or in the .zip. I keep them as a report on the site, grouped by game. The log says which " "game it is: when it does not, write the game's name in the message.\n\n" - "A run of edenprobe is a report of its own, apart from the games: ScarletNX's log of the run (alone, or in " - "the Share Log zip), Eden's log of it, or its report.jsonl (the console's, as it names no machine). The " - "detail of its service, net and pad cases is left out, as it can name you.\n\n" + "A run of Amberlith (edenprobe before its 1.0.0) is a report of its own, apart from the games: " + "ScarletNX's log of the run (alone, or in the Share Log zip), Eden's log of it, or its report.jsonl (the " + "console's, as it names no machine). The detail of its service, net, pad and libc cases is left out, as it " + "can name you.\n\n" "Home folders in a log are shown as ~, and so are the folders of a path outside them (a disk's, a " "drive's): its file's name stays. Screenshots lose their metadata. The site does not show who sent a " "report.\n\n" @@ -487,7 +489,7 @@ static void take_log(Taken* k, int dirfd, const TrAttachment* a, Buf* got) { parsed = summary ? cJSON_Parse(summary) : NULL; run = probe_parse(shown, n, &probe, &why); if (!is_log(parsed) && run != 1) { - skip(k, a->name, run < 0 ? why : "not a ScarletNX log, nor a run of edenprobe"); + skip(k, a->name, run < 0 ? why : "not a ScarletNX log, nor a run of Amberlith"); free(why); cJSON_Delete(parsed); free(summary); @@ -740,7 +742,7 @@ static cJSON* made(Tracer* t, const StReport* r, const Taken* k) { } if (k->probe_why) { /* lines of edenprobe that are no whole run: kept as a log, not on the Probe pages */ char* why = plain(k->probe_why, 1000); - add_field(e, "Not a run of edenprobe", why); + add_field(e, "Not a run of Amberlith", why); free(why); } { @@ -797,6 +799,50 @@ static cJSON* limited(Tracer* t, const TrMessage* m) { return e; } +double tr_free_bytes(const char* path, char** why) { + struct statvfs v; + *why = NULL; + if (statvfs(path, &v)) { + *why = rei_format("statvfs %s: %s", path, strerror(errno)); + return -1; + } + return (double)v.f_bavail * (double)v.f_frsize; +} + +/* the answer when m's files (their sizes as Discord gives them) would leave the site's file system under + t->min_free, or NULL: said before anything is downloaded, so the site's disk, which the host's other services may + share, never fills */ +static cJSON* disk_full(Tracer* t, const TrMessage* m) { + double need = 0, now; + char *why = NULL, *text; + cJSON* e; + int i; + if (t->min_free <= 0 || !m->nfiles) return NULL; + for (i = 0; i < m->nfiles; ++i) need += m->files[i].size > 0 ? m->files[i].size : 0; + now = t->free_bytes ? t->free_bytes(t->root, &why) : tr_free_bytes(t->root, &why); + if (now < 0) { + rei_log("message %llu refused: the free space of the site's file system could not be read: %s", + (unsigned long long)m->id, why ? why : "no reason given"); + text = rei_format("Nothing was kept: the free space of the site's disk could not be read (%s). Tell an " + "administrator, please.", + why ? why : "no reason given"); + } else if (now - need >= t->min_free) { + free(why); + return NULL; + } else { + rei_log("message %llu refused: the site's file system has %.0f MiB free, its files are %.1f MiB, and " + "TRACER_MIN_FREE keeps %.0f MiB free", + (unsigned long long)m->id, now / 1048576, need / 1048576, t->min_free / 1048576); + text = rei_format("Nothing was kept: the site's disk has %.0f MiB free, and Tracer keeps %.0f MiB of it free; " + "these files (%.1f MiB) would go under that. Tell an administrator, please.", + now / 1048576, t->min_free / 1048576, need / 1048576); + } + free(why); + e = said(text); + free(text); + return e; +} + /* the files of k moved into report id's folder: 0, or -1 with those moved deleted */ static int written(Tracer* t, long id, Taken* k) { int i, failed = 0; @@ -817,11 +863,11 @@ static int written(Tracer* t, long id, Taken* k) { return failed ? -1 : 0; } -/* the answer for report r, the run of edenprobe k's first log holds: "edenprobe 0.9.0 on radv, Mesa 26.1.8 (Linux): +/* the answer for report r, the run of Amberlith k's first log holds: "Amberlith 1.0.0 on radv, Mesa 26.1.8 (Linux): 1034 passed, 26 failed (astc 15, ...), 6 skipped, 3 crashed", and what the run lacks or lost said under it */ static cJSON* probe_made(Tracer* t, const StReport* r, const Taken* k) { const Probe* p = &k->probe; - char *title = rei_format("Report #%ld: edenprobe %s on %s", r->id, p->version, p->emulator), + char *title = rei_format("Report #%ld: %s %s on %s", r->id, probe_program(p), p->version, p->emulator), *cut = plain(title, 250), *url = rei_format("%s/r/%ld/", t->url, r->id), *machine = probe_machine(p), *counts = probe_counts(p), *files; long lines = 0, failed = 0, crashed = 0; @@ -833,7 +879,7 @@ static cJSON* probe_made(Tracer* t, const StReport* r, const Taken* k) { crashed += !strcmp(p->cases[i].reason, "crashed"); } lines = p->ncases + p->over; - buf_printf(&text, "edenprobe %s on %s: %s", p->version, machine, counts); + buf_printf(&text, "%s %s on %s: %s", probe_program(p), p->version, machine, counts); if (!p->whole) buf_printf(&text, "\nNo summary line: the run stopped before its end, after %ld case lines.", lines); else if (p->passed + p->failed + p->skipped + p->crashed != lines) @@ -843,7 +889,8 @@ static cJSON* probe_made(Tracer* t, const StReport* r, const Taken* k) { p->passed + p->failed + p->skipped + p->crashed, lines); if (p->over) buf_printf(&text, "\n%d case lines past the first %d were not kept.", p->over, PROBE_CASES); if (p->unread) - buf_printf(&text, "\n%d of its lines were none that edenprobe writes, and were not read.", p->unread); + buf_printf(&text, "\n%d of its lines were none that %s writes, and were not read.", p->unread, + probe_program(p)); if (!strcmp(p->emulator, "console") && !p->driver_name) buf_add(&text, "\nA report.jsonl names no machine: it is kept as the console's reference. If an emulator ran " "it, send that emulator's log instead."); @@ -864,9 +911,9 @@ static cJSON* probe_made(Tracer* t, const StReport* r, const Taken* k) { files = kept(k, ""); add_field(e, "Kept", files); if (p->cut_cases || p->cut_notes) { - char* left = rei_format("the detail of %d %s of the service, net and pad families (or of no family edenprobe " + char* left = rei_format("the detail of %d %s of the service, net, pad and libc families (or of no family %s " "names) and %d net %s, which can name the player", - p->cut_cases, p->cut_cases == 1 ? "case" : "cases", p->cut_notes, + p->cut_cases, p->cut_cases == 1 ? "case" : "cases", probe_program(p), p->cut_notes, p->cut_notes == 1 ? "note" : "notes"); add_field(e, "Left out", left); free(left); @@ -904,9 +951,8 @@ static cJSON* probed(Tracer* t, const TrMessage* m, Taken* k, const char* note, probe_digest(p, digest); if ((seen = st_probe_seen(t->store, m->author, digest))) { char* url = rei_format("%s/r/%ld/", t->url, seen); - text = rei_format("This run of edenprobe is report #%ld already: its lines are the same, so nothing was kept " - "again.", - seen); + text = rei_format("This run of %s is report #%ld already: its lines are the same, so nothing was kept again.", + probe_program(p), seen); e = said(text); jset(e, "url", url); free(url); @@ -916,7 +962,7 @@ static cJSON* probed(Tracer* t, const TrMessage* m, Taken* k, const char* note, } memset(&r, 0, sizeof r); r.key = rei_strdup(PROBE_KEY); - r.title = rei_format("edenprobe %s on %s", p->version, p->emulator); + r.title = rei_format("%s %s on %s", probe_program(p), p->version, p->emulator); r.named = 1; r.when = rei_now(); r.guild = m->guild; @@ -952,7 +998,7 @@ static cJSON* probed(Tracer* t, const TrMessage* m, Taken* k, const char* note, return said("The report could not be kept: try again later, please."); } site_update(t->store, t->root, r.id, r.key); - rei_log("report #%ld: a run of edenprobe %s on %s, %d cases", r.id, p->version, p->emulator, p->ncases); + rei_log("report #%ld: a run of %s %s on %s, %d cases", r.id, probe_program(p), p->version, p->emulator, p->ncases); e = probe_made(t, &r, k); *report = r.id; st_report_free(&r); @@ -968,6 +1014,7 @@ static cJSON* reported(Tracer* t, const TrMessage* asker, const TrMessage* m, co cJSON* e; char* text; if (st_by_message(t->store, m->id)) return NULL; /* the gateway's event again, after a resume */ + if ((e = disk_full(t, m))) return e; if (m->nfiles && (e = limited(t, asker))) return e; memset(&k, 0, sizeof k); if (fetched(t, m, &k)) return unread(&k); @@ -1096,7 +1143,7 @@ static cJSON* updated(Tracer* t, const TrMessage* m, long id, const char* note, st_report_free(&r); return said("Nothing to add: attach logs or screenshots, or write a note."); } - if ((e = limited(t, m))) { + if ((e = disk_full(t, m)) || (e = limited(t, m))) { st_report_free(&r); return e; } @@ -1393,9 +1440,10 @@ int tr_rescan(Tracer* t, const char* version) { if ((has_run = probe_parse(shown, shown_len, &run, &why) == 1)) { probe_digest(&run, digest); if (!st_probe_set(t->store, r->id, &run, digest) && strcmp(r->key, PROBE_KEY)) { - char* title = rei_format("edenprobe %s on %s", run.version, run.emulator); + char* title = rei_format("%s %s on %s", probe_program(&run), run.version, run.emulator); if (!st_set_game(t->store, r->id, PROBE_KEY, title, NULL, 1)) { - rei_log("report #%ld is a run of edenprobe, not a report of %s", r->id, r->key); + rei_log("report #%ld is a run of %s, not a report of %s", r->id, probe_program(&run), + r->key); site_update(t->store, t->root, 0, r->key); free(r->key); r->key = rei_strdup(PROBE_KEY); diff --git a/tracer/src/report.h b/tracer/src/report.h index 0a4f0be..108d8e8 100644 --- a/tracer/src/report.h +++ b/tracer/src/report.h @@ -56,8 +56,17 @@ struct Tracer { 0, or -1 with why (owned) when Discord did not say */ int (*content_intent)(void* ctx, char** why); void* discord_ctx; + /* the bytes the site's file system keeps free: a report or an update whose files would go under it is refused + before anything is downloaded; 0 for no floor */ + double min_free; + /* the bytes free on the file system of path (statvfs's for an unprivileged user), -1 with why (owned) when it + cannot be read; NULL for tr_free_bytes */ + double (*free_bytes)(const char* path, char** why); }; +/* the bytes free on the file system of path for an unprivileged user (statvfs), or -1 with why (owned) */ +double tr_free_bytes(const char* path, char** why); + /* m's attachments downloaded through t's get and read: the logs unpacked (a .zip's screenshots taken beside its log), their home folders and the folders of paths outside them as ~, their dumps and addresses left out and summarized, the screenshots' metadata taken out; each kept one written into k->dir, each other named in k->skipped */ diff --git a/tracer/src/rules.c b/tracer/src/rules.c index ff5e266..f730a91 100644 --- a/tracer/src/rules.c +++ b/tracer/src/rules.c @@ -102,6 +102,7 @@ static int general(Rules* r, int* cap, int name, const Entry* e, int n) { g = &r->general[r->ngeneral++]; memset(g, 0, sizeof *g); g->name = name; + g->program = probe_program(&g_rules[e[0].run].p); g->version = g_rules[e[0].run].p.version; g->words = g_rules[e[0].run].p.words; g->seen = nd; @@ -275,6 +276,7 @@ static void candidates_on(Rules* r, int* cap, int name, const Entry* e, int n, i c = &r->candidates[r->ncandidates++]; memset(c, 0, sizeof *c); c->name = name; + c->program = probe_program(&g_rules[e[0].run].p); c->version = g_rules[e[0].run].p.version; c->words = g_rules[e[0].run].p.words; c->driver_id = d; @@ -401,6 +403,7 @@ static void regressions(Rules* r, int* cap, int name, const Entry* e, int n) { g = &r->regressions[r->nregressions++]; memset(g, 0, sizeof *g); g->name = name; + g->program = probe_program(p); g->version = p->version; g->words = p->words; g->driver_id = p->driver_id; @@ -511,7 +514,9 @@ char* rules_draft(const RuleCandidate* c, const char* suite, const char* name) { table_text(&b, name); buf_add(&b, "\" | Tracer"); for (i = 0; i < c->nfailing; ++i) buf_printf(&b, "%s #%ld", i ? "," : "", c->failing[i]); - buf_add(&b, "; edenprobe "); + buf_add(&b, "; "); + table_text(&b, c->program); + buf_add(&b, " "); table_text(&b, c->version); buf_add(&b, " \""); table_text(&b, name); diff --git a/tracer/src/rules.h b/tracer/src/rules.h index 4487616..f928c51 100644 --- a/tracer/src/rules.h +++ b/tracer/src/rules.h @@ -34,8 +34,9 @@ #define RULE_GENERAL_DRIVERS 3 typedef struct { - int name; /* the case, StProbeName's id */ - const char *version, *words; /* edenprobe's version and the words that ran, the runs' */ + int name; /* the case, StProbeName's id */ + const char *program, *version, *words; /* the program (Amberlith, edenprobe), its version and the words that ran, + the runs' */ int driver_id; const char* os; /* the system's family, the runs' */ unsigned long low, high; /* the range: from low, up to high, which it leaves out; high 0 for no end */ @@ -53,7 +54,7 @@ typedef struct { typedef struct { int name; - const char *version, *words; + const char *program, *version, *words; int* drivers; /* owned: the drivers it fails on */ int ndrivers, seen; long* reports; /* owned: ScarletNX's reports that fail it, the oldest first */ @@ -63,7 +64,7 @@ typedef struct { typedef struct { int name; - const char *version, *words; + const char *program, *version, *words; int driver_id; unsigned long driver_version; const char* os; diff --git a/tracer/src/site.c b/tracer/src/site.c index 029b0a7..27753e2 100644 --- a/tracer/src/site.c +++ b/tracer/src/site.c @@ -471,10 +471,13 @@ static void probe_section(Buf* b, const Probe* p) { char* counts = probe_counts(p); char key[17]; int i, k; - buf_add(b, "
\n

edenprobe "); + buf_add(b, "
\n

"); + esc(b, probe_program(p)); + buf_add(b, " "); esc(b, counts); - buf_add(b, "

\n
\n"); - buf_add(b, "
edenprobe
"); + buf_add(b, "

\n
\n
"); + esc(b, probe_program(p)); + buf_add(b, "
"); esc(b, p->version); if (p->describe) { buf_add(b, " ("); @@ -510,15 +513,15 @@ static void probe_section(Buf* b, const Probe* p) { field(b, "Optional extensions on", p->extensions); if (!p->whole) field(b, "Summary", "none: the run stopped before its end"); if (p->cut_cases || p->cut_notes) { - char* left = rei_format("the detail of %d %s of the service, net and pad families (or of no family edenprobe " + char* left = rei_format("the detail of %d %s of the service, net, pad and libc families (or of no family %s " "names) and %d net %s, which can name the player", - p->cut_cases, p->cut_cases == 1 ? "case" : "cases", p->cut_notes, + p->cut_cases, p->cut_cases == 1 ? "case" : "cases", probe_program(p), p->cut_notes, p->cut_notes == 1 ? "note" : "notes"); field(b, "Left out", left); free(left); } if (p->unread) { - char* odd = rei_format("%d lines that are none edenprobe writes", p->unread); + char* odd = rei_format("%d lines that are none %s writes", p->unread, probe_program(p)); field(b, "Not read", odd); free(odd); } @@ -584,7 +587,7 @@ char* site_report_html(const StReport* r, const StFile* files, int nfiles, const int i, images = 0, videos = 0; buf_printf(&title, "Report #%ld: %s", r->id, r->title); head(&b, "../../", title.text, - probe ? "A run of edenprobe sent to Tracer." : "A ScarletNX game report sent to Tracer."); + probe ? "A run of Amberlith sent to Tracer." : "A ScarletNX game report sent to Tracer."); buf_free(&title); if (probe) buf_add(&b, "
\n

Probe / "); @@ -1163,13 +1166,15 @@ static void run_counts(Buf* b, const Probe* p) { static void runs_table(Buf* b, const char* root, const Runs* r, const int* which, int n) { int i; buf_add(b, - "

\n" + "
ReportSentedenprobe
\n" "\n\n"); for (i = 0; i < n; ++i) { const StProbeRun* run = &r->runs[which ? which[i] : i]; buf_printf(b, "
ReportSentProgramWhat ranMachineCounts
#%ld", root, run->report, run->report); when(b, run->when); buf_add(b, ""); + esc(b, probe_program(&run->p)); + buf_add(b, " "); esc(b, run->p.version); buf_add(b, ""); esc(b, run->p.words); @@ -1214,12 +1219,13 @@ static int probe_index(const char* root, const Runs* r) { int i, m, failing = 0, done; char* suites_seen = NULL; for (i = 0; i < r->nnames; ++i) failing += fails_somewhere(r, i); - head(&b, "../", "Tracer: runs of edenprobe", - "Runs of edenprobe sent to Tracer: each case on each emulator and driver."); - buf_add(&b, "
\n

Runs of edenprobe

\n

Runs of edenprobe that players sent to Tracer on Discord: " - "which of its cases pass on each emulator, driver and system. Every version and mode of edenprobe is " - "counted together here; a case's page tells them apart. What the runs say together, by fixed rules: " + head(&b, "../", "Tracer: runs of Amberlith", + "Runs of Amberlith sent to Tracer: each case on each emulator and driver."); + buf_add(&b, "

\n

Runs of Amberlith

\n

Runs of Amberlith (edenprobe before its 1.0.0) that " + "players sent to Tracer on Discord: which of its cases pass on each emulator, driver and system. Every " + "version and mode is counted together here; a case's page tells them apart. What the runs say " + "together, by fixed rules: " "ban candidates, ScarletNX's own failures and regressions.

\n"); buf_printf(&b, "

%d %s on %d %s, %d %s, %d failing somewhere

\n" @@ -1228,7 +1234,7 @@ static int probe_index(const char* root, const Runs* r) { r->nnames, r->nnames == 1 ? "case" : "cases", failing); cJSON_AddNumberToObject(o, "runs", r->nruns); if (!r->nruns) { - buf_add(&b, "

No runs yet. Mention @Tracer with a log of a run of edenprobe " + buf_add(&b, "

No runs yet. Mention @Tracer with a log of a run of Amberlith " "attached to add one.

\n"); foot(&b); done = write_page(root, "probe/index.html", buf_take(&b)); @@ -1340,9 +1346,9 @@ static void rules_of_case(Buf* b, const Runs* r, int id) { if (r->rules.general[i].name == id) buf_printf(b, "%s
  • ScarletNX's own failure, on %d drivers " - "(edenprobe %s)
  • \n", + "(%s %s)\n", any++ ? "" : "

    What the runs say

    \n
      \n", i + 1, r->rules.general[i].ndrivers, - r->rules.general[i].version); + r->rules.general[i].program, r->rules.general[i].version); for (i = 0; i < r->rules.nregressions; ++i) if (r->rules.regressions[i].name == id) buf_printf(b, "%s
    • a regression on %s
    • \n", @@ -1362,7 +1368,7 @@ static int case_page(Store* s, const char* root, const Runs* r, int n) { cJSON *o = cJSON_CreateObject(), *machines = cJSON_AddArrayToObject(o, "machines"), *rows; st_probe_details(s, name->id, CASE_ROWS, &d, &nd); buf_printf(&title, "%s: %s", name->suite, name->name); - head(&b, "../../", title.text, "A case of edenprobe on each emulator and driver, from the runs sent to Tracer."); + head(&b, "../../", title.text, "A case of Amberlith on each emulator and driver, from the runs sent to Tracer."); buf_free(&title); buf_add(&b, "
      \n

      Probe

      \n

      "); esc(&b, name->name); @@ -1397,7 +1403,7 @@ static int case_page(Store* s, const char* root, const Runs* r, int n) { if (nd) { buf_printf(&b, "

      Failures and skips the newest %d at most

      \n
      \n" + "class=\"reports\">\n" "\n\n", CASE_ROWS); for (i = 0; i < nd; ++i) { @@ -1413,6 +1419,8 @@ static int case_page(Store* s, const char* root, const Runs* r, int n) { buf_printf(&b, ""); HAS(p, ""); rel = rei_format("a 4x4 block decodes
      ReportSentMachineedenprobe
      ReportSentMachineProgramResultDetail
      #%ld", x->report, x->report); when(&b, x->when); buf_printf(&b, "%s", label.text); + esc(&b, probe_program(&x->p)); + buf_add(&b, " "); esc(&b, x->p.version); buf_add(&b, " "); esc(&b, x->p.words); @@ -1427,6 +1435,7 @@ static int case_page(Store* s, const char* root, const Runs* r, int n) { cJSON_AddNumberToObject(e, "report", (double)x->report); jset(e, "machine", label.text); jset(e, "emulator", x->p.emulator); + jset(e, "program", probe_program(&x->p)); jset(e, "edenprobe", x->p.version); jset(e, "words", x->p.words); jset(e, "result", result_name(d[i].result)); @@ -1464,7 +1473,9 @@ static void candidate_block(Buf* b, const char* root, const Runs* r, int i) { buf_add(b, "
      Versions
      "); esc(b, c->versions); if (c->mixed) buf_add(b, " (it both passes and fails on the version that ends it)"); - buf_add(b, "
      \n
      edenprobe
      "); + buf_add(b, "
      \n
      "); + esc(b, c->program); + buf_add(b, "
      "); esc(b, c->version); buf_add(b, " "); esc(b, c->words); @@ -1500,6 +1511,7 @@ static cJSON* candidate_object(const Runs* r, const RuleCandidate* c) { jset(o, "versions", c->versions); cJSON_AddBoolToObject(o, "mixed", c->mixed); jset(o, "broken", c->broken); + jset(o, "program", c->program); jset(o, "edenprobe", c->version); jset(o, "words", c->words); for (k = 0; k < c->nfailing; ++k) cJSON_AddItemToArray(fail, cJSON_CreateNumber((double)c->failing[k])); @@ -1521,8 +1533,8 @@ static int candidates_page(const char* root, const Runs* r) { cJSON *o = cJSON_CreateObject(), *list = cJSON_AddArrayToObject(o, "candidates"), *general = cJSON_AddArrayToObject(o, "general"), *regressions = cJSON_AddArrayToObject(o, "regressions"); int i, k, done; - head(&b, "../", "Tracer: what the runs of edenprobe say", - "Ban candidates, ScarletNX's own failures and regressions, from the runs of edenprobe sent to Tracer."); + head(&b, "../", "Tracer: what the runs of Amberlith say", + "Ban candidates, ScarletNX's own failures and regressions, from the runs of Amberlith sent to Tracer."); buf_printf( &b, "
      \n

      Probe

      \n

      What the runs " @@ -1582,6 +1594,7 @@ static int candidates_page(const char* root, const Runs* r) { jset(e, "case", r->names[n].key); jset(e, "suite", r->names[n].suite); jset(e, "name", r->names[n].name); + jset(e, "program", g->program); jset(e, "edenprobe", g->version); jset(e, "words", g->words); cJSON_AddNumberToObject(e, "seen", g->seen); @@ -1624,6 +1637,7 @@ static int candidates_page(const char* root, const Runs* r) { jset(e, "case", r->names[n].key); jset(e, "suite", r->names[n].suite); jset(e, "name", r->names[n].name); + jset(e, "program", g->program); jset(e, "edenprobe", g->version); jset(e, "words", g->words); jset(e, "driver", probe_driver_name(g->driver_id)); @@ -1657,9 +1671,9 @@ static int driver_page(const char* root, const Runs* r, int id) { mine[nmine++] = i; cJSON_AddItemToArray(reports, cJSON_CreateNumber((double)r->runs[i].report)); } - buf_printf(&title, "%s: runs of edenprobe", label); + buf_printf(&title, "%s: runs of Amberlith", label); head(&b, "../../", title.text, - "A driver's runs of edenprobe sent to Tracer: its versions and the cases that fail."); + "A driver's runs of Amberlith sent to Tracer: its versions and the cases that fail."); buf_free(&title); buf_add(&b, "
      \n

      Probe

      \n

      "); esc(&b, label); diff --git a/tracer/src/store.c b/tracer/src/store.c index e7eedf6..ba0db02 100644 --- a/tracer/src/store.c +++ b/tracer/src/store.c @@ -67,7 +67,10 @@ static const char* const UPGRADES[] = { " NOT NULL REFERENCES probe_names(id), result INTEGER NOT NULL, tier TEXT, reason TEXT, detail TEXT, us REAL," " PRIMARY KEY(report, name)) WITHOUT ROWID;" /* by case, with the result, so the rules and a case's page read the results from the index alone */ - "CREATE INDEX probe_cases_name ON probe_cases(name, report, result);"}; + "CREATE INDEX probe_cases_name ON probe_cases(name, report, result);", + /* 9, the program a run's starting note names: Amberlith, or edenprobe, the name before its 1.0.0 (NULL: a run kept + before this, all edenprobe's) */ + "ALTER TABLE probe_runs ADD COLUMN program TEXT;"}; /* a report's columns, in the order row_report reads them */ #define REPORT_COLUMNS \ @@ -773,7 +776,7 @@ void st_reports_free(StReport* r, int n) { free(r); } -/* ---- the runs of edenprobe ---- */ +/* ---- the runs of Amberlith (edenprobe before its 1.0.0) ---- */ /* name's id in probe_names, found, else added: the id, or 0 said in the log */ static long name_id(Store* s, sqlite3_stmt* add, sqlite3_stmt* find, const char* suite, const char* name) { @@ -826,8 +829,8 @@ int st_probe_set(Store* s, long report, const Probe* p, const char* digest) { "INSERT INTO probe_runs(report, emulator, emulator_version, commit_id, built, version," " describe, words, system, os, gpu, device, driver_name, driver_info, driver_id, inferred," " driver_version, vulkan, extensions, passed, failed, skipped, crashed, whole, cut_cases," - " cut_notes, unread, over, digest) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?," - "?,?)") + " cut_notes, unread, over, digest, program) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?," + "?,?,?,?,?,?,?)") : NULL; ok = q != NULL; if (ok) { @@ -860,6 +863,7 @@ int st_probe_set(Store* s, long report, const Probe* p, const char* digest) { sqlite3_bind_int(q, 27, p->unread); sqlite3_bind_int(q, 28, p->over); text_at(q, 29, digest); + text_at(q, 30, probe_program(p)); ok = sqlite3_step(q) == SQLITE_DONE; if (!ok) said(s, "a run added"); } @@ -903,7 +907,7 @@ int st_probe_set(Store* s, long report, const Probe* p, const char* digest) { "r.report, r.emulator, r.emulator_version, r.commit_id, r.built, r.version, r.describe, r.words, r.system, r.os, " \ "r.gpu, r.device, r.driver_name, r.driver_info, r.driver_id, r.inferred, r.driver_version, r.vulkan, " \ "r.extensions, r.passed, r.failed, r.skipped, r.crashed, r.whole, r.cut_cases, r.cut_notes, r.unread, r.over, " \ - "p.poster, p.created" + "p.poster, p.created, r.program" static void row_run(sqlite3_stmt* q, void* to) { StProbeRun* r = to; Probe* p = &r->p; @@ -938,6 +942,8 @@ static void row_run(sqlite3_stmt* q, void* to) { p->over = sqlite3_column_int(q, 27); r->poster = (u64)sqlite3_column_int64(q, 28); r->when = sqlite3_column_double(q, 29); + p->program = text_of(q, 30); + if (!p->program) p->program = rei_strdup("edenprobe"); /* a run kept before the program's name was: edenprobe's */ if (p->driver_id && p->driver_version) { probe_version_text(p->driver_id, p->driver_version, text, sizeof text); p->driver_text = rei_strdup(text); diff --git a/tracer/src/tracer.h b/tracer/src/tracer.h index e69bd6b..a779470 100644 --- a/tracer/src/tracer.h +++ b/tracer/src/tracer.h @@ -20,7 +20,8 @@ #define TR_KEYS \ "TRACER_TOKEN", "TRACER_URL", "TRACER_CHANNELS", "TRACER_ADMINS", "TRACER_DB", "TRACER_SITE", "TRACER_ASSETS", \ "TRACER_TITLES", "TRACER_ISSUES_REPO", "TRACER_ISSUES_TOKEN", "TRACER_ISSUES_EMOJI", "TRACER_ISSUES_LABELS", \ - "TRACER_UPSTREAM_REPO" + "TRACER_UPSTREAM_REPO", "TRACER_MIN_FREE" +#define TR_MIN_FREE 1024 /* the MiB the site's file system keeps free when TRACER_MIN_FREE does not say */ /* a download: url's body into out (cleared first), max bytes at most. 0, or -1 with why (owned) */ typedef int (*TrGet)(void* ctx, const char* url, size_t max, Buf* out, char** why); diff --git a/tracer/tests/test_tracer.c b/tracer/tests/test_tracer.c index f7dc946..55b00b2 100644 --- a/tracer/tests/test_tracer.c +++ b/tracer/tests/test_tracer.c @@ -1836,6 +1836,76 @@ static int counted_take(void* ctx, Tracer* t, const TrMessage* m, Taken* k, char tr_take(t, k, m); return 0; } +/* the site's disk as the tests set it: its free bytes, -1 for one that cannot be read */ +static double disk_now; +static double disk_free(const char* path, char** why) { + (void)path; + *why = disk_now < 0 ? rei_strdup("statvfs: a fake failure") : NULL; + return disk_now; +} + +/* the floor of the site's disk: a message whose files would go under it refused before any download, with the values; + one that fits taken; an update the same; no floor with 0 */ +static void test_disk(void) { + TrMessage m; + char* t; + long id; + tracer.free_bytes = disk_free; + tracer.min_free = 1024.0 * 1048576; + now_is += 3601; /* a new hour for the person's limit */ + disk_now = 1030.0 * 1048576; + downloads = 0; + m = message(2700, 82, "<@99> it crashes"); + attach(&m, "game.log", "https://cdn.discordapp.com/1/game.log", 10.0 * 1048576); + t = answer_text(respond(&m)); + HAS(t, "Nothing was kept: the site's disk has 1030 MiB free, and Tracer keeps 1024 MiB of it free; these files " + "(10.0 MiB) would go under that."); + free(t); + CHECK(downloads == 0 && !st_by_message(tracer.store, 2700)); + tr_message_free(&m); + disk_now = 2048.0 * 1048576; /* room again: taken */ + m = message(2701, 82, "<@99> it crashes"); + attach(&m, "game.log", "https://cdn.discordapp.com/1/game.log", 10.0 * 1048576); + t = answer_text(respond(&m)); + HAS(t, "Report #"); + free(t); + tr_message_free(&m); + id = st_by_message(tracer.store, 2701); + CHECK(id > 0 && downloads == 1); + disk_now = 1025.0 * 1048576; /* an update of 2 MiB: refused too */ + m = message(2702, 82, "<@99> a screenshot"); + m.reply_to = 2701; + attach(&m, "shot.png", "https://cdn.discordapp.com/1/shot.png", 2.0 * 1048576); + t = answer_text(respond(&m)); + HAS(t, "these files (2.0 MiB) would go under that"); + free(t); + tr_message_free(&m); + CHECK(!st_report_of(tracer.store, 2702)); + disk_now = -1; /* a disk that cannot be read refuses, saying why */ + m = message(2703, 82, "<@99>"); + attach(&m, "game.log", "https://cdn.discordapp.com/1/game.log", 10); + t = answer_text(respond(&m)); + HAS(t, "the free space of the site's disk could not be read (statvfs: a fake failure)"); + free(t); + tr_message_free(&m); + tracer.min_free = 0; /* no floor: no question */ + m = message(2704, 82, "<@99> again"); + attach(&m, "game.log", "https://cdn.discordapp.com/1/game.log", 10); + t = answer_text(respond(&m)); + HAS(t, "Report #"); + free(t); + tr_message_free(&m); + CHECK(tr_forget(&tracer, 2701) && tr_forget(&tracer, 2704)); + tracer.free_bytes = NULL; + { /* the real one: this machine's disk, read */ + char* why; + CHECK(tr_free_bytes(site, &why) > 0 && !why); + CHECK(tr_free_bytes("/nonesuch/folder", &why) < 0); + HAS(why, "statvfs /nonesuch/folder: "); + free(why); + } +} + static void test_limits(void) { TrMessage m; char* t; @@ -3372,6 +3442,14 @@ static const char PROBE_JSONL[] = "\"detail\":\"\"}\n" "{\"type\":\"summary\",\"passed\":1,\"failed\":0,\"skipped\":0,\"crashed\":0}\n"; +/* text with each "edenprobe 0.9.0 (v0.9.0) starting" as Amberlith 1.0.0 writes its own; owned */ +static char* amberlith_of(const char* text) { + static const char old[] = "edenprobe 0.9.0 (v0.9.0) starting", now[] = "Amberlith 1.0.0 (v1.0.0) starting"; + char *out = rei_strdup(text), *at; + for (at = strstr(out, old); at; at = strstr(at, old)) memcpy(at, now, sizeof now - 1); /* the same length */ + return out; +} + static void test_probe_parts(void) { char text[64]; unsigned long v = 0; @@ -3383,6 +3461,19 @@ static void test_probe_parts(void) { CHECK(probe_keeps_detail("astc") && probe_keeps_detail("fs") && probe_keeps_detail("game")); CHECK(!probe_keeps_detail("account") && !probe_keeps_detail("ldn") && !probe_keeps_detail("nifm")); CHECK(!probe_keeps_detail("pad") && !probe_keeps_detail("nonesuch")); + /* Amberlith 1.0.0's families: its new suites in them, libc's losing their detail as the network's do */ + CHECK(probe_family("pace-gpu") == PROBE_PACE && probe_family("mandelbrot") == PROBE_DEMO); + CHECK(probe_family("nvn") == PROBE_NVN && probe_family("music") == PROBE_MUSIC && + probe_family("wimsy") == PROBE_GAME); + CHECK(probe_family("socket") == PROBE_LIBC && probe_family("svc") == PROBE_KERNEL && + probe_family("sdk") == PROBE_SERVICE); + CHECK(probe_family("stencil") == PROBE_GRAPHICS && probe_family("xfb") == PROBE_GRAPHICS); + SAME(probe_family_name(PROBE_PACE), "pace"); + SAME(probe_family_name(PROBE_LIBC), "libc"); + SAME(probe_family_name(PROBE_OTHER), "other"); + CHECK(probe_keeps_detail("pace-timer") && probe_keeps_detail("julia") && probe_keeps_detail("nvn")); + CHECK(probe_keeps_detail("music") && probe_keeps_detail("coverage")); + CHECK(!probe_keeps_detail("system") && !probe_keeps_detail("socket") && !probe_keeps_detail("audin")); /* the drivers, by the ban table's names, and by their own names as Eden logs them */ SAME(probe_driver_name(3), "radv"); SAME(probe_driver_name(30), "apesoft"); @@ -3456,6 +3547,7 @@ static void test_probe_lines(void) { SAME(p.emulator_version, "main 1234abc"); SAME(p.commit, "1234abc"); CHECK(p.built == 1793491200.0); + SAME(p.program, "edenprobe"); SAME(p.version, "0.9.0"); SAME(p.describe, "v0.9.0"); SAME(p.words, "cpu graphics net notime"); @@ -3505,7 +3597,7 @@ static void test_probe_lines(void) { cJSON_ReplaceItemInObjectCaseSensitive(cJSON_GetArrayItem(cJSON_GetObjectItemCaseSensitive(o, "cases"), 2), "detail", cJSON_CreateString("")); CHECK(probe_of_json(o, &q, &why) == -1); - HAS(why, "case 7 is not one edenprobe writes"); + HAS(why, "case 7 is not one Amberlith writes"); free(why); cJSON_Delete(o); /* another result is another mark */ @@ -3515,6 +3607,39 @@ static void test_probe_lines(void) { CHECK(strcmp(digest, other) != 0); probe_free(&p); free(cut); + /* Amberlith, edenprobe's name since its 1.0.0: its starting note opens a run as the old one did */ + { + char* amber = amberlith_of(PROBE_LOG); + CHECK(probe_marks(amber, strlen(amber)) == 2); + cut = probe_cut(amber, strlen(amber), &n, &cases, ¬es); + CHECK(probe_parse(cut, n, &p, &why) == 1 && !why); + SAME(p.program, "Amberlith"); + SAME(p.version, "1.0.0"); + SAME(p.describe, "v1.0.0"); + CHECK(p.ncases == 6 && p.whole && p.driver_id == 3); + /* through JSON: the program kept; one it may not name, or none, refused */ + o = probe_json(&p); + SAME(jstr(o, "program"), "Amberlith"); + CHECK(!probe_of_json(o, &q, &why) && !why); + SAME(probe_program(&q), "Amberlith"); + probe_free(&q); + cJSON_ReplaceItemInObjectCaseSensitive(o, "program", cJSON_CreateString("Amberlith2")); + CHECK(probe_of_json(o, &q, &why) == -1); + HAS(why, "names no program it may (Amberlith2)"); + free(why); + cJSON_DeleteItemFromObjectCaseSensitive(o, "program"); + CHECK(probe_of_json(o, &q, &why) == -1); + HAS(why, "names no program it may (none)"); + free(why); + cJSON_Delete(o); + probe_free(&p); + free(cut); + /* a name that only begins like it opens nothing */ + memcpy(strstr(amber, "Amberlith 1.0.0"), "Amberlithe", 10); + CHECK(probe_marks(amber, strlen(amber)) == 0); + CHECK(probe_parse(amber, strlen(amber), &p, &why) == 0 && !why); + free(amber); + } /* Eden's log: its driver ID read from the driver's name, its version as NVIDIA numbers it */ CHECK(probe_parse(EDEN_LOG, strlen(EDEN_LOG), &p, &why) == 1); SAME(p.emulator, "Eden"); @@ -3677,8 +3802,8 @@ static void test_probe_reports(void) { "crashed"); HAS(t, "Report #"); HAS(t, ": edenprobe 0.9.0 on ScarletNX"); - HAS(t, "the detail of 3 cases of the service, net and pad families (or of no family edenprobe names) and 1 net " - "note, which can name the player"); + HAS(t, "the detail of 3 cases of the service, net, pad and libc families (or of no family edenprobe names) and 1 " + "net note, which can name the player"); HAS(t, "main 1234abc"); free(t); tr_message_free(&m); @@ -3786,14 +3911,59 @@ static void test_probe_reports(void) { attach(&m, "resumed.log", "https://cdn.discordapp.com/20/resumed.log", 10); t = answer_text(respond(&m)); HAS(t, "Report #"); - HAS(t, "Not a run of edenprobe"); - HAS(t, "resumed.log: its edenprobe lines are a launch that went on with a run after a crash"); + HAS(t, "Not a run of Amberlith"); + HAS(t, "resumed.log: its Amberlith lines are a launch that went on with a run after a crash"); free(t); tr_message_free(&m); CHECK(st_get(tracer.store, st_by_message(tracer.store, 9605), &r, NULL, NULL) == 1); SAME(r.key, "0100AAAABBBB0000"); st_report_free(&r); } + /* a run of Amberlith: its name in the reply, the title, the run kept and the report's page; one kept before the + database knew the program's name (version 8) is edenprobe's */ + { + char* amber = amberlith_of(PROBE_LOG); + long amber_id; + sqlite3* db; + char* path = rei_format("%s/tracer.db", site); + serve("https://cdn.discordapp.com/20/amberlith.log", amber, strlen(amber)); + m = message(9607, 966, "<@99> the new one"); + attach(&m, "amberlith.log", "https://cdn.discordapp.com/20/amberlith.log", (double)strlen(amber)); + t = answer_text(respond(&m)); + HAS(t, "Amberlith 1.0.0 on radv, Mesa 26.1.8 (Linux): 3 passed, 2 failed (astc 1, newsuite 1), 0 skipped, 1 " + "crashed"); + HAS(t, ": Amberlith 1.0.0 on ScarletNX"); + HAS(t, "(or of no family Amberlith names)"); + LACKS(t, "edenprobe"); + free(t); + tr_message_free(&m); + amber_id = st_by_message(tracer.store, 9607); + CHECK(st_get(tracer.store, amber_id, &r, NULL, NULL) == 1); + SAME(r.key, PROBE_KEY); + SAME(r.title, "Amberlith 1.0.0 on ScarletNX"); + st_report_free(&r); + CHECK(st_probe_get(tracer.store, amber_id, &run, 0) == 1); + SAME(probe_program(&run), "Amberlith"); + probe_free(&run); + rel = rei_format("r/%ld/index.html", amber_id); + p = page(rel); + HAS(p, "

      Amberlith "); + HAS(p, "
      Amberlith
      1.0.0 (v1.0.0)
      "); + free(p); + free(rel); + CHECK(sqlite3_open(path, &db) == SQLITE_OK); + CHECK(sqlite3_exec(db, + "UPDATE probe_runs SET program = NULL WHERE report IN (SELECT id FROM reports WHERE" + " message = 9607)", + NULL, NULL, NULL) == SQLITE_OK); + sqlite3_close(db); + CHECK(st_probe_get(tracer.store, amber_id, &run, 0) == 1); + SAME(probe_program(&run), "edenprobe"); + probe_free(&run); + CHECK(tr_forget(&tracer, 9607)); /* the runs the pages below count are the ones above */ + free(path); + free(amber); + } /* through a worker: the run in its answer, checked, the same as one read here */ serve_file("https://cdn.discordapp.com/21/edenprobe.log", PROBE_LOG, strlen(PROBE_LOG)); tracer.take = test_worker_take; @@ -3802,7 +3972,7 @@ static void test_probe_reports(void) { attach(&m, "edenprobe.log", "https://cdn.discordapp.com/21/edenprobe.log", 10); t = answer_text(respond(&m)); HAS(t, "edenprobe 0.9.0 on radv, Mesa 26.1.8 (Linux): 3 passed, 2 failed"); - HAS(t, "the detail of 3 cases of the service, net and pad families"); + HAS(t, "the detail of 3 cases of the service, net, pad and libc families"); free(t); tr_message_free(&m); tracer.take = NULL; @@ -3860,7 +4030,7 @@ static void test_probe_site(void) { mcp.url = "https://reports.example"; /* the runs so far: the matrix, a case, a driver, the report's own page and JSON */ p = page("probe/index.html"); - HAS(p, "

      Runs of edenprobe

      "); + HAS(p, "

      Runs of Amberlith

      "); HAS(p, "

      ScarletNX
      radv 26.1.8
      Linux
      Eden
      nvidia 580.95.05*
      Windows
      ", key); @@ -4333,6 +4503,13 @@ static int rules_only(void) { fprintf(stderr, "tracer rules: %d of %d checks passed\n", checks - failures, checks); return failures != 0; } +/* what a log holds of a run (probe.h), alone: scripts/test-mutants.py's */ +static int probe_only(void) { + test_probe_parts(); + test_probe_lines(); + fprintf(stderr, "tracer probe: %d of %d checks passed\n", checks - failures, checks); + return failures != 0; +} /* every test, the database's and the site's with them; self_path the test's own program, for its workers */ static void every_test(const char* self_path) { @@ -4358,6 +4535,7 @@ static void every_test(const char* self_path) { test_names(); test_missed(); test_limits(); + test_disk(); test_other_guild(); test_replies(); test_mcp_grep(); @@ -4378,6 +4556,7 @@ int main(int argc, char** argv) { char *db, *command; int files_only = argc == 2 && !strcmp(argv[1], "--files"); /* scripts/test-mutants.py's, as --rules */ if (argc == 2 && !strcmp(argv[1], "--rules")) return rules_only(); + if (argc == 2 && !strcmp(argv[1], "--probe")) return probe_only(); if (argc == 2 && !files_only) return as_worker(argv[1]); rei_now = clock_now; strcpy(site, "/tmp/tracer-test-XXXXXX"); diff --git a/tracer/third_party/logscan/COMMIT b/tracer/third_party/logscan/COMMIT index ec1361a..22b2266 100644 --- a/tracer/third_party/logscan/COMMIT +++ b/tracer/third_party/logscan/COMMIT @@ -1 +1 @@ -3468cf2410b8b4b44d5b2123c36079c4c50563a1 +2f4629632af36c7c13fee684318867815aea95ce diff --git a/tracer/third_party/logscan/common/utilities/demangle.h b/tracer/third_party/logscan/common/utilities/demangle.h index 8e0df05..230a34d 100644 --- a/tracer/third_party/logscan/common/utilities/demangle.h +++ b/tracer/third_party/logscan/common/utilities/demangle.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: GPL-3.0-or-later Copyright 2026 the ScarletNX contributors */ /* A game's C++ symbol in the form its source wrote it, through the C++ runtime's demangler (demangle.c). A program - that links it links the C++ runtime (LINKER_LANGUAGE CXX), as every ScarletNX program does for VMA and lunasvg */ + that links it links the C++ runtime (LINKER_LANGUAGE CXX), as every ScarletNX program does for lunasvg */ #ifndef SNX_DEMANGLE_H #define SNX_DEMANGLE_H /* name ("_ZN2nn3hid18GetNpadJoyHoldTypeEv") demangled, malloc'd, or NULL for a name that isn't a mangled one */ diff --git a/tracer/third_party/logscan/common/utilities/logscan.c b/tracer/third_party/logscan/common/utilities/logscan.c index d0a534f..fd125f2 100644 --- a/tracer/third_party/logscan/common/utilities/logscan.c +++ b/tracer/third_party/logscan/common/utilities/logscan.c @@ -493,12 +493,17 @@ static int marker(Span line, Marker* m) { output is kept while it is read, and stands for itself when its title ID is not the game log's */ enum { PHASE_START, PHASE_LOG, PHASE_HEAD, PHASE_RUN, PHASE_GAME, PHASE_DONE }; -/* "ScarletNX - ", what an older build followed with " (<folder>)", which is cut, and the GBA's runtime with - " (GBA)" (agb/runtime/main.c), which is cut too: the console says it */ +/* "ScarletNX - <title>", what an older build followed with " (<folder>)", which is cut, and the other runtimes with + " (GBA)", " (3DS)" or " (Vita)" (agb/runtime/main.c, 3ds/aot/run.c, vita/runtime/main.c), which is cut too: the + console says it */ static void header(SnxLogScan* s, Span title) { size_t i; - s->console = ends(title, " (GBA)") ? SNX_CONSOLE_GBA : SNX_CONSOLE_SWITCH; - if (s->console == SNX_CONSOLE_GBA) title.n -= 6; + s->console = ends(title, " (GBA)") ? SNX_CONSOLE_GBA + : ends(title, " (3DS)") ? SNX_CONSOLE_3DS + : ends(title, " (Vita)") ? SNX_CONSOLE_VITA + : SNX_CONSOLE_SWITCH; + if (s->console == SNX_CONSOLE_GBA || s->console == SNX_CONSOLE_3DS) title.n -= 6; + if (s->console == SNX_CONSOLE_VITA) title.n -= 7; for (i = title.n; i > 2; i--) if (title.p[i - 1] == '(' && title.p[i - 2] == ' ') { Span path = skip(title, i); @@ -520,6 +525,30 @@ static int is_day(Span s) { return (s.p[5] == '0' ? s.p[6] != '0' : s.p[5] == '1' && s.p[6] <= '2') && (s.p[8] == '0' ? s.p[9] != '0' : s.p[8] < '3' || (s.p[8] == '3' && s.p[9] <= '1')); } +/* the days from 1970-01-01 to y-m-d of the Gregorian calendar (Howard Hinnant's days_from_civil) */ +static long days_from_civil(long y, long m, long d) { + long era, yoe, doy; + y -= m <= 2; + era = (y >= 0 ? y : y - 399) / 400; + yoe = y - era * 400; + doy = (153 * (m > 2 ? m - 3 : m + 9) + 2) / 5 + d - 1; + return era * 146097 + yoe * 365 + yoe / 4 - yoe / 100 + doy - 719468; +} +/* "<YYYY-MM-DD> <HH:MM:SS> UTC" of the run's line (snx_run_log_line) in seconds since 1970, 0 for anything else */ +static long long run_started(Span at) { + Span day = {at.p, 10}; + const char* p = at.p; + long h, m, sec; + if (at.n != 23 || !is_day(day) || p[10] != ' ' || p[13] != ':' || p[16] != ':' || memcmp(p + 19, " UTC", 4)) + return 0; + for (int i = 11; i < 19; i++) + if (i != 13 && i != 16 && (p[i] < '0' || p[i] > '9')) return 0; + h = (p[11] - '0') * 10 + (p[12] - '0'); + m = (p[14] - '0') * 10 + (p[15] - '0'); + sec = (p[17] - '0') * 10 + (p[18] - '0'); + if (h > 23 || m > 59 || sec > 59) return 0; + return (long long)days_from_civil(atol(p), atol(p + 5), atol(p + 8)) * 86400 + h * 3600 + m * 60 + sec; +} /* "build: ScarletNX <branch> <commit>, committed <YYYY-MM-DD> (<compiler>, <system>)", a build before the day had no ", committed ...", or the launcher's line without "build: " */ static int build_line(SnxLogScan* s, Span line) { @@ -542,8 +571,8 @@ static int build_line(SnxLogScan* s, Span line) { return 1; } -/* the other frontends' header, the title, its ID when there is one, and the build on one line (3ds/aot/run.c, - vita/runtime/main.c): "Game: <title> (<title ID>) - ScarletNX ...", "Game: <title> - ScarletNX ..." */ +/* the 3DS and Vita runtimes' header of an older build, the title, its ID when there is one, and the build on one line: + "Game: <title> (<title ID>) - ScarletNX ...", "Game: <title> - ScarletNX ..." */ static int frontend_header(SnxLogScan* s, Span rest) { long at = find(rest, " - ScarletNX "); if (at <= 0) return 0; @@ -1188,6 +1217,12 @@ void snx_logscan_line(SnxLogScan* s, const char* p, size_t n) { case 'b': if (!s->build && take_lit(&rest, "build: ") && build_line(s, rest)) return; break; + case 'r': /* "run: started <YYYY-MM-DD> <HH:MM:SS> UTC" (snx_run_log_line) */ + if (!s->started && take_lit(&rest, "run: started ")) { + s->started = run_started(rest); + if (s->started) return; + } + break; case 'G': if (!s->title && take_lit(&rest, "Game: ") && frontend_header(s, rest)) return; break; @@ -1201,6 +1236,18 @@ void snx_logscan_line(SnxLogScan* s, const char* p, size_t n) { return; } break; + case 't': /* the 3DS's title ID (3ds/aot/run.c): "title ID: <16 hex digits>" */ + if (s->console == SNX_CONSOLE_3DS && !s->title_id && take_lit(&rest, "title ID: ") && rest.n == 16) { + char id[17]; + size_t k; + for (k = 0; k < 16 && snx_is_hex(rest.p[k]); k++) id[k] = (char)snx_to_upper(rest.p[k]); + if (k == 16) { + id[16] = 0; + s->title_id = add_c(s, id); + return; + } + } + break; case 's': /* "system: <OS and version>, <CPU>, <n> threads, <n> GB RAM" (plat_system_info) */ if (!s->system && take_lit(&rest, "system: ") && rest.n) { s->system = add(s, rest); @@ -1683,21 +1730,12 @@ static void md_sym(Buf* b, const SnxLogScan* s, const SnxLogSym* sym, SnxDemangl } free(plain); } -/* the days from 1970-01-01 to y-m-d of the Gregorian calendar (Howard Hinnant's days_from_civil) */ -static long days_from_civil(long y, long m, long d) { - long era, yoe, doy; - y -= m <= 2; - era = (y >= 0 ? y : y - 399) / 400; - yoe = y - era * 400; - doy = (153 * (m > 2 ? m - 3 : m + 9) + 2) / 5 + d - 1; - return era * 146097 + yoe * 365 + yoe / 4 - yoe / 100 + doy - 719468; -} -/* "`<branch> <commit>`, committed <day>", and when the run's time is known (written) and the day is one, ", <n> days - before this run", by the days of the UTC calendar */ +/* "`<branch> <commit>`, committed <day>", and when the run's time is known (the log's "run: started" line, else + written) and the day is one, ", <n> days before this run", by the days of the UTC calendar */ static void md_build_age(Buf* b, const SnxLogScan* s) { Buf name = {0}; const char* day = snx_logscan_text(s, s->committed); - long long began = s->written - (s->centiseconds > 0 ? s->centiseconds / 100 : 0); + long long began = s->started > 0 ? s->started : s->written - (s->centiseconds > 0 ? s->centiseconds / 100 : 0); put(&name, snx_logscan_text(s, s->branch)); put(&name, " "); put(&name, snx_logscan_text(s, s->commit)); @@ -1705,7 +1743,7 @@ static void md_build_age(Buf* b, const SnxLogScan* s) { free(name.p); put(b, ", committed "); put(b, day); - if (s->written > 0 && began >= 0 && strcmp(day, "unknown")) { + if ((s->started > 0 || s->written > 0) && began >= 0 && strcmp(day, "unknown")) { char age[64]; long days = (long)(began / 86400) - days_from_civil(atol(day), atol(day + 5), atol(day + 8)); sprintf(age, ", %ld %s before this run", days, days == 1 || days == -1 ? "day" : "days"); diff --git a/tracer/third_party/logscan/common/utilities/logscan.h b/tracer/third_party/logscan/common/utilities/logscan.h index 5062a08..9cbef32 100644 --- a/tracer/third_party/logscan/common/utilities/logscan.h +++ b/tracer/third_party/logscan/common/utilities/logscan.h @@ -67,8 +67,8 @@ enum { }; /* where a crash report put the host pc */ enum { SNX_PLACE_NONE, SNX_PLACE_GAME, SNX_PLACE_BLOCK, SNX_PLACE_RUNTIME, SNX_PLACE_LIBRARY }; -/* the console the game is of, by its runtime's header: the Switch's, the 3DS's and the Vita's ("Game: ..."), the - GBA's ("ScarletNX - <title> (GBA)") */ +/* the console the game is of, by its runtime's header: the Switch's ("ScarletNX - <title>"), the others' with + " (3DS)", " (Vita)" or " (GBA)" after the title (an older 3DS or Vita build's was "Game: ...") */ enum { SNX_CONSOLE_NONE, SNX_CONSOLE_SWITCH, SNX_CONSOLE_3DS, SNX_CONSOLE_VITA, SNX_CONSOLE_GBA }; /* Every text is an offset into the scan's pool, 0 for none (the pool's first byte is an empty string) */ @@ -104,6 +104,9 @@ typedef struct SnxLogScan { after the scan, from the log's file as the run left it (the launcher's Share Log does), 0 for unknown. Less the last line's time, the run began then: the markdown says how many days the build's commit is older */ long long written; + /* when the run began, in seconds since 1970 (UTC), from the log's own line "run: started <YYYY-MM-DD> <HH:MM:SS> + UTC" (snx_run_log_line); 0 in a log without one. Where it is, the days are counted from it and not from written */ + long long started; int outcome; unsigned signature; /* the failure, when outcome isn't SNX_LOG_NONE: the marker's fields, then its report's */