Skip to content

Commit 36bbe51

Browse files
committed
test: build the pending-fragment bound in its own test, drop divider comments
The crash self-test read the #2640 expectation, removed when #2640 merged, so it always panicked.
1 parent aead3ae commit 36bbe51

4 files changed

Lines changed: 14 additions & 90 deletions

File tree

‎apps/desktop-gpui/src/transcription/verify_tests.rs‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@ fn finish(case: Case) {
5151
}
5252
}
5353

54-
// ---------------------------------------------------------------------------
55-
// Reference segmentation
56-
// ---------------------------------------------------------------------------
57-
5854
const ATTACHING: &str = ",.!?;:%)]}'’、。!?;:,";
5955
const WEAK: [&str; 20] = [
6056
"an", "as", "at", "be", "by", "do", "he", "if", "in", "is", "it", "me", "my", "of", "on", "or",
@@ -186,10 +182,6 @@ fn compare_segments(
186182
problems
187183
}
188184

189-
// ---------------------------------------------------------------------------
190-
// Fake transcriber over real projects
191-
// ---------------------------------------------------------------------------
192-
193185
fn marker_word(source: AudioSource, index: u32) -> String {
194186
format!("{}{index}", source.name())
195187
}
@@ -550,10 +542,6 @@ fn instant_project_is_refused() {
550542
finish(case);
551543
}
552544

553-
// ---------------------------------------------------------------------------
554-
// Segmentation properties
555-
// ---------------------------------------------------------------------------
556-
557545
const ASCII_WORDS: [&str; 22] = [
558546
"hello", "world", "is", "a", "river", "cloud", "it", "to", "so", "screen", "record", "of",
559547
"we", "on", "capture", "edit", "timeline", "in", "up", "my", "an", "I",

‎apps/desktop-gpui/src/upload/verify_tests.rs‎

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ const INSTANT_PAIRS: u32 = 8;
3636
const INSTANT_VIDEO_ID: &str = "instantverify01";
3737
const RETRY_WINDOW: Duration = Duration::from_secs(5 * 60);
3838

39-
// ---------------------------------------------------------------------------
40-
// Virtual clock
41-
// ---------------------------------------------------------------------------
42-
4339
const SETTLE: Duration = Duration::from_millis(50);
4440
const WORKED: Duration = Duration::from_micros(200);
4541

@@ -119,10 +115,6 @@ pub(super) fn virtual_time<F: Future>(future: F) -> F::Output {
119115
output
120116
}
121117

122-
// ---------------------------------------------------------------------------
123-
// Fault plan
124-
// ---------------------------------------------------------------------------
125-
126118
#[derive(Clone, Copy, Debug)]
127119
pub(super) enum Route {
128120
Part(u32),
@@ -191,10 +183,6 @@ impl Rule {
191183
}
192184
}
193185

194-
// ---------------------------------------------------------------------------
195-
// Mock Cap API + object store
196-
// ---------------------------------------------------------------------------
197-
198186
#[derive(Default)]
199187
struct Multipart {
200188
video_id: String,
@@ -1058,10 +1046,6 @@ async fn respond(
10581046
stream.write_all(&bytes).await
10591047
}
10601048

1061-
// ---------------------------------------------------------------------------
1062-
// Fixtures
1063-
// ---------------------------------------------------------------------------
1064-
10651049
fn to_hex(bytes: &[u8]) -> String {
10661050
bytes.iter().map(|byte| format!("{byte:02x}")).collect()
10671051
}
@@ -1275,10 +1259,6 @@ pub(super) fn assert_segments_stored(
12751259
assert_eq!(manifest, expected_manifest(video, audio));
12761260
}
12771261

1278-
// ---------------------------------------------------------------------------
1279-
// Studio share: multipart upload of the exported MP4
1280-
// ---------------------------------------------------------------------------
1281-
12821262
struct StudioRun {
12831263
result: Result<UploadResult, String>,
12841264
progress: Vec<f64>,
@@ -1525,10 +1505,6 @@ fn studio_share_cancel_then_resume_reuses_the_persisted_video() {
15251505
});
15261506
}
15271507

1528-
// ---------------------------------------------------------------------------
1529-
// Instant: live segment upload while recording
1530-
// ---------------------------------------------------------------------------
1531-
15321508
/// Feeds the recorder's segment events on a fixed virtual schedule: both init
15331509
/// segments at 0 s, then audio segment k at 2k s and video segment k at
15341510
/// 2k + 0.6 s, so no two segments are in flight at the same moment unless a

‎crates/verify/tests/captions.rs‎

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,6 @@ fn seeds(fast: u64, full: u64) -> u64 {
8585
}
8686
}
8787

88-
// ---------------------------------------------------------------------------
89-
// Reference model
90-
// ---------------------------------------------------------------------------
91-
9288
fn attaches_to_previous(text: &str) -> bool {
9389
const ATTACHING: &str = ",.!?;:%)]}'’、。!?;:,";
9490
text.trim()
@@ -353,10 +349,6 @@ fn compare_track(product: &[CaptionTrackSegment], model: &[Piece]) -> Vec<String
353349
problems
354350
}
355351

356-
// ---------------------------------------------------------------------------
357-
// Random captions
358-
// ---------------------------------------------------------------------------
359-
360352
const VOCABULARY: [&str; 24] = [
361353
"hello", "world", "is", "a", "river", "cloud", "it", "to", "über", "café", "日本", "so",
362354
"screen", "record", "of", "we", "on", "capture", "edit", "timeline", "in", "up", "my", "an",
@@ -468,10 +460,6 @@ fn random_overrides(rng: &mut Rng, config: &mut ProjectConfiguration, per_source
468460
}
469461
}
470462

471-
// ---------------------------------------------------------------------------
472-
// Projection and migration properties
473-
// ---------------------------------------------------------------------------
474-
475463
fn projection_problems(
476464
base: &ProjectConfiguration,
477465
ops: &[Op],
@@ -891,10 +879,6 @@ fn legacy_migration() {
891879
finish(case);
892880
}
893881

894-
// ---------------------------------------------------------------------------
895-
// On-disk round trips
896-
// ---------------------------------------------------------------------------
897-
898882
fn styled_settings(rng: &mut Rng) -> CaptionSettings {
899883
CaptionSettings {
900884
enabled: true,
@@ -1044,10 +1028,6 @@ fn walk(dir: &Path) -> Vec<std::path::PathBuf> {
10441028
out
10451029
}
10461030

1047-
// ---------------------------------------------------------------------------
1048-
// Transcription input + fake transcriber
1049-
// ---------------------------------------------------------------------------
1050-
10511031
/// Two takes; every track starts at a different time, so the clip offsets
10521032
/// matter (mic 0.25 s late, system audio 0.1 s early, display 0.05 s late).
10531033
fn transcription_fixture() -> FixtureSpec {
@@ -1340,10 +1320,6 @@ fn transcription_audio_words() {
13401320
finish(case);
13411321
}
13421322

1343-
// ---------------------------------------------------------------------------
1344-
// Rendered captions
1345-
// ---------------------------------------------------------------------------
1346-
13471323
/// Caption style that is easy to find: an opaque green box with white text,
13481324
/// no fades, animation or word highlight.
13491325
fn render_settings() -> CaptionSettings {
@@ -1789,10 +1765,6 @@ fn render_multi_clip() {
17891765
common::assert_passed(failures);
17901766
}
17911767

1792-
// ---------------------------------------------------------------------------
1793-
// Opening a project in the editor
1794-
// ---------------------------------------------------------------------------
1795-
17961768
/// Opens a copy of `project` whose stored config is `config` in the editor
17971769
/// engine and returns the config it settles on.
17981770
fn open_in_editor(

‎crates/verify/tests/crash.rs‎

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,6 @@ struct Run {
112112
display: PathBuf,
113113
}
114114

115-
// ---------------------------------------------------------------------------
116-
// Recording (shared by the in-test runs and the child recorder)
117-
// ---------------------------------------------------------------------------
118-
119115
#[cfg(target_os = "macos")]
120116
mod source {
121117
use super::*;
@@ -469,10 +465,6 @@ fn secs_complete(line: &str) -> bool {
469465
.is_some_and(|d| d.len() == 6)
470466
}
471467

472-
// ---------------------------------------------------------------------------
473-
// The child recorder (a SIGKILL target)
474-
// ---------------------------------------------------------------------------
475-
476468
/// Runs only as a child of `crash_safety` (`CAP_VERIFY_CRASH_CHILD` set):
477469
/// records into the given directory until it is killed or finishes.
478470
#[test]
@@ -647,10 +639,6 @@ fn wait_for_exit(pids: &[u32], case: &mut Case) {
647639
}
648640
}
649641

650-
// ---------------------------------------------------------------------------
651-
// What is physically on disk
652-
// ---------------------------------------------------------------------------
653-
654642
/// Top-level ISO BMFF boxes span the file exactly and include moof + mdat:
655643
/// the writer finished this fragment (independent of recovery.rs).
656644
fn fragment_complete(path: &Path) -> bool {
@@ -909,10 +897,6 @@ fn check_open_fragment(case: &mut Case, display: &Path) {
909897
}
910898
}
911899

912-
// ---------------------------------------------------------------------------
913-
// Oracles
914-
// ---------------------------------------------------------------------------
915-
916900
/// The recovered display: the app's display finalization
917901
/// (`RecoveryManager::finalize_to_progressive_mp4`, the same call for a clean
918902
/// stop and for crash recovery).
@@ -1094,10 +1078,6 @@ fn check_recovery(
10941078
}
10951079
}
10961080

1097-
// ---------------------------------------------------------------------------
1098-
// Cases
1099-
// ---------------------------------------------------------------------------
1100-
11011081
fn scratch_root() -> PathBuf {
11021082
std::env::var_os("CAP_VERIFY_SCRATCH")
11031083
.map(PathBuf::from)
@@ -1712,11 +1692,19 @@ fn pending_fragment_bound_rejects_other_complete_frame_loss() {
17121692
},
17131693
];
17141694
let physical = vec![(0, 0.0), (1, 1.0 / f64::from(FPS))];
1715-
let entries = cap_verify_expect::parse(include_str!("../expectations.toml")).unwrap();
1716-
let entry = entries
1717-
.iter()
1718-
.find(|entry| entry.case == "crash/recorder-kill/inproc/*")
1719-
.unwrap();
1695+
// The bound the pending-fragment (#2640) entry used: frames inside
1696+
// complete pending fragments only.
1697+
let bound = cap_verify_expect::Bound::from([
1698+
("count".into(), cap_verify_expect::Range::at(1.0)),
1699+
(
1700+
"frames".into(),
1701+
cap_verify_expect::Range {
1702+
min: 1.0,
1703+
max: 60.0,
1704+
},
1705+
),
1706+
("outside-pending".into(), cap_verify_expect::Range::at(0.0)),
1707+
]);
17201708
for (outside, accepted) in [(0.0, true), (1.0, false)] {
17211709
let metrics = BTreeMap::from([
17221710
("count".into(), cap_verify_expect::Range::at(1.0)),
@@ -1727,7 +1715,7 @@ fn pending_fragment_bound_rejects_other_complete_frame_loss() {
17271715
),
17281716
]);
17291717
assert_eq!(
1730-
cap_verify_expect::within(&entry.bound, Some(&metrics)).is_ok(),
1718+
cap_verify_expect::within(&bound, Some(&metrics)).is_ok(),
17311719
accepted
17321720
);
17331721
}

0 commit comments

Comments
 (0)