@roomi-fields/grillhouse 0.54.1 → 0.55.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +69 -0
- package/cadre/templates/projet/.github/workflows/ci.yml +4 -2
- package/cadre/templates/projet/.github/workflows/machine-vierge.yml +5 -42
- package/cadre/templates/projet/CONTRIBUTING.md +0 -5
- package/cadre/templates/projet/README.md +0 -126
- package/cadre/templates/projet/_npmignore +1 -6
- package/cadre/templates/projet/package.json +5 -32
- package/cadre/templates/projet/tsconfig.json +4 -4
- package/cadre/templates/projet/vitest.config.cjs +3 -2
- package/charte/tests.md +14 -0
- package/dist/machine/part-par-sorte.d.ts +9 -9
- package/dist/machine/part-par-sorte.js +20 -24
- package/dist/machine/part-par-sorte.js.map +1 -1
- package/dist/machine/table-des-consommations.d.ts +65 -0
- package/dist/machine/table-des-consommations.js +94 -0
- package/dist/machine/table-des-consommations.js.map +1 -0
- package/dist/temporal/circuit/activites.d.ts +2 -0
- package/dist/temporal/circuit/activites.js +87 -3
- package/dist/temporal/circuit/activites.js.map +1 -1
- package/dist/temporal/circuit/client.js +9 -4
- package/dist/temporal/circuit/client.js.map +1 -1
- package/dist/temporal/circuit/contrat.d.ts +32 -4
- package/dist/temporal/circuit/deroule.js +54 -4
- package/dist/temporal/circuit/deroule.js.map +1 -1
- package/dist/temporal/circuit/versions.d.ts +12 -0
- package/dist/temporal/circuit/versions.js +22 -0
- package/dist/temporal/circuit/versions.js.map +1 -0
- package/dist/temporal/consommation/activites.d.ts +2 -0
- package/dist/temporal/consommation/activites.js +9 -0
- package/dist/temporal/consommation/activites.js.map +1 -0
- package/dist/temporal/consommation/actualisation.d.ts +2 -0
- package/dist/temporal/consommation/actualisation.js +71 -0
- package/dist/temporal/consommation/actualisation.js.map +1 -0
- package/dist/temporal/consommation/client.d.ts +12 -0
- package/dist/temporal/consommation/client.js +28 -0
- package/dist/temporal/consommation/client.js.map +1 -0
- package/dist/temporal/consommation/commande.d.ts +5 -0
- package/dist/temporal/consommation/commande.js +32 -0
- package/dist/temporal/consommation/commande.js.map +1 -0
- package/dist/temporal/consommation/contrat.d.ts +15 -0
- package/dist/temporal/consommation/contrat.js +13 -0
- package/dist/temporal/consommation/contrat.js.map +1 -0
- package/dist/temporal/consommation/deroule.d.ts +2 -0
- package/dist/temporal/consommation/deroule.js +14 -0
- package/dist/temporal/consommation/deroule.js.map +1 -0
- package/dist/temporal/deroules.d.ts +2 -1
- package/dist/temporal/deroules.js +3 -2
- package/dist/temporal/deroules.js.map +1 -1
- package/dist/temporal/file/contrat.d.ts +2 -0
- package/dist/temporal/file/deroule.js +14 -4
- package/dist/temporal/file/deroule.js.map +1 -1
- package/dist/temporal/installation.d.ts +6 -0
- package/dist/temporal/installation.js +15 -0
- package/dist/temporal/installation.js.map +1 -1
- package/dist/temporal/nuits/activites.d.ts +2 -1
- package/dist/temporal/nuits/activites.js +127 -3
- package/dist/temporal/nuits/activites.js.map +1 -1
- package/dist/temporal/nuits/client.d.ts +19 -5
- package/dist/temporal/nuits/client.js +33 -23
- package/dist/temporal/nuits/client.js.map +1 -1
- package/dist/temporal/nuits/commande.js +16 -11
- package/dist/temporal/nuits/commande.js.map +1 -1
- package/dist/temporal/nuits/contrat.d.ts +29 -0
- package/dist/temporal/nuits/contrat.js +10 -0
- package/dist/temporal/nuits/contrat.js.map +1 -1
- package/dist/temporal/nuits/deroule.d.ts +5 -0
- package/dist/temporal/nuits/deroule.js +18 -1
- package/dist/temporal/nuits/deroule.js.map +1 -1
- package/dist/temporal/nuits/pc2.d.ts +72 -0
- package/dist/temporal/nuits/pc2.js +206 -0
- package/dist/temporal/nuits/pc2.js.map +1 -0
- package/dist/temporal/places/activites.d.ts +23 -1
- package/dist/temporal/places/activites.js +38 -2
- package/dist/temporal/places/activites.js.map +1 -1
- package/dist/temporal/places/client.d.ts +16 -0
- package/dist/temporal/places/client.js +25 -1
- package/dist/temporal/places/client.js.map +1 -1
- package/dist/temporal/places/contrat.d.ts +79 -14
- package/dist/temporal/places/contrat.js +7 -0
- package/dist/temporal/places/contrat.js.map +1 -1
- package/dist/temporal/places/deroule.js +159 -23
- package/dist/temporal/places/deroule.js.map +1 -1
- package/dist/temporal/places/reservation.d.ts +54 -0
- package/dist/temporal/places/reservation.js +69 -0
- package/dist/temporal/places/reservation.js.map +1 -0
- package/dist/temporal/planification.d.ts +6 -0
- package/dist/temporal/planification.js +26 -0
- package/dist/temporal/planification.js.map +1 -0
- package/dist/temporal/tickets/activites.d.ts +0 -2
- package/dist/temporal/tickets/activites.js +2 -52
- package/dist/temporal/tickets/activites.js.map +1 -1
- package/dist/temporal/tickets/contrat.d.ts +7 -26
- package/dist/temporal/tickets/deroule.js +35 -23
- package/dist/temporal/tickets/deroule.js.map +1 -1
- package/dist/temporal/travailleur.js +2 -0
- package/dist/temporal/travailleur.js.map +1 -1
- package/docs/ARCHITECTURE.md +2 -2
- package/docs/CADRE.md +1 -1
- package/docs/INTERFACE.md +16 -11
- package/docs/architecture/circuit.md +62 -58
- package/docs/architecture/entree.md +87 -63
- package/docs/architecture/greffon.md +24 -21
- package/docs/architecture/installation.md +35 -30
- package/docs/architecture/machine.md +48 -40
- package/docs/architecture/tests.md +37 -33
- package/docs/lexique.md +4 -3
- package/package.json +1 -1
- package/scripts/activites.mjs +351 -180
- package/scripts/aiguillage.mjs +1 -0
- package/scripts/attente-de-la-machine.mjs +3 -22
- package/scripts/avancement.mjs +21 -30
- package/scripts/bilan.mjs +22 -2
- package/scripts/branche-de-nuit.mjs +1 -1
- package/scripts/circuit.mjs +75 -39
- package/scripts/codes-de-sortie.mjs +0 -6
- package/scripts/consommation-des-passes.mjs +67 -31
- package/scripts/consommation.mjs +152 -24
- package/scripts/copies-finies.mjs +15 -35
- package/scripts/dernier-vert.mjs +4 -5
- package/scripts/dette.mjs +5 -3
- package/scripts/droits.mjs +2 -2
- package/scripts/echantillonneur-de-la-passe.mjs +7 -31
- package/scripts/engendres.mjs +5 -61
- package/scripts/enveloppe/enveloppe.mjs +30 -34
- package/scripts/enveloppe/travail-de-la-copie.mjs +5 -0
- package/scripts/etapes.mjs +21 -7
- package/scripts/etat-du-depot.mjs +61 -0
- package/scripts/faits-du-circuit.mjs +7 -4
- package/scripts/fermeture-de-la-machine.d.mts +6 -4
- package/scripts/fermeture-de-la-machine.mjs +12 -16
- package/scripts/fichier-du-poste.d.mts +9 -0
- package/scripts/file-des-tickets.d.mts +0 -18
- package/scripts/file-des-tickets.mjs +0 -42
- package/scripts/fusion-du-changelog.mjs +1 -1
- package/scripts/grillhouse-maj.mjs +1 -1
- package/scripts/index-des-rouges.d.mts +40 -0
- package/scripts/index-des-rouges.mjs +104 -0
- package/scripts/integration/file.mjs +13 -63
- package/scripts/integration/integrer.mjs +157 -424
- package/scripts/integration/jugement.mjs +109 -0
- package/scripts/integration/rejeu.mjs +94 -71
- package/scripts/jointure.d.ts +34 -27
- package/scripts/journal-des-etats.d.mts +1 -1
- package/scripts/langages/c/commandes.mjs +27 -12
- package/scripts/langages/cargo/commandes.mjs +148 -94
- package/scripts/langages/cargo/index.mjs +2 -1
- package/scripts/langages/cargo/lectures-des-tests.mjs +132 -0
- package/scripts/langages/cargo/migrations/lectures-des-tests.mjs +31 -0
- package/scripts/langages/python/commandes.mjs +31 -15
- package/scripts/langages/python/index.mjs +2 -1
- package/scripts/langages/python/lectures-des-tests.mjs +148 -0
- package/scripts/langages/python/migrations/lectures-des-tests.mjs +31 -0
- package/scripts/langages/typescript/consommateurs-arbitres.mjs +2 -2
- package/scripts/langages/typescript/index.mjs +4 -0
- package/scripts/langages/typescript/lectures-des-tests.mjs +95 -0
- package/scripts/langages/typescript/migrations/lectures-des-tests.mjs +31 -0
- package/scripts/langages/typescript/tests-de-nuit.mjs +9 -15
- package/scripts/langages/typescript/tests.mjs +11 -37
- package/scripts/langages/typescript/titres-de-tests.mjs +5 -4
- package/scripts/langages/typescript/verifier.mjs +74 -44
- package/scripts/langages/typescript/vitest-config/base.mjs +3 -3
- package/scripts/langages/typescript/vitest-config/machine.setup.mjs +6 -25
- package/scripts/lectures-communes.mjs +234 -0
- package/scripts/machine.mjs +11 -18
- package/scripts/mesure/base-de-passe.mjs +1 -2
- package/scripts/mesure-de-la-machine.d.mts +40 -3
- package/scripts/mesure-de-la-machine.mjs +201 -11
- package/scripts/migrations/0.33.0-ci-du-cadre.mjs +3 -3
- package/scripts/migrations/nuit-yml-retire.mjs +25 -0
- package/scripts/migrations/part-retiree.mjs +31 -0
- package/scripts/migrations.mjs +4 -0
- package/scripts/montee.mjs +9 -0
- package/scripts/nuit-de-pc2.mjs +628 -0
- package/scripts/nuit.sh +8 -131
- package/scripts/paquets.mjs +1 -1
- package/scripts/passe-de-la-machine.mjs +340 -103
- package/scripts/place-du-circuit.d.mts +15 -0
- package/scripts/place-du-circuit.mjs +32 -0
- package/scripts/places-de-la-machine.mjs +148 -626
- package/scripts/places-du-serveur.mjs +26 -13
- package/scripts/plafond-de-la-machine.d.mts +8 -13
- package/scripts/plafond-de-la-machine.mjs +26 -56
- package/scripts/registre-des-entrees.mjs +57 -0
- package/scripts/regles-des-places.d.mts +82 -50
- package/scripts/regles-des-places.mjs +192 -156
- package/scripts/retirer-copie.sh +2 -2
- package/scripts/seances.mjs +181 -63
- package/scripts/secours.mjs +95 -0
- package/scripts/services-du-noyau.mjs +11 -19
- package/scripts/sous-commandes.mjs +1 -0
- package/scripts/sous-modules.sh +1 -1
- package/scripts/superviseur.mjs +16 -7
- package/scripts/table-des-consommations.d.mts +9 -0
- package/scripts/table-des-consommations.mjs +35 -0
- package/scripts/tableau.mjs +33 -19
- package/scripts/taches-du-graphe.mjs +124 -2
- package/scripts/transitions.d.mts +27 -5
- package/scripts/transitions.mjs +122 -104
- package/scripts/verdict-de-la-nuit.d.mts +13 -0
- package/scripts/verdict-de-la-nuit.mjs +34 -7
- package/scripts/verrou-de-fichier.mjs +1 -2
- package/scripts/workflows-du-cadre.mjs +2 -2
- package/skills/developpeur/SKILL.md +8 -2
- package/skills/direct/SKILL.md +5 -0
- package/skills/explorateur/SKILL.md +10 -1
- package/skills/grill/SKILL.md +2 -4
- package/skills/pitmaster/SKILL.md +7 -5
- package/skills/pitmaster/references/consigne-agent.md +1 -1
- package/skills/relecteur/SKILL.md +4 -1
- package/skills/testwriter/SKILL.md +15 -2
- package/cadre/templates/projet/.env.example +0 -57
- package/cadre/templates/projet/.github/workflows/nuit.yml +0 -139
- package/cadre/templates/projet/deployment/README.md +0 -98
- package/cadre/templates/projet/deployment/docs/01-INSTALL.md +0 -145
- package/cadre/templates/projet/deployment/docs/02-CONFIGURATION.md +0 -117
- package/cadre/templates/projet/deployment/docs/03-API.md +0 -264
- package/cadre/templates/projet/deployment/docs/04-TROUBLESHOOTING.md +0 -262
- package/cadre/templates/projet/deployment/scripts/install.ps1 +0 -100
- package/cadre/templates/projet/deployment/scripts/start.ps1 +0 -61
- package/cadre/templates/projet/deployment/scripts/stop.ps1 +0 -37
- package/cadre/templates/projet/deployment/scripts/test.ps1 +0 -118
- package/cadre/templates/projet/ecosystem.config.cjs +0 -73
- package/cadre/templates/projet/src/config.ts +0 -68
- package/cadre/templates/projet/src/errors.ts +0 -102
- package/cadre/templates/projet/src/index.ts +0 -46
- package/cadre/templates/projet/src/services/.gitkeep +0 -8
- package/cadre/templates/projet/src/types/index.ts +0 -24
- package/cadre/templates/projet/src/utils/logger.ts +0 -106
- package/cadre/templates/projet/tests/unit/config.spec.ts +0 -68
- package/cadre/templates/projet/tests/unit/errors.spec.ts +0 -132
- package/cadre/templates/projet/tests/unit/types.spec.ts +0 -73
- package/cadre/templates/projet/tsconfig.build.json +0 -14
- package/scripts/flux-de-la-nuit.mjs +0 -39
- package/scripts/garde-de-la-memoire.mjs +0 -231
- package/scripts/repli-de-la-nuit.mjs +0 -184
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
//
|
|
6
6
|
// npx grillhouse tests [--force] [<chemin>…] [--<option>…] tester
|
|
7
7
|
// npx grillhouse tests-du-paquet <chemin>… [--<option>…] tests-du-paquet
|
|
8
|
-
// npx grillhouse verifier [--tout | --gardes]
|
|
8
|
+
// npx grillhouse verifier [--tout | --force | --gardes] verifier
|
|
9
9
|
// node commandes.mjs typer typer
|
|
10
10
|
// npx grillhouse tests-de-nuit tests-de-nuit
|
|
11
11
|
// npx grillhouse tailles-des-tests | executables-de-tests | clippy | frontieres | index-interfaces
|
|
@@ -26,7 +26,9 @@
|
|
|
26
26
|
// of the run in the variable instead (`rejouer`), which no cached run holds: the task plays for
|
|
27
27
|
// real (`npm run test:forcer`). A path out of every crate, or in a crate without tests, or in a
|
|
28
28
|
// crate that is no package of the graph, is refused, named, and nothing plays (code 2). The exit
|
|
29
|
-
// code is Turborepo's.
|
|
29
|
+
// code is Turborepo's. In the envelope of an agent, a crate it shows read-only arrives built: the
|
|
30
|
+
// build is the writable crates' alone, then the tests alone (`--only`), as `lancerLesTests`
|
|
31
|
+
// (scripts/taches-du-graphe.mjs) does for every module.
|
|
30
32
|
// - `tests-du-paquet <chemin>…` is the body of that task, which the `test:unit` script of a crate
|
|
31
33
|
// calls (`grillhouse tests-du-paquet <dossier du crate>`, written with the package): it never runs
|
|
32
34
|
// Turborepo, so `tester` and the task do not loop. For a crate that plays tests
|
|
@@ -50,7 +52,7 @@
|
|
|
50
52
|
// executable) builds that target and plays its tests alone, by the filterset of nextest
|
|
51
53
|
// (`-E 'binary_id(<crate>::it) & test(/^foo::/)'`), as Cargo filters its own testsuite; the paths of the variable `GRILLHOUSE_TESTS` that lie in the crate replace the folder.
|
|
52
54
|
// A path out of every crate, or in a crate without tests, is refused, named, and nothing plays
|
|
53
|
-
// (code 2). `--force` changes nothing here: cargo keeps no result of a test to replay. Another
|
|
55
|
+
// (code 2). `--force` changes nothing here: cargo keeps no result of a test to replay (in `verifier`, `--force` plays the complete pass, as `--tout`). Another
|
|
54
56
|
// option goes to nextest.
|
|
55
57
|
// - A test target is named by its file, as `*_nuit_test.py` and `*.budget.test.*`:
|
|
56
58
|
// `tests/<nom>_nuit.rs` (or `tests/<nom>_nuit/main.rs`, the target `<nom>_nuit`) is a night
|
|
@@ -70,14 +72,14 @@
|
|
|
70
72
|
// benches of a pass comes before the first bench played.
|
|
71
73
|
// - A time budget bench plays alone, one test at a time (`--test-threads 1`), in a task `budget` of
|
|
72
74
|
// its own after the other tests: in `tests-de-nuit` and in a path that names it. Before it, the
|
|
73
|
-
//
|
|
74
|
-
//
|
|
75
|
-
//
|
|
76
|
-
// (
|
|
77
|
-
//
|
|
75
|
+
// benches of a pass (every crate of a workspace) play in one measure part of the machine, on
|
|
76
|
+
// dedicated cores (`avecLaPasse` of ./jointure with `mesure`, the part « Mesures de nuit », as
|
|
77
|
+
// the module typescript's measures): the common pass is the only judge of a bench red under a
|
|
78
|
+
// load (75, « à repasser »), the module reads no pressure and waits for no rest. A bench that
|
|
79
|
+
// no arbiter's part holds is not played: the pass stops, named (code 1 or 75).
|
|
78
80
|
// - `verifier` plays the tests of the crates as the tasks of Turborepo (`turbo run test:unit
|
|
79
81
|
// --filter=<crate>…`, each crate a package of the graph, the cache of the tasks selecting those
|
|
80
|
-
// that play again; `--tout` plays them for real, the moment of the pass in the variable
|
|
82
|
+
// that play again; `--tout` or `--force` (the night) plays them for real, the moment of the pass in the variable
|
|
81
83
|
// `GRILLHOUSE_TESTS`), then `cargo deny check`, the only run of cargo of the pass. It keeps no
|
|
82
84
|
// green: the one pass of the verification keeps it (scripts/dernier-vert.mjs,
|
|
83
85
|
// scripts/langages/typescript/verifier.mjs). Beside the module of package.json, whose pass plays
|
|
@@ -122,7 +124,7 @@
|
|
|
122
124
|
// recommends committing it for every project, and the verification plays the exact versions of
|
|
123
125
|
// the repository (`--locked`, as `npm ci` refuses a project without package-lock.json): a lock
|
|
124
126
|
// ignored passes in the main repository, where it lies on disk, and fails in a copy taken from
|
|
125
|
-
// git, the
|
|
127
|
+
// git, the queue's.
|
|
126
128
|
// - The exit code: 0 when every task is green, 75 when the only reds are « à repasser », 1
|
|
127
129
|
// otherwise; 2 for a path refused, a Cargo.lock not tracked or a command unknown.
|
|
128
130
|
// - `construire --echec <fichier> <plan>` is the launcher's build of the copy (scripts/enveloppe/lancer.sh),
|
|
@@ -132,7 +134,7 @@
|
|
|
132
134
|
//
|
|
133
135
|
// Mechanism: packages/grillhouse/docs/architecture/tests.md §3.3 (the modules of language), §3.4
|
|
134
136
|
// (the guards); `GRILLHOUSE_TESTS` and `GRILLHOUSE_RESULTATS` are data of a pass (tests.md §4.2),
|
|
135
|
-
// `
|
|
137
|
+
// `GRILLHOUSE_PRESSION_CPU` datum of the trials (read by the common pass),
|
|
136
138
|
// and the code applies no key of the project (installation.md §4.2) nor file of the post (§4.3).
|
|
137
139
|
import { spawnSync } from 'node:child_process';
|
|
138
140
|
import {
|
|
@@ -153,25 +155,24 @@ import { RESULTATS } from '../../resultats.mjs';
|
|
|
153
155
|
import {
|
|
154
156
|
A_REPASSER,
|
|
155
157
|
AttenteDeLaMachine,
|
|
156
|
-
attendreLeRepos,
|
|
157
158
|
surUnePart,
|
|
158
159
|
avecLaPasse,
|
|
159
160
|
cheminsDeLaTache,
|
|
160
161
|
construireDepuisLesArguments,
|
|
161
162
|
constructionDuGraphe,
|
|
162
|
-
ecrirePression,
|
|
163
163
|
gesteDuPackageJson,
|
|
164
164
|
GRAPHE_JOUE,
|
|
165
165
|
joueCeQuiNeSeDivisePas,
|
|
166
|
+
lancerEntiersEtFichiers,
|
|
166
167
|
lancerLesTaches,
|
|
168
|
+
lancerLesTests,
|
|
167
169
|
ligneDesRestes,
|
|
168
|
-
lirePression,
|
|
169
170
|
nomDuPaquet,
|
|
170
171
|
ouvrirBase,
|
|
171
172
|
retirerALInterruption,
|
|
172
173
|
SCRIPT_DES_TESTS,
|
|
173
174
|
SCRIPTS_DE_GARDES,
|
|
174
|
-
|
|
175
|
+
passeComplete,
|
|
175
176
|
testsCibles,
|
|
176
177
|
travailleursDeLaSeance,
|
|
177
178
|
} from '../../services-du-noyau.mjs';
|
|
@@ -208,10 +209,6 @@ const AUCUN_HORS_DU_POSTE = 'aucun test hors du poste';
|
|
|
208
209
|
const RACINE = '//';
|
|
209
210
|
// The task of the time budget benches of a crate.
|
|
210
211
|
const BUDGET = 'budget';
|
|
211
|
-
// The longest wait for rest before a bench, and the variable that sets it, in ms (a datum of the
|
|
212
|
-
// trials, as GRILLHOUSE_PRESSION_CPU).
|
|
213
|
-
const ATTENTE_DU_BANC_MS = 60_000;
|
|
214
|
-
const VARIABLE_ATTENTE = 'GRILLHOUSE_ATTENTE_REPOS_MS';
|
|
215
212
|
const VERROU = 'Cargo.lock';
|
|
216
213
|
// The commands that play the exact versions of the repository, refused without its Cargo.lock.
|
|
217
214
|
const VERROUILLEES = ['tests-du-paquet', 'verifier', 'tests-de-nuit'];
|
|
@@ -256,6 +253,7 @@ const COMPILATIONS = ['test', 'nextest', 'check', 'build'];
|
|
|
256
253
|
* this one, and its arguments as a guard. */
|
|
257
254
|
export const GARDES = [
|
|
258
255
|
{ nom: 'tailles-des-tests', args: [] },
|
|
256
|
+
{ nom: 'lectures-des-tests', args: [] },
|
|
259
257
|
{ nom: 'executables-de-tests', args: [] },
|
|
260
258
|
{ nom: 'clippy', args: [] },
|
|
261
259
|
{ nom: 'frontieres', args: [] },
|
|
@@ -274,16 +272,18 @@ export const commandes = () =>
|
|
|
274
272
|
// crate's name, the others as `<crate>::<nom>`, a binary, an example or a bench prefixed by kind.
|
|
275
273
|
function binaires(c) {
|
|
276
274
|
return Object.fromEntries(
|
|
277
|
-
c.cibles
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
275
|
+
c.cibles
|
|
276
|
+
.filter(t => t.kind[0] !== 'custom-build')
|
|
277
|
+
.map(t => {
|
|
278
|
+
const kind = t.kind[0];
|
|
279
|
+
if (kind === 'test') {
|
|
280
|
+
return [`${c.composant.nom}::${t.name}`, t.src];
|
|
281
|
+
}
|
|
282
|
+
if (['bin', 'example', 'bench'].includes(kind)) {
|
|
283
|
+
return [`${c.composant.nom}::${kind}/${t.name}`, t.src];
|
|
284
|
+
}
|
|
285
|
+
return [c.composant.nom, t.src];
|
|
286
|
+
})
|
|
287
287
|
);
|
|
288
288
|
}
|
|
289
289
|
|
|
@@ -296,22 +296,6 @@ function passe(racine, env) {
|
|
|
296
296
|
const cibles = {};
|
|
297
297
|
// Cargo compiles through sccache (./sccache.mjs).
|
|
298
298
|
const compilation = avecSccache(racine, env);
|
|
299
|
-
// The CPU pressure of the machine, the file <env> names or the kernel's.
|
|
300
|
-
const pression = () => lirePression(env.GRILLHOUSE_PRESSION_CPU || undefined);
|
|
301
|
-
// Waits for the rest of the machine before a bench, so that the load of the builds of the pass,
|
|
302
|
-
// once fallen, leaves a red bench red; at the bound, the bench plays all the same.
|
|
303
|
-
const attendre = () => {
|
|
304
|
-
const posee = env[VARIABLE_ATTENTE];
|
|
305
|
-
const borne = posee ? Number(posee) : ATTENTE_DU_BANC_MS;
|
|
306
|
-
if (!Number.isFinite(borne) || borne < 0) {
|
|
307
|
-
throw new Error(`⛔ ${VARIABLE_ATTENTE} : « ${posee} » n'est pas un temps en millisecondes.`);
|
|
308
|
-
}
|
|
309
|
-
attendreLeRepos({
|
|
310
|
-
lire: pression,
|
|
311
|
-
limite: Date.now() + borne,
|
|
312
|
-
dire: l => process.stderr.write(`${l}\n`),
|
|
313
|
-
});
|
|
314
|
-
};
|
|
315
299
|
const ecrire = () => {
|
|
316
300
|
if (!dossier) {
|
|
317
301
|
return;
|
|
@@ -363,11 +347,6 @@ function passe(racine, env) {
|
|
|
363
347
|
ecrire();
|
|
364
348
|
return t.code;
|
|
365
349
|
}
|
|
366
|
-
const banc = t.script === BUDGET;
|
|
367
|
-
if (banc) {
|
|
368
|
-
attendre();
|
|
369
|
-
}
|
|
370
|
-
const avant = banc ? pression() : null;
|
|
371
350
|
let r;
|
|
372
351
|
if (journal) {
|
|
373
352
|
// The output of cargo, both streams in their order, goes to the task's log, then to the
|
|
@@ -408,9 +387,6 @@ function passe(racine, env) {
|
|
|
408
387
|
process.stderr.write(`↳ ${t.paquet} : ${AUCUN_HORS_DU_POSTE}.\n`);
|
|
409
388
|
t.code = 0;
|
|
410
389
|
}
|
|
411
|
-
if (banc && t.code !== 0) {
|
|
412
|
-
sousCharge(t, [avant, pression()]);
|
|
413
|
-
}
|
|
414
390
|
ecrire();
|
|
415
391
|
return t.code;
|
|
416
392
|
},
|
|
@@ -456,25 +432,6 @@ export function executablesDeTest(sortie) {
|
|
|
456
432
|
return vus;
|
|
457
433
|
}
|
|
458
434
|
|
|
459
|
-
// A red of the time budget benches of the task <t>, the pressures <pressions> measured at its start
|
|
460
|
-
// and at its end: « à repasser » (75) when one is at or above the threshold, said; else its code
|
|
461
|
-
// stands, a pressure that does not read said.
|
|
462
|
-
function sousCharge(t, pressions) {
|
|
463
|
-
const lues = pressions.filter(p => p !== null);
|
|
464
|
-
if (lues.length === 0) {
|
|
465
|
-
process.stderr.write(`⏱ banc de temps de ${t.paquet} rouge, pression CPU illisible : rouge.\n`);
|
|
466
|
-
return;
|
|
467
|
-
}
|
|
468
|
-
const haute = Math.max(...lues);
|
|
469
|
-
if (haute < SEUIL_PRESSION) {
|
|
470
|
-
return;
|
|
471
|
-
}
|
|
472
|
-
process.stderr.write(
|
|
473
|
-
`⏱ banc de temps de ${t.paquet} rouge sous charge (pression CPU ${ecrirePression(haute)}, seuil ${SEUIL_PRESSION} %) : à repasser (${A_REPASSER}).\n`
|
|
474
|
-
);
|
|
475
|
-
t.code = A_REPASSER;
|
|
476
|
-
}
|
|
477
|
-
|
|
478
435
|
/**
|
|
479
436
|
* The arguments of nextest for the tranche <tranche> of a pass (`verifier --tranche i/n`): its own
|
|
480
437
|
* split, `--partition hash:i/n` (each test by the hash of its name, so the n tranches together
|
|
@@ -622,7 +579,9 @@ function jouerLesTests(
|
|
|
622
579
|
}
|
|
623
580
|
}
|
|
624
581
|
}
|
|
625
|
-
|
|
582
|
+
// The benches play in one measure part of the machine (`dansLaPartDeMesure`), apart from the
|
|
583
|
+
// tests: the function returned plays them, and carries their count.
|
|
584
|
+
const jouerLesBancs = () => {
|
|
626
585
|
// A crate whose build under the profile `test` failed builds no bench.
|
|
627
586
|
const construits = prevusBancs.filter(
|
|
628
587
|
b => b.etat.construit && p.jouer(...b.construction) === 0
|
|
@@ -630,13 +589,56 @@ function jouerLesTests(
|
|
|
630
589
|
for (const { tache, temporaire } of construits) {
|
|
631
590
|
p.jouer(tache, { junit, temporaire });
|
|
632
591
|
}
|
|
592
|
+
};
|
|
593
|
+
return {
|
|
594
|
+
bancs: prevusBancs.length,
|
|
595
|
+
jouerLesBancs,
|
|
633
596
|
// The copy keeps no test executable between two passes: cargo builds again the one it misses.
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
597
|
+
nettoyer() {
|
|
598
|
+
for (const f of executables) {
|
|
599
|
+
rmSync(f, { force: true });
|
|
600
|
+
}
|
|
601
|
+
},
|
|
637
602
|
};
|
|
638
603
|
}
|
|
639
604
|
|
|
605
|
+
// Plays <jouer> in the measure part of the machine, on dedicated cores (« Mesures de nuit »), judged
|
|
606
|
+
// by the common pass (`avecLaPasse` with `mesure`): its code, or, a wait that stops (an arbiter
|
|
607
|
+
// that does not answer, a bound), its reason said and its code. <jouer> is not called then.
|
|
608
|
+
function dansLaPartDeMesure(racine, env, jouer) {
|
|
609
|
+
try {
|
|
610
|
+
return avecLaPasse(jouer, {
|
|
611
|
+
lourde: false,
|
|
612
|
+
mesure: true,
|
|
613
|
+
env,
|
|
614
|
+
racine,
|
|
615
|
+
sorte: 'Mesures de nuit',
|
|
616
|
+
});
|
|
617
|
+
} catch (e) {
|
|
618
|
+
if (!(e instanceof AttenteDeLaMachine)) {
|
|
619
|
+
throw e;
|
|
620
|
+
}
|
|
621
|
+
process.stderr.write(`${e.message}\n`);
|
|
622
|
+
return e.code;
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
// Plays the benches of <jeu> (what `jouerLesTests` returns) in the measure part, when it holds some;
|
|
627
|
+
// the code of a part that did not play them, else 0. The executables of the run are removed after.
|
|
628
|
+
function jouerLesBancsEnPart(racine, env, jeu) {
|
|
629
|
+
try {
|
|
630
|
+
if (jeu.bancs === 0) {
|
|
631
|
+
return 0;
|
|
632
|
+
}
|
|
633
|
+
return dansLaPartDeMesure(racine, env, () => {
|
|
634
|
+
jeu.jouerLesBancs();
|
|
635
|
+
return 0;
|
|
636
|
+
});
|
|
637
|
+
} finally {
|
|
638
|
+
jeu.nettoyer();
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
|
|
640
642
|
// The selection of nextest of the crate <c> played whole in the day: none when it has no night
|
|
641
643
|
// test nor bench; else its library, its binaries and each other test target, named.
|
|
642
644
|
function duJour(c) {
|
|
@@ -803,7 +805,7 @@ function suiteDuGeste(racine, c) {
|
|
|
803
805
|
}
|
|
804
806
|
|
|
805
807
|
// The pass of `verifier` in <racine>, under the lock of the machine (<env> carries its mark): the
|
|
806
|
-
// tests of the crates as tasks of Turborepo (every one played for real with <args> `--tout`), then
|
|
808
|
+
// tests of the crates as tasks of Turborepo (every one played for real with <args> `--tout` or `--force`), then
|
|
807
809
|
// cargo deny. It keeps no green.
|
|
808
810
|
function verifier(racine, args, env) {
|
|
809
811
|
const p = passe(racine, env);
|
|
@@ -821,7 +823,7 @@ function verifier(racine, args, env) {
|
|
|
821
823
|
racine,
|
|
822
824
|
taches: [SCRIPT_DES_TESTS],
|
|
823
825
|
noms,
|
|
824
|
-
tests: testsCibles({ arguments: [], force: args
|
|
826
|
+
tests: testsCibles({ arguments: [], force: passeComplete(args) }),
|
|
825
827
|
env,
|
|
826
828
|
})
|
|
827
829
|
: 0;
|
|
@@ -991,7 +993,12 @@ export function lancer(nom, args, { racine = process.cwd(), env = process.env }
|
|
|
991
993
|
}
|
|
992
994
|
const tous = crates(racine);
|
|
993
995
|
if (nom === 'tester') {
|
|
994
|
-
|
|
996
|
+
// A path that names a bench plays on dedicated cores, as a measure named in the module typescript.
|
|
997
|
+
return surUnePart(e => tester(racine, tous, args, e), {
|
|
998
|
+
env,
|
|
999
|
+
racine,
|
|
1000
|
+
mesure: nommeUnBanc(racine, tous, args),
|
|
1001
|
+
});
|
|
995
1002
|
}
|
|
996
1003
|
if (nom === 'tests-du-paquet') {
|
|
997
1004
|
return sousLaBase('tests', env, (envBase, pp) =>
|
|
@@ -1005,6 +1012,21 @@ export function lancer(nom, args, { racine = process.cwd(), env = process.env }
|
|
|
1005
1012
|
return 2;
|
|
1006
1013
|
}
|
|
1007
1014
|
|
|
1015
|
+
// Whether a path of <args> names the file of a bench (a target `*_budget` or a module of
|
|
1016
|
+
// `tests/it_budget`): the run plays it in a measure part.
|
|
1017
|
+
function nommeUnBanc(racine, tous, args) {
|
|
1018
|
+
const chemins = args.filter(a => !a.startsWith('-'));
|
|
1019
|
+
if (chemins.length === 0) {
|
|
1020
|
+
return false;
|
|
1021
|
+
}
|
|
1022
|
+
const r = choisir(racine, tous, chemins);
|
|
1023
|
+
return Boolean(
|
|
1024
|
+
r.choix?.some(x =>
|
|
1025
|
+
x.cibles.some(n => x.c.cibles.some(t => t.name === n && horsDuJour(t) === 'banc'))
|
|
1026
|
+
)
|
|
1027
|
+
);
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1008
1030
|
// The pass of `tester` in <racine>, the crates <tous>, its arguments <args>, under <env>: the tasks
|
|
1009
1031
|
// `test:unit` of the crates the paths choose (every crate without a path) as Turborepo's, the
|
|
1010
1032
|
// exit code its.
|
|
@@ -1036,16 +1058,39 @@ function tester(racine, tous, args, env) {
|
|
|
1036
1058
|
if (noms.size === 0) {
|
|
1037
1059
|
return 0;
|
|
1038
1060
|
}
|
|
1039
|
-
return
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1061
|
+
return lancerEntiersEtFichiers({
|
|
1062
|
+
chemins: chemins.map(c => path.resolve(racine, c)),
|
|
1063
|
+
dossiers: tous.map(x => x.composant.dossier),
|
|
1064
|
+
options,
|
|
1065
|
+
force: passeComplete(args),
|
|
1066
|
+
lancer: ({ chemins: lot, tests }) => {
|
|
1067
|
+
const duLot = lot.length
|
|
1068
|
+
? nomsDuGraphe(
|
|
1069
|
+
racine,
|
|
1070
|
+
choisir(racine, tous, lot).choix.map(x => x.c)
|
|
1071
|
+
).noms
|
|
1072
|
+
: noms;
|
|
1073
|
+
// In an envelope, a crate it shows read-only arrives built (`lancerLesTests`).
|
|
1074
|
+
return duLot.size
|
|
1075
|
+
? lancerLesTests({
|
|
1076
|
+
racine,
|
|
1077
|
+
filtres: [...duLot].sort().map(n => `--filter=${n}`),
|
|
1078
|
+
tests,
|
|
1079
|
+
env,
|
|
1080
|
+
lancer: (args, avecTests) =>
|
|
1081
|
+
lancerLesTaches({
|
|
1082
|
+
outil: OUTIL,
|
|
1083
|
+
racine,
|
|
1084
|
+
taches: args.filter(a => !a.startsWith('--filter=')),
|
|
1085
|
+
noms: args
|
|
1086
|
+
.filter(a => a.startsWith('--filter='))
|
|
1087
|
+
.map(a => a.slice('--filter='.length)),
|
|
1088
|
+
tests: avecTests,
|
|
1089
|
+
env,
|
|
1090
|
+
}),
|
|
1091
|
+
})
|
|
1092
|
+
: 0;
|
|
1093
|
+
},
|
|
1049
1094
|
});
|
|
1050
1095
|
}
|
|
1051
1096
|
|
|
@@ -1075,16 +1120,17 @@ function testsDuPaquet(racine, tous, args, env, parPaquet) {
|
|
|
1075
1120
|
return 2;
|
|
1076
1121
|
}
|
|
1077
1122
|
const p = passe(racine, env);
|
|
1078
|
-
jouerLesTests(
|
|
1123
|
+
const jeu = jouerLesTests(
|
|
1079
1124
|
racine,
|
|
1080
1125
|
p,
|
|
1081
1126
|
r.choix,
|
|
1082
1127
|
[...args.filter(a => a.startsWith('-')), ...options],
|
|
1083
1128
|
parPaquet.temporaire,
|
|
1084
1129
|
tranche
|
|
1085
|
-
)
|
|
1130
|
+
);
|
|
1131
|
+
const arret = jouerLesBancsEnPart(racine, env, jeu);
|
|
1086
1132
|
restesParPaquet(p, r.choix, parPaquet);
|
|
1087
|
-
return p.code();
|
|
1133
|
+
return plier(p.code(), arret);
|
|
1088
1134
|
}
|
|
1089
1135
|
|
|
1090
1136
|
// The line of the guard of each crate of <choix> whose tests left something in its temporary
|
|
@@ -1104,6 +1150,7 @@ function restesParPaquet(p, choix, parPaquet) {
|
|
|
1104
1150
|
// benches of each crate that holds some, each named.
|
|
1105
1151
|
function testsDeNuit(racine, tous, env, parPaquet, args = []) {
|
|
1106
1152
|
const p = passe(racine, env);
|
|
1153
|
+
let arret = 0;
|
|
1107
1154
|
const nuit = {
|
|
1108
1155
|
horsDuPoste: args.includes('--hors-du-poste'),
|
|
1109
1156
|
sansEquipement: args.includes('--sans-equipement'),
|
|
@@ -1137,12 +1184,19 @@ function testsDeNuit(racine, tous, env, parPaquet, args = []) {
|
|
|
1137
1184
|
})
|
|
1138
1185
|
.filter(x => x.cibles.length);
|
|
1139
1186
|
if (choix.length) {
|
|
1140
|
-
jouerLesTests(racine, p, choix, [], parPaquet.temporaire, null, nuit.horsDuPoste)
|
|
1187
|
+
const jeu = jouerLesTests(racine, p, choix, [], parPaquet.temporaire, null, nuit.horsDuPoste);
|
|
1188
|
+
arret = jouerLesBancsEnPart(racine, env, jeu);
|
|
1141
1189
|
restesParPaquet(p, choix, parPaquet);
|
|
1142
1190
|
} else if (nuit.horsDuPoste) {
|
|
1143
1191
|
process.stderr.write(`↳ cargo : ${AUCUN_HORS_DU_POSTE}.\n`);
|
|
1144
1192
|
}
|
|
1145
|
-
return p.code();
|
|
1193
|
+
return plier(p.code(), arret);
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
// The code of a pass whose tasks end at <code> and whose measure part ends at <arret>: a red of the
|
|
1197
|
+
// tasks first, else the code of the part.
|
|
1198
|
+
function plier(code, arret) {
|
|
1199
|
+
return code === 0 ? arret : code;
|
|
1146
1200
|
}
|
|
1147
1201
|
|
|
1148
1202
|
if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
@@ -60,6 +60,7 @@ import { enRetard, entreesDeLIndex, SORTIE } from './index-interfaces.mjs';
|
|
|
60
60
|
import { miseAJour } from './mise-a-jour.mjs';
|
|
61
61
|
import * as taillesDesTests from './migrations/0.28.4-tailles-des-tests.mjs';
|
|
62
62
|
import * as executablesDeTests from './migrations/0.34.0-executables-de-tests.mjs';
|
|
63
|
+
import * as lecturesDeDocuments from './migrations/lectures-des-tests.mjs';
|
|
63
64
|
import { squelette } from './squelette.mjs';
|
|
64
65
|
import { CACHE, CIBLES, DOSSIER_DU_LANCEUR } from './sccache.mjs';
|
|
65
66
|
import { echecDeCompilation, verdict } from './verdict.mjs';
|
|
@@ -162,7 +163,7 @@ export default {
|
|
|
162
163
|
],
|
|
163
164
|
entreesDeLIndex,
|
|
164
165
|
gardes: () => GARDES.map(({ script, args }) => [script, ...args]),
|
|
165
|
-
migrations: [taillesDesTests, executablesDeTests],
|
|
166
|
+
migrations: [taillesDesTests, executablesDeTests, lecturesDeDocuments],
|
|
166
167
|
miseAJour,
|
|
167
168
|
squelette,
|
|
168
169
|
};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// The readings of a document or of a source by the tests, on the model of « Change-Detector Tests
|
|
3
|
+
// Considered Harmful » (Google): a test proves a behaviour by its interface; one that reads the
|
|
4
|
+
// text of a document or of a file of code detects a change of wording, not a failure. The guard
|
|
5
|
+
// `lectures-des-tests` (packages/grillhouse/docs/architecture/tests.md §3.4).
|
|
6
|
+
//
|
|
7
|
+
// npx grillhouse lectures-des-tests run from the repository root (a guard of grillhouse:gardes)
|
|
8
|
+
//
|
|
9
|
+
// - The test files are those of ./tailles-des-tests.mjs (`tailles`). A finding,
|
|
10
|
+
// `{ fichier, regle: 'lecture-de-document-ou-de-code', message }`, is a test (or a file under a
|
|
11
|
+
// directory `tests/`) with a call
|
|
12
|
+
// `include_str!`, `include_bytes!`, `fs::read_to_string` or `fs::read` whose path is a string, a
|
|
13
|
+
// constant of the file, or a `Path::new` / `PathBuf::from` of a string (a `.join` of strings
|
|
14
|
+
// after it), and names an existing `.md` or code file (`.ts`, `.mjs`, `.js`, `.rs`, `.py`,
|
|
15
|
+
// `.sh`) of the repository, resolved from the root or from the directory of the test. A manifest,
|
|
16
|
+
// a datum, a template, a flow of CI, a generated reference and a file the test creates in a
|
|
17
|
+
// temporary folder are no finding; a path built at run time that the guard does not resolve is
|
|
18
|
+
// none either.
|
|
19
|
+
// - A reading allowed carries `// @lit-source: <raison>` in the head comment of the test (the shared
|
|
20
|
+
// judgment: ../../services-du-noyau.mjs, lectures-communes.mjs); a label without a reason is refused.
|
|
21
|
+
// - A finding inscribed in the project's debt (`grillhouse-dette.json`, ../../dette.mjs) passes: those
|
|
22
|
+
// that exist when the guard arrives are inscribed by the update
|
|
23
|
+
// (./migrations/lectures-des-tests.mjs), the count never rises, and a new one is refused.
|
|
24
|
+
import { globSync } from 'node:fs';
|
|
25
|
+
import path from 'node:path';
|
|
26
|
+
import { pathToFileURL } from 'node:url';
|
|
27
|
+
import { trancher } from '../../dette.mjs';
|
|
28
|
+
import { analyse, constatsDesLectures } from '../../services-du-noyau.mjs';
|
|
29
|
+
import { tailles } from './tailles-des-tests.mjs';
|
|
30
|
+
|
|
31
|
+
const { argumentsDuAppel, expressionDepuis, joindre, sansCommentaires } = analyse;
|
|
32
|
+
|
|
33
|
+
export const GARDE = 'lectures-des-tests-cargo';
|
|
34
|
+
|
|
35
|
+
// A macro or a call that reads the content of a file.
|
|
36
|
+
const LECTURE =
|
|
37
|
+
/(?<![\w])(?:include_str!|include_bytes!|(?:(?:std::)?fs::)(?:read_to_string|read))\s*\(/g;
|
|
38
|
+
const IDENTIFIANT = /^[A-Za-z_]\w*$/;
|
|
39
|
+
const CHAINE = /^r(#*)"(.*)"\1$/s;
|
|
40
|
+
const CHEMIN = /^(?:(?:std::)?path::)?(?:Path::new|PathBuf::from)\s*\(/;
|
|
41
|
+
|
|
42
|
+
// The index of the top-level `.join(` of <e> that closes <e>, -1 for none.
|
|
43
|
+
function dernierJoin(e) {
|
|
44
|
+
let profondeur = 0;
|
|
45
|
+
let dernier = -1;
|
|
46
|
+
for (let i = 0; i < e.length; i++) {
|
|
47
|
+
const ch = e[i];
|
|
48
|
+
if (ch === '"') {
|
|
49
|
+
i = e.indexOf('"', i + 1);
|
|
50
|
+
if (i < 0) {
|
|
51
|
+
return -1;
|
|
52
|
+
}
|
|
53
|
+
} else if (ch === '(' || ch === '[') {
|
|
54
|
+
profondeur++;
|
|
55
|
+
} else if (ch === ')' || ch === ']') {
|
|
56
|
+
profondeur--;
|
|
57
|
+
} else if (profondeur === 0 && e.startsWith('.join(', i)) {
|
|
58
|
+
dernier = i;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return dernier;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// The path an expression of <texte> names, null when the guard does not resolve it.
|
|
65
|
+
function chemin(expr, texte, profondeur = 0) {
|
|
66
|
+
if (profondeur > 6) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
const e = expr.trim().replace(/^&\s*/, '');
|
|
70
|
+
const c = CHAINE.exec(e);
|
|
71
|
+
if (c) {
|
|
72
|
+
return c[2];
|
|
73
|
+
}
|
|
74
|
+
if (/^"(?:[^"\\]|\\.)*"$/s.test(e)) {
|
|
75
|
+
return e.slice(1, -1);
|
|
76
|
+
}
|
|
77
|
+
if (IDENTIFIANT.test(e)) {
|
|
78
|
+
const m = new RegExp(`(?:const|static)\\s+${e}\\s*:[^=;]+=\\s*`).exec(texte);
|
|
79
|
+
return m ? chemin(expressionDepuis(texte, m.index + m[0].length), texte, profondeur + 1) : null;
|
|
80
|
+
}
|
|
81
|
+
const j = dernierJoin(e);
|
|
82
|
+
if (j > 0 && e.endsWith(')')) {
|
|
83
|
+
const args = argumentsDuAppel(e, j + '.join'.length);
|
|
84
|
+
return args.length === 1
|
|
85
|
+
? joindre([
|
|
86
|
+
chemin(e.slice(0, j), texte, profondeur + 1),
|
|
87
|
+
chemin(args[0], texte, profondeur + 1),
|
|
88
|
+
])
|
|
89
|
+
: null;
|
|
90
|
+
}
|
|
91
|
+
const p = CHEMIN.exec(e);
|
|
92
|
+
if (p && e.endsWith(')')) {
|
|
93
|
+
const args = argumentsDuAppel(e, p[0].length - 1);
|
|
94
|
+
return args.length === 1 ? chemin(args[0], texte, profondeur + 1) : null;
|
|
95
|
+
}
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** The files <lire> accepts among those the test <texte> reads. */
|
|
100
|
+
function lectures(texte, _test, lire) {
|
|
101
|
+
const c = sansCommentaires(texte, { bloc: true });
|
|
102
|
+
return [...c.matchAll(LECTURE)].map(m => {
|
|
103
|
+
const [premier] = argumentsDuAppel(c, m.index + m[0].length - 1);
|
|
104
|
+
const v = premier === undefined ? null : chemin(premier, c);
|
|
105
|
+
return v === null ? null : lire(v);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* The findings of the workspace at <racine>: one `{ fichier, regle, message }` per test that
|
|
111
|
+
* reads a document or a file of code of the repository, in the debt's form (../../dette.mjs).
|
|
112
|
+
*/
|
|
113
|
+
export function verifier(racine) {
|
|
114
|
+
const sous = globSync('**/tests/**/*.rs', {
|
|
115
|
+
cwd: racine,
|
|
116
|
+
exclude: d => ['target', 'node_modules', '.git'].includes(String(d).split('/').pop()),
|
|
117
|
+
}).map(f => f.split(path.sep).join('/'));
|
|
118
|
+
const tests = [...new Set([...tailles(racine).map(t => t.fichier), ...sous])].sort();
|
|
119
|
+
return constatsDesLectures(racine, tests, lectures);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) {
|
|
123
|
+
const racine = process.cwd();
|
|
124
|
+
const { refus, lignes } = trancher(racine, GARDE, verifier(racine));
|
|
125
|
+
for (const r of refus) {
|
|
126
|
+
process.stderr.write(`⛔ ${r.message}\n`);
|
|
127
|
+
}
|
|
128
|
+
for (const l of lignes) {
|
|
129
|
+
process.stderr.write(`${l}\n`);
|
|
130
|
+
}
|
|
131
|
+
process.exitCode = refus.length ? 1 : 0;
|
|
132
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// The migration of the guard of the readings of the tests
|
|
2
|
+
// (scripts/langages/cargo/lectures-des-tests.mjs): it inscribes the tests that read the content of a
|
|
3
|
+
// document or of a file of code of the repository as the project's known debt (scripts/dette.mjs),
|
|
4
|
+
// frozen: the count never rises and a new one is refused. Migrations:
|
|
5
|
+
// packages/grillhouse/docs/architecture/installation.md §5.4; the guard: tests.md §3.4.
|
|
6
|
+
//
|
|
7
|
+
// - The migration writes the section of the guard in `grillhouse-dette.json` when the guard finds
|
|
8
|
+
// one and the file holds no section of it yet; the rest of the debt stays.
|
|
9
|
+
// - It rewrites no test of the project.
|
|
10
|
+
// - Replayable without effect: once the section is written, nothing.
|
|
11
|
+
import { FICHIER, lire, trancher } from '../../../dette.mjs';
|
|
12
|
+
import { GARDE, verifier } from '../lectures-des-tests.mjs';
|
|
13
|
+
|
|
14
|
+
// Not released yet: the release command numbers it.
|
|
15
|
+
export const version = '0.55.0';
|
|
16
|
+
export const nom = 'lectures des tests';
|
|
17
|
+
|
|
18
|
+
/** Inscribes the readings of a document or of a source by the tests of the project at <projet>; what it did. */
|
|
19
|
+
export function migrer(projet) {
|
|
20
|
+
if (lire(projet)[GARDE]) {
|
|
21
|
+
return [];
|
|
22
|
+
}
|
|
23
|
+
const constats = verifier(projet);
|
|
24
|
+
if (constats.length === 0) {
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
trancher(projet, GARDE, constats, 'inscrire', {});
|
|
28
|
+
return [
|
|
29
|
+
`${FICHIER} : ${constats.length} test(s) qui lisent le contenu d'un document ou d'un fichier de code, inscrit(s) dans la dette de ${GARDE}, gelée ; un neuf est refusé, et un test importe l'interface au lieu de lire un texte`,
|
|
30
|
+
];
|
|
31
|
+
}
|