Skip to main content

unityrs_testkit/env/catalog/
mod.rs

1// Ported from UnityPy 1.25.2 (MIT): UnityPy/environment.py, UnityPy/classes/PPtr.py, UnityPy/files/SerializedFile.py. See THIRD_PARTY_LICENSES.
2//! The scenes, one function each, and [`scenes`], which lists them by
3//! name for `tools/fixtures/env.py`.
4
5mod find;
6mod nested;
7mod race;
8mod revisit;
9
10pub use find::{FindAsk, FindScene, find_file_kinds, find_file_listing, find_scenes, web_file};
11pub use nested::{
12    dependency_reads, deref_sibling_nested, nested_between_loads, nested_dropped_evicted,
13    nested_duplicates, nested_evicted, nested_raw_replaced, nested_reloaded, nested_reloaded_spans,
14    nested_reloaded_spans_raced, nested_replaced_unread, preload_nested_external,
15    resource_in_nested_cab, resource_in_own_nested,
16};
17pub use race::{listings, listings_raced, race_scenes};
18pub use revisit::{preload_revisits_after_load, preload_revisits_ahead};
19
20use super::{Bundle, DepScene, Obj, Scene, bundle, bundle_spec, res_bytes, row, serialized};
21use crate::bundle::{BlockOverride, TestCodec};
22
23fn named(name: &str, data: Vec<u8>) -> (Vec<u8>, Vec<u8>) {
24    (name.as_bytes().to_vec(), data)
25}
26
27/// Two bundles: an object in the first points (`m_FileID` 1) at an object in
28/// the second's CAB; the first also holds a `.resS` the object reads.
29#[must_use]
30pub fn cross_bundle_pointer() -> Scene {
31    let cab_a = serialized(
32        &["archive:/CAB-B/CAB-B"],
33        &[
34            Obj::named(1, "a1", &[(1, 7), (0, 2)]),
35            Obj::streamed(2, "tex", "archive:/CAB-A/CAB-A.resS", 4, 8),
36            Obj::asset_bundle(
37                3,
38                Bundle {
39                    preload: vec![(1, 7), (0, 2)],
40                    rows: vec![row("assets/a1.prefab", (0, 2), (0, 1))],
41                    ..Bundle::default()
42                },
43            ),
44        ],
45    );
46    let cab_b = serialized(&[], &[Obj::named(7, "b7", &[])]);
47    Scene {
48        files: vec![
49            named(
50                "a.bundle",
51                bundle(&[("CAB-A", cab_a), ("CAB-A.resS", res_bytes(32, 0))]),
52            ),
53            named("b.bundle", bundle(&[("CAB-B", cab_b)])),
54        ],
55        resolver: Vec::new(),
56    }
57}
58
59/// Two loose `SerializedFile`s loaded at top level under names with
60/// directories (`a/CAB-A`, `b/CAB-B`): an object in A points (`m_FileID` 1,
61/// external `archive:/CAB-B/CAB-B`) at an object in B. The pointer resolves,
62/// as in UnityPy, whose Environment is a top-level file's container
63/// (`find_file` finds `cab-b`); without B it is `DerefError::NotFound`.
64#[must_use]
65pub fn loose_external_pointer() -> Scene {
66    Scene {
67        files: vec![
68            named(
69                "a/CAB-A",
70                serialized(&["archive:/CAB-B/CAB-B"], &[Obj::named(1, "a1", &[(1, 5)])]),
71            ),
72            named("b/CAB-B", serialized(&[], &[Obj::named(5, "b5", &[])])),
73        ],
74        resolver: Vec::new(),
75    }
76}
77
78/// One bundle whose first CAB holds a pointer for every dereference rule:
79/// null, a missing path id, `m_FileID` past the end, a negative id in range
80/// and one below it, `i32::MIN`, an external nobody has, a raw sibling, a
81/// sibling matched by its lower-cased name, and one found by `find_file`
82/// under a key with a directory.
83#[must_use]
84pub fn deref_rules() -> Scene {
85    let externals = [
86        "archive:/CAB-RAW/CAB-RAW.resS",
87        "archive:/CAB-MISSING/CAB-MISSING",
88        "archive:/CAB-E2/Cab-E2",
89        "archive:/elsewhere/CAB-D",
90    ];
91    let cab_e = serialized(
92        &externals,
93        &[Obj::named(
94            1,
95            "e1",
96            &[
97                (0, 0),
98                (0, 99),
99                (5, 1),
100                (-1, 11),
101                (-5, 1),
102                (i32::MIN, 1),
103                (2, 1),
104                (1, 1),
105                (3, 9),
106                (3, 10),
107                (4, 11),
108                (0, 1),
109            ],
110        )],
111    );
112    Scene {
113        files: vec![named(
114            "e.bundle",
115            bundle(&[
116                ("CAB-E", cab_e),
117                ("CAB-RAW.resS", res_bytes(16, 3)),
118                ("CAB-E2", serialized(&[], &[Obj::named(9, "e9", &[])])),
119                ("dir/CAB-D", serialized(&[], &[Obj::named(11, "d11", &[])])),
120            ]),
121        )],
122        resolver: Vec::new(),
123    }
124}
125
126/// A bundle of a good CAB, its `.resS` and a CAB that fails to parse: the
127/// load fails, `files` stays empty, and the first two are registered.
128#[must_use]
129pub fn bad_cab() -> Scene {
130    let good = serialized(
131        &[],
132        &[
133            Obj::named(1, "g1", &[]),
134            Obj::streamed(2, "tex", "archive:/CAB-G/CAB-G.resS", 0, 4),
135        ],
136    );
137    // An AssetBundle without `m_Container`: UnityPy's object-mode read at
138    // parse (`files/SerializedFile.py:316-321`) fails the file.
139    let bad = serialized(
140        &[],
141        &[Obj::asset_bundle(
142            1,
143            Bundle {
144                no_container: true,
145                ..Bundle::default()
146            },
147        )],
148    );
149    Scene {
150        files: vec![named(
151            "g.bundle",
152            bundle(&[
153                ("CAB-G", good),
154                ("CAB-G.resS", res_bytes(16, 7)),
155                ("CAB-BAD", bad),
156            ]),
157        )],
158        resolver: Vec::new(),
159    }
160}
161
162/// A bundle whose second entry is a bundle under the path of the first,
163/// a CAB (plan 3.13 (b)).
164#[must_use]
165pub fn nested_after_cab() -> Scene {
166    let inner = bundle(&[("CAB-INNER", serialized(&[], &[Obj::named(2, "inner", &[])]))]);
167    Scene {
168        files: vec![named(
169            "n.bundle",
170            bundle(&[
171                ("CAB-N", serialized(&[], &[Obj::named(1, "n1", &[])])),
172                ("CAB-N", inner),
173            ]),
174        )],
175        resolver: Vec::new(),
176    }
177}
178
179/// A bundle with a block after its last entry's bytes that fails to decode
180/// (plan 3.13 (c)).
181#[must_use]
182pub fn last_block_fails() -> Scene {
183    let mut spec = bundle_spec(&[("CAB-L", serialized(&[], &[Obj::named(1, "l1", &[(0, 1)])]))]);
184    let blocks = spec
185        .entries
186        .iter()
187        .map(|e| e.data.len())
188        .sum::<usize>()
189        .div_ceil(spec.block_size);
190    spec.block_overrides.push(BlockOverride {
191        block: blocks,
192        // An id no codec has: UnityPy's `CompressionFlags(9)` raises.
193        codec: Some(TestCodec::Raw(9)),
194        uncompressed: Some(16),
195        compressed: None,
196    });
197    Scene {
198        files: vec![named("l.bundle", crate::bundle::build(&spec))],
199        resolver: Vec::new(),
200    }
201}
202
203/// A container whose preload table points every way the preload skips:
204/// past the externals, at a file nobody has, at a missing object, null,
205/// and rows whose spans fall outside the table.
206#[must_use]
207pub fn preload_skips() -> Scene {
208    let skipped = serialized(
209        &["archive:/CAB-NONE/CAB-NONE"],
210        &[
211            Obj::named(1, "p1", &[]),
212            Obj::asset_bundle(
213                2,
214                Bundle {
215                    preload: vec![(0, 1), (9, 1), (1, 1), (0, 77), (0, 0)],
216                    rows: vec![
217                        row("assets/p1.prefab", (0, 5), (0, 1)),
218                        row("assets/out.prefab", (3, 9), (0, 1)),
219                        row("assets/neg.prefab", (-1, 2), (0, 1)),
220                    ],
221                    ..Bundle::default()
222                },
223            ),
224        ],
225    );
226    Scene {
227        files: vec![named("p.bundle", bundle(&[("CAB-P", skipped)]))],
228        resolver: Vec::new(),
229    }
230}
231
232/// A preload pointer below the externals: `IndexError`, raised.
233#[must_use]
234pub fn preload_below_start() -> Scene {
235    let file = serialized(
236        &["archive:/CAB-NONE/CAB-NONE"],
237        &[
238            Obj::named(1, "q1", &[]),
239            Obj::asset_bundle(
240                2,
241                Bundle {
242                    preload: vec![(-3, 1)],
243                    rows: vec![row("assets/q1.prefab", (0, 1), (0, 1))],
244                    ..Bundle::default()
245                },
246            ),
247        ],
248    );
249    Scene {
250        files: vec![named("q.bundle", bundle(&[("CAB-Q", file)]))],
251        resolver: Vec::new(),
252    }
253}
254
255/// A preload pointer at a raw sibling: `AttributeError`, raised.
256#[must_use]
257pub fn preload_raw_target() -> Scene {
258    let file = serialized(
259        &["archive:/CAB-R/CAB-R.resS"],
260        &[
261            Obj::named(1, "r1", &[]),
262            Obj::asset_bundle(
263                2,
264                Bundle {
265                    preload: vec![(1, 1)],
266                    rows: vec![row("assets/r1.prefab", (0, 1), (0, 1))],
267                    ..Bundle::default()
268                },
269            ),
270        ],
271    );
272    Scene {
273        files: vec![named(
274            "r.bundle",
275            bundle(&[("CAB-R", file), ("CAB-R.resS", res_bytes(8, 1))]),
276        )],
277        resolver: Vec::new(),
278    }
279}
280
281/// `AssetBundle`s read in object mode: two fields whose names clean to one
282/// key (the last wins), one without `m_MainAsset` (`UnknownObject`), and
283/// one without `m_Container` (the file fails).
284#[must_use]
285pub fn asset_bundle_modes() -> Scene {
286    let shadow = serialized(
287        &[],
288        &[
289            Obj::named(1, "s1", &[]),
290            Obj::asset_bundle(
291                2,
292                Bundle {
293                    rows: vec![row("assets/first.prefab", (0, 0), (0, 1))],
294                    shadow_container: Some(vec![
295                        row("assets/second.prefab", (0, 0), (0, 1)),
296                        row("assets/third.prefab", (0, 0), (0, 2)),
297                    ]),
298                    ..Bundle::default()
299                },
300            ),
301        ],
302    );
303    let unknown = serialized(
304        &[],
305        &[
306            Obj::named(1, "u1", &[]),
307            Obj::asset_bundle(
308                2,
309                Bundle {
310                    rows: vec![row("assets/u1.prefab", (0, 0), (0, 1))],
311                    no_main_asset: true,
312                    ..Bundle::default()
313                },
314            ),
315        ],
316    );
317    let missing = serialized(
318        &[],
319        &[
320            Obj::named(1, "m1", &[]),
321            Obj::asset_bundle(
322                2,
323                Bundle {
324                    no_container: true,
325                    ..Bundle::default()
326                },
327            ),
328        ],
329    );
330    Scene {
331        files: vec![
332            named("shadow.bundle", bundle(&[("CAB-S", shadow)])),
333            named("unknown.bundle", bundle(&[("CAB-U", unknown)])),
334            named("missing.bundle", bundle(&[("CAB-M", missing)])),
335        ],
336        resolver: Vec::new(),
337    }
338}
339
340/// A loaded bundle whose CAB points at, and reads a resource from, files
341/// only the resolver has: `find_file` loads `cab-dep`'s bundle as a
342/// dependency (a container, so the pointer has no target), whose own copy of
343/// `CAB-H` then replaces the loaded one's key, and `cab-loose`, a
344/// `SerializedFile` it resolves into; the resource fallback loads
345/// `CAB-H2.resS` under the name it asked for, twice (the first and last
346/// candidates are one name).
347#[must_use]
348pub fn resolver_loads() -> Scene {
349    let cab_h = |name: &str| {
350        serialized(
351            &["archive:/CAB-DEP/CAB-DEP", "archive:/CAB-LOOSE/CAB-LOOSE"],
352            &[
353                Obj::named(1, name, &[(1, 3), (2, 5)]),
354                Obj::streamed(2, "tex", "archive:/CAB-H2/CAB-H2.resS", 2, 6),
355                Obj::asset_bundle(
356                    4,
357                    Bundle {
358                        rows: vec![row(&format!("assets/{name}.prefab"), (0, 0), (0, 1))],
359                        ..Bundle::default()
360                    },
361                ),
362            ],
363        )
364    };
365    let dep = bundle(&[
366        ("CAB-DEP", serialized(&[], &[Obj::named(3, "dep3", &[])])),
367        ("CAB-H", cab_h("h-copy")),
368    ]);
369    Scene {
370        files: vec![named("h.bundle", bundle(&[("CAB-H", cab_h("h1"))]))],
371        resolver: vec![
372            // Lower-case: `find_file` asks for the cleaned (lower-cased)
373            // external name, and UnityPy finds only an exact file name
374            // (its walk keys a lower-cased path its open then misses).
375            named("cab-dep", dep),
376            named(
377                "cab-loose",
378                serialized(&[], &[Obj::named(5, "loose5", &[])]),
379            ),
380            named("CAB-H2.resS", res_bytes(24, 9)),
381        ],
382    }
383}
384
385/// A loose file whose preload pointer names a CAB only the resolver has:
386/// the container pass's `find_file` registers it, and UnityPy's loop over
387/// `env.cabs` raises `RuntimeError` (the dict changed size); the next pass
388/// ends.
389#[must_use]
390pub fn preload_loads_new_cab() -> Scene {
391    let file = serialized(
392        &["archive:/CAB-NEW/CAB-NEW"],
393        &[
394            Obj::named(1, "x1", &[]),
395            Obj::asset_bundle(
396                2,
397                Bundle {
398                    preload: vec![(1, 3)],
399                    rows: vec![row("assets/x1.prefab", (0, 1), (0, 1))],
400                    ..Bundle::default()
401                },
402            ),
403        ],
404    );
405    Scene {
406        files: vec![named("x/CAB-X", file)],
407        resolver: vec![named(
408            "cab-new",
409            serialized(&[], &[Obj::named(3, "new3", &[])]),
410        )],
411    }
412}
413
414/// Container paths (`obj.container`): rows whose spans overlap (the first
415/// row to reach an object gives its path), a row's own asset (which beats
416/// any span), two rows of one asset (the last wins), and a span reaching an
417/// object in a sibling CAB.
418#[must_use]
419pub fn preload_paths() -> Scene {
420    let pp = serialized(
421        &["archive:/CAB-PQ/CAB-PQ"],
422        &[
423            Obj::named(1, "p1", &[]),
424            Obj::named(2, "p2", &[]),
425            Obj::named(3, "p3", &[]),
426            Obj::named(4, "p4", &[]),
427            Obj::named(5, "p5", &[]),
428            Obj::asset_bundle(
429                9,
430                Bundle {
431                    preload: vec![(0, 1), (0, 2), (0, 3), (1, 7), (0, 4)],
432                    rows: vec![
433                        row("assets/a.prefab", (0, 3), (0, 1)),
434                        row("assets/b.prefab", (1, 4), (0, 2)),
435                        row("assets/c.prefab", (0, 0), (0, 5)),
436                        row("assets/d.prefab", (0, 0), (0, 5)),
437                    ],
438                    ..Bundle::default()
439                },
440            ),
441        ],
442    );
443    let pq = serialized(&[], &[Obj::named(7, "q7", &[])]);
444    Scene {
445        files: vec![named(
446            "pp.bundle",
447            bundle(&[("CAB-PP", pp), ("CAB-PQ", pq)]),
448        )],
449        resolver: Vec::new(),
450    }
451}
452
453/// A container row whose asset is in another file (`m_FileID` 1): UnityPy
454/// keys its path by path id alone, so the object of that path id in the
455/// container's own file gets it; the core keys only a row whose asset is in
456/// the container's own file (`PARITY.md` section 19.2), so neither file's
457/// object does.
458#[must_use]
459pub fn container_other_file() -> Scene {
460    let of = serialized(
461        &["archive:/CAB-OG/CAB-OG"],
462        &[
463            Obj::named(1, "of1", &[]),
464            Obj::asset_bundle(
465                9,
466                Bundle {
467                    rows: vec![row("assets/other.prefab", (0, 0), (1, 1))],
468                    ..Bundle::default()
469                },
470            ),
471        ],
472    );
473    let og = serialized(&[], &[Obj::named(1, "og1", &[])]);
474    Scene {
475        files: vec![named(
476            "of.bundle",
477            bundle(&[("CAB-OF", of), ("CAB-OG", og)]),
478        )],
479        resolver: Vec::new(),
480    }
481}
482
483/// A resource read's fallback loads, through the resolver, a file whose
484/// object points (`m_FileID` 1) at a CAB of the loaded bundle. UnityPy's
485/// `load_file` parses the fallback's file with the Environment as its
486/// container (`environment.py:107-108`, `:154`), so the pointer resolves as
487/// a top-level file's does.
488#[must_use]
489pub fn fallback_file_pointer() -> Scene {
490    let f = serialized(
491        &["LOOSE-T"],
492        &[Obj::streamed(1, "tex", "archive:/CAB-R/CAB-R.resS", 0, 4)],
493    );
494    let t = serialized(&[], &[Obj::named(5, "t5", &[])]);
495    Scene {
496        files: vec![named("f.bundle", bundle(&[("CAB-F", f), ("CAB-T", t)]))],
497        resolver: vec![named(
498            "LOOSE-T",
499            serialized(&["archive:/CAB-T/CAB-T"], &[Obj::named(4, "l4", &[(1, 5)])]),
500        )],
501    }
502}
503
504/// A preload whose externals UnityPy's `find_file` reaches two ways: `H`
505/// (`xab.assets`) by the registry, where a caller's copy holds the key, and
506/// `A` (`ab.assets`) by its walk's suffix match (`environment.py:345-354`),
507/// which loads the resolver's `xab.assets` under that name, so the name
508/// asked misses again: every dereference of `A` loads a new copy, which
509/// takes the key, and the next dereference of `H` finds that copy. One row
510/// spans `H`, `A`, `H`, `A` (path ids 5, 5, 6, 7): the caller's copy gets 5
511/// alone, the last copy 7 alone (review round 2: the walk kept its first
512/// answer for each external).
513#[must_use]
514pub fn preload_suffix_external() -> Scene {
515    let x = |prefix: &str| {
516        serialized(
517            &[],
518            &[
519                Obj::named(5, &format!("{prefix}5"), &[]),
520                Obj::named(6, &format!("{prefix}6"), &[]),
521                Obj::named(7, &format!("{prefix}7"), &[]),
522            ],
523        )
524    };
525    let r = serialized(
526        &["archive:/CAB-B/xab.assets", "archive:/CAB-B/ab.assets"],
527        &[
528            Obj::named(1, "r1", &[]),
529            Obj::asset_bundle(
530                2,
531                Bundle {
532                    preload: vec![(1, 5), (2, 5), (1, 6), (2, 7)],
533                    rows: vec![row("assets/r.prefab", (0, 4), (0, 1))],
534                    ..Bundle::default()
535                },
536            ),
537        ],
538    );
539    Scene {
540        files: vec![
541            // Under the key `xab.assets`, as the resolver's file.
542            named("caller/xab.assets", x("caller")),
543            named("r.bundle", bundle(&[("CAB-R", r)])),
544        ],
545        // Only `xab.assets`: the walk's `ab.assets` matches it by suffix.
546        resolver: vec![named("xab.assets", x("found"))],
547    }
548}
549
550/// Two bundles that each hold a CAB of one name, `CAB-S`, with its own
551/// `.resS`, container row and object 7; the first also holds `CAB-X`, which
552/// points at `CAB-S`'s object 7. UnityPy's one registry keeps the later
553/// copy under each key, so a resource read from either copy's texture
554/// reads the later `.resS`, and the container lists only the later row;
555/// a pointer matches the asking file's own bundle first
556/// (`classes/PPtr.py:75-78`), so `CAB-X` reads its own bundle's object 7
557/// (`PARITY.md` section 19.2, same-named CABs).
558#[must_use]
559pub fn same_named_cabs() -> Scene {
560    let cab_s = |name: &str| {
561        serialized(
562            &[],
563            &[
564                Obj::named(7, &format!("{name}7"), &[]),
565                Obj::streamed(2, &format!("tex-{name}"), "archive:/CAB-S/CAB-S.resS", 0, 4),
566                Obj::asset_bundle(
567                    3,
568                    Bundle {
569                        rows: vec![row(&format!("assets/{name}.prefab"), (0, 0), (0, 7))],
570                        ..Bundle::default()
571                    },
572                ),
573            ],
574        )
575    };
576    let x = serialized(&["archive:/CAB-S/CAB-S"], &[Obj::named(1, "x1", &[(1, 7)])]);
577    let a = bundle(&[
578        ("CAB-X", x),
579        ("CAB-S", cab_s("a")),
580        ("CAB-S.resS", res_bytes(8, 10)),
581    ]);
582    let b = bundle(&[("CAB-S", cab_s("b")), ("CAB-S.resS", res_bytes(8, 200))]);
583    Scene {
584        files: vec![named("a.bundle", a), named("b.bundle", b)],
585        resolver: Vec::new(),
586    }
587}
588
589/// Every scene, by name: what `tools/fixtures/env.py` records.
590#[must_use]
591pub fn scenes() -> Vec<(&'static str, Scene)> {
592    vec![
593        ("cross_bundle_pointer", cross_bundle_pointer()),
594        ("loose_external_pointer", loose_external_pointer()),
595        ("deref_rules", deref_rules()),
596        ("bad_cab", bad_cab()),
597        ("nested_after_cab", nested_after_cab()),
598        ("last_block_fails", last_block_fails()),
599        ("preload_skips", preload_skips()),
600        ("preload_below_start", preload_below_start()),
601        ("preload_raw_target", preload_raw_target()),
602        ("asset_bundle_modes", asset_bundle_modes()),
603        ("resolver_loads", resolver_loads()),
604        ("preload_loads_new_cab", preload_loads_new_cab()),
605        ("preload_paths", preload_paths()),
606        ("container_other_file", container_other_file()),
607        ("fallback_file_pointer", fallback_file_pointer()),
608        ("nested_duplicates", nested_duplicates()),
609        ("preload_suffix_external", preload_suffix_external()),
610        ("preload_revisits_after_load", preload_revisits_after_load()),
611        ("preload_revisits_ahead", preload_revisits_ahead()),
612        ("same_named_cabs", same_named_cabs()),
613        ("preload_nested_external", preload_nested_external()),
614        ("resource_in_own_nested", resource_in_own_nested()),
615        ("deref_sibling_nested", deref_sibling_nested()),
616        ("resource_in_nested_cab", resource_in_nested_cab()),
617        ("nested_replaced_unread", nested_replaced_unread()),
618        ("nested_reloaded", nested_reloaded()),
619        ("nested_raw_replaced", nested_raw_replaced()),
620        ("nested_reloaded_spans", nested_reloaded_spans()),
621        ("nested_reloaded_spans_raced", nested_reloaded_spans_raced()),
622        ("nested_between_loads", nested_between_loads()),
623        ("listings_raced", listings_raced()),
624    ]
625}
626
627/// Every scene some of whose loads are dependencies, by name: what
628/// `tools/fixtures/env.py` records with those loads made as UnityPy's
629/// `load_file(..., is_dependency=True)`.
630#[must_use]
631pub fn dependency_scenes() -> Vec<(&'static str, DepScene)> {
632    vec![
633        ("nested_dropped_evicted", nested_dropped_evicted()),
634        ("nested_evicted", nested_evicted()),
635        ("dependency_reads", dependency_reads()),
636    ]
637}
638
639#[cfg(test)]
640mod tests {
641    use super::{dependency_scenes, find_scenes, race_scenes, scenes};
642
643    /// Every scene of every list (fix pass 15: the `find_file` and race
644    /// lists were left out), a race scene's other file among its files.
645    #[test]
646    fn every_scene_has_files_with_distinct_names() {
647        let deps = dependency_scenes().into_iter().map(|(n, d)| (n, d.scene));
648        let finds = find_scenes().into_iter().map(|(n, f)| (n, f.scene));
649        let races = race_scenes().into_iter().map(|(n, r)| {
650            let mut scene = r.scene;
651            scene.files.push(r.other);
652            (n, scene)
653        });
654        for (name, scene) in scenes().into_iter().chain(deps).chain(finds).chain(races) {
655            assert!(!scene.files.is_empty(), "{name}");
656            let mut names: Vec<_> = scene.files.iter().map(|f| &f.0).collect();
657            names.sort();
658            names.dedup();
659            assert_eq!(names.len(), scene.files.len(), "{name}");
660        }
661    }
662}