mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-26 03:17:43 +00:00
Merge branch 'next' of https://github.com/storytold/craft-libs into publish/registry-2332
# Conflicts: # crates/imaging/Cargo.toml
This commit is contained in:
@@ -26,7 +26,7 @@ print = { max-threads = 1 }
|
||||
video-integration = { max-threads = 1 }
|
||||
|
||||
[[profile.default.overrides]]
|
||||
filter = 'package(craft-video) & binary(h264_decode)'
|
||||
filter = 'package(craft-video) & binary(it) & test(/^h264_decode::/)'
|
||||
test-group = 'video-fixtures'
|
||||
|
||||
[[profile.default.overrides]]
|
||||
|
||||
Generated
+2
@@ -3005,6 +3005,8 @@ dependencies = [
|
||||
"craft-keymap",
|
||||
"craft-theme",
|
||||
"craft-ui",
|
||||
"craft-ui-test-kit",
|
||||
"craft-window",
|
||||
"egui",
|
||||
"egui_kittest",
|
||||
"kurbo",
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
mod backend;
|
||||
mod confinement_regressions;
|
||||
mod save_path_regressions;
|
||||
@@ -0,0 +1,4 @@
|
||||
//! The crate's integration tests, linked into one test binary.
|
||||
|
||||
mod renders;
|
||||
mod share_dialog;
|
||||
@@ -0,0 +1,4 @@
|
||||
//! Integration tests for DDS texture handling.
|
||||
|
||||
mod boundary;
|
||||
mod known_answers;
|
||||
@@ -1,19 +0,0 @@
|
||||
//! An app that embeds the writer names itself in `docProps/app.xml` (its own test binary: the
|
||||
//! name is set once per process).
|
||||
|
||||
use std::io::Read;
|
||||
|
||||
#[test]
|
||||
fn the_embedding_app_names_itself_in_app_xml() {
|
||||
assert_eq!(craft_docx::application_name(), "WordCraft", "the default");
|
||||
craft_docx::set_application_name("Example Writer");
|
||||
craft_docx::set_application_name("Other");
|
||||
assert_eq!(craft_docx::application_name(), "Example Writer", "only the first call counts");
|
||||
let mut d = craft_wordmodel::Document::new();
|
||||
d.body = vec![craft_wordmodel::para_block(craft_wordmodel::Paragraph::with_text("Text", Default::default()))];
|
||||
let bytes = craft_docx::write(&d).unwrap();
|
||||
let mut z = zip::ZipArchive::new(std::io::Cursor::new(&bytes)).unwrap();
|
||||
let mut app = String::new();
|
||||
z.by_name("docProps/app.xml").unwrap().read_to_string(&mut app).unwrap();
|
||||
assert!(app.contains("<Application>Example Writer</Application>"), "{app}");
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
//! The embedding app sets its name once per process. Exercise the setter in a fresh copy of the test binary.
|
||||
|
||||
use std::io::Read;
|
||||
|
||||
#[test]
|
||||
fn the_embedding_app_names_itself_in_app_xml() {
|
||||
const CHILD: &str = "CRAFT_DOCX_APP_NAME_CHILD";
|
||||
if std::env::var_os(CHILD).is_none() {
|
||||
let output = std::process::Command::new(std::env::current_exe().expect("DOCX test executable"))
|
||||
.args(["--exact", "application_name::the_embedding_app_names_itself_in_app_xml", "--nocapture"])
|
||||
.env(CHILD, "1")
|
||||
.output()
|
||||
.expect("run the application name test in a fresh process");
|
||||
let stdout = String::from_utf8_lossy(&output.stdout);
|
||||
let stderr = String::from_utf8_lossy(&output.stderr);
|
||||
assert!(output.status.success() && stdout.contains("application name verified"), "{stdout}\n{stderr}");
|
||||
return;
|
||||
}
|
||||
assert_eq!(craft_docx::application_name(), "WordCraft", "the default");
|
||||
craft_docx::set_application_name("Example Writer");
|
||||
craft_docx::set_application_name("Other");
|
||||
assert_eq!(craft_docx::application_name(), "Example Writer", "only the first call counts");
|
||||
let mut d = craft_wordmodel::Document::new();
|
||||
d.body = vec![craft_wordmodel::para_block(craft_wordmodel::Paragraph::with_text("Text", Default::default()))];
|
||||
let bytes = craft_docx::write(&d).unwrap();
|
||||
let mut z = zip::ZipArchive::new(std::io::Cursor::new(&bytes)).unwrap();
|
||||
let mut app = String::new();
|
||||
z.by_name("docProps/app.xml").unwrap().read_to_string(&mut app).unwrap();
|
||||
assert!(app.contains("<Application>Example Writer</Application>"), "{app}");
|
||||
println!("application name verified");
|
||||
}
|
||||
@@ -58,3 +58,7 @@ mod vml_shapes;
|
||||
mod word_xml;
|
||||
mod wordml2003_write;
|
||||
mod wps_fallback;
|
||||
|
||||
mod application_name;
|
||||
mod matrix_save_size;
|
||||
mod protection;
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
mod audit_followups;
|
||||
mod binary_write;
|
||||
mod code_page_write;
|
||||
mod conformance;
|
||||
mod hardening;
|
||||
mod hex_chunks;
|
||||
mod lin_pat;
|
||||
mod model;
|
||||
mod model_entities;
|
||||
mod model_mleader;
|
||||
mod model_objects;
|
||||
mod model_table;
|
||||
mod model_write;
|
||||
mod model_write_annotations;
|
||||
mod recovering;
|
||||
mod roundtrip;
|
||||
@@ -0,0 +1,3 @@
|
||||
mod read;
|
||||
mod toc;
|
||||
mod write;
|
||||
@@ -0,0 +1,3 @@
|
||||
mod evm_metadata_arrays;
|
||||
mod evm_metadata_map_keys;
|
||||
mod evm_selector_dedup;
|
||||
@@ -0,0 +1,6 @@
|
||||
mod icml;
|
||||
mod model;
|
||||
mod package;
|
||||
mod resources;
|
||||
mod story;
|
||||
mod value;
|
||||
@@ -25,6 +25,8 @@ mod orientation;
|
||||
mod pcx;
|
||||
mod png_jpeg;
|
||||
mod pnm_headers;
|
||||
#[cfg(target_os = "linux")]
|
||||
mod pnm_peak_memory;
|
||||
mod resolution;
|
||||
mod roundtrip;
|
||||
mod source_settings;
|
||||
@@ -41,3 +43,7 @@ mod tiff_ycbcr;
|
||||
mod webp_frames;
|
||||
mod webp_lossy;
|
||||
mod xpm;
|
||||
|
||||
mod jxl_decode;
|
||||
mod jxl_export;
|
||||
mod legacy_tiff_raw;
|
||||
|
||||
+23
-3
@@ -1,10 +1,9 @@
|
||||
//! #2938: `Limits::max_alloc` budgets the decoded pixel buffer, so the PNM decoder must not build a
|
||||
//! wider scratch copy (it used to collect one `u32` per sample, four times an 8-bit image) next to it.
|
||||
//!
|
||||
//! This file holds a single test so it runs in its own process: it reads the process's peak RSS
|
||||
//! This probe re-runs the test in an isolated process: it reads the process's peak RSS
|
||||
//! (`VmHWM`, Linux only) and nothing else may allocate meanwhile.
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
fn peak_rss_bytes() -> Option<u64> {
|
||||
let status = std::fs::read_to_string("/proc/self/status").ok()?;
|
||||
let line = status.lines().find(|l| l.starts_with("VmHWM:"))?;
|
||||
@@ -12,9 +11,30 @@ fn peak_rss_bytes() -> Option<u64> {
|
||||
Some(kib * 1024)
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[test]
|
||||
fn pnm_decode_peak_memory_stays_near_the_output_size() {
|
||||
const CHILD: &str = "CRAFT_IMAGE_CODECS_PNM_RSS_CHILD";
|
||||
const DONE: &str = "PNM RSS probe completed";
|
||||
if std::env::var_os(CHILD).is_some() {
|
||||
measure_peak_memory();
|
||||
println!("{DONE}");
|
||||
return;
|
||||
}
|
||||
|
||||
// Cargo can run other tests concurrently in this harness. Start a fresh process
|
||||
// with only this test selected so its allocations are the only ones being measured.
|
||||
let output = std::process::Command::new(std::env::current_exe().expect("image codec test executable"))
|
||||
.args(["--exact", "pnm_peak_memory::pnm_decode_peak_memory_stays_near_the_output_size", "--nocapture", "--test-threads=1"])
|
||||
.env(CHILD, "1")
|
||||
.output()
|
||||
.expect("start isolated PNM RSS probe");
|
||||
let stdout = String::from_utf8_lossy(&output.stdout);
|
||||
let stderr = String::from_utf8_lossy(&output.stderr);
|
||||
// A stale filter can select zero tests and exit successfully.
|
||||
assert!(output.status.success() && stdout.lines().any(|line| line.ends_with(DONE)), "{stdout}\n{stderr}");
|
||||
}
|
||||
|
||||
fn measure_peak_memory() {
|
||||
use craft_image_codecs::*;
|
||||
|
||||
const SIDE: u32 = 4096; // 16 MiB of 8-bit gray output
|
||||
@@ -39,6 +39,8 @@ serde_json = { workspace = true, optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
craft-ui = { workspace = true, features = ["suite"] }
|
||||
craft-ui-test-kit = { workspace = true }
|
||||
craft-window = { workspace = true }
|
||||
egui = { workspace = true }
|
||||
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
|
||||
|
||||
@@ -548,6 +548,7 @@ impl FullWindowWorkspace for RawDevelopWorkspace {
|
||||
|
||||
let shown = FullWindowDialog::new(title)
|
||||
.own_window(WindowSpec::dialog())
|
||||
.remember(SaveKey::new("craft_imaging.raw_develop.window"))
|
||||
.opened(open)
|
||||
.command_scope(RawDevelopCommands::SCOPE)
|
||||
.buttons(buttons)
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::time::Duration;
|
||||
|
||||
use craft_behavior::PixelSize;
|
||||
use craft_behavior::placement::Placement;
|
||||
use craft_behavior::{Monitor, MonitorKey, PixelSize};
|
||||
use craft_host::target::ShellInfo;
|
||||
use craft_imaging::raw::{Demosaic, RawDevelopSettings};
|
||||
use craft_imaging::scopes::ClippingMask;
|
||||
use craft_imaging::ui::raw_develop::{
|
||||
@@ -15,13 +17,17 @@ use craft_imaging::ui::raw_develop::{
|
||||
use craft_imaging::ui::scopes::{ScopeFrame, ScopeReadout};
|
||||
use craft_imaging::ui::wide_angle::PreviewDone;
|
||||
use craft_imaging::ui::{ChannelColor, HistogramSet, ScopeChannel};
|
||||
use craft_ui::InstallSpec;
|
||||
use craft_ui::canvas::{PixelRect, RasterSource};
|
||||
use craft_ui::dialog::{DialogHost, DialogResult, FullWindowWorkspace as _, HostedWorkspace};
|
||||
use craft_ui::primitives::Revision;
|
||||
use craft_ui::runtime::access::Role;
|
||||
use craft_ui::runtime::pending::Job;
|
||||
use craft_ui::testing::windows::{FakeSystem, NoWindows};
|
||||
use craft_ui::testing::{Fixture, Target, pointer, trial};
|
||||
use egui::{Color32, ColorImage, Event, Key, Modifiers, Vec2, pos2};
|
||||
use craft_ui_test_kit::windows::Windows;
|
||||
use craft_window::restore::Store;
|
||||
use egui::{Color32, ColorImage, Event, Key, Modifiers, Rect, Vec2, ViewportId, ViewportInfo, pos2};
|
||||
|
||||
const IMAGE: [u32; 2] = [400, 200];
|
||||
|
||||
@@ -172,6 +178,79 @@ fn focus_canvas(fixture: &mut Fixture) -> Target {
|
||||
canvas
|
||||
}
|
||||
|
||||
#[trial]
|
||||
fn raw_develop_remembers_its_native_window_between_open_and_filter() {
|
||||
let store = Arc::new(Mutex::new(Store::in_memory()));
|
||||
let context = || Windows::with(InstallSpec::new(ShellInfo::default(), Arc::new(NoWindows)).placement(store.clone()));
|
||||
let first = context();
|
||||
let mut host = DialogHost::new();
|
||||
host.open(HostedWorkspace::new(RawDevelopWorkspace::new(open(RawTarget::OpenRaw)), Source::new()));
|
||||
|
||||
let inner_size = Vec2::new(1040.0, 760.0);
|
||||
let outer_pos = pos2(118.0, 60.0);
|
||||
first.child_info(ViewportInfo {
|
||||
inner_rect: Some(Rect::from_min_size(pos2(120.0, 90.0), inner_size)),
|
||||
outer_rect: Some(Rect::from_min_size(outer_pos, inner_size + Vec2::new(4.0, 32.0))),
|
||||
native_pixels_per_point: Some(2.0),
|
||||
..ViewportInfo::default()
|
||||
});
|
||||
for _ in 0..3 {
|
||||
first.frame(vec![], vec![], |ui| {
|
||||
host.run(ui);
|
||||
});
|
||||
}
|
||||
let saved = store.lock().unwrap().get("craft_imaging.raw_develop.window").expect("the Raw Develop window's placement was saved");
|
||||
assert_eq!(saved.normal.size, <[f32; 2]>::from(inner_size));
|
||||
assert_eq!(saved.position_px, Some([236, 120]));
|
||||
|
||||
// Windows can report a parked rectangle just before the minimized window stops painting.
|
||||
let parked = Rect::from_min_size(pos2(-32000.0, -32000.0), Vec2::new(160.0, 40.0));
|
||||
first.child_info(ViewportInfo {
|
||||
inner_rect: Some(parked),
|
||||
outer_rect: Some(parked),
|
||||
native_pixels_per_point: Some(2.0),
|
||||
minimized: Some(true),
|
||||
..ViewportInfo::default()
|
||||
});
|
||||
first.frame(vec![], vec![], |ui| {
|
||||
host.run(ui);
|
||||
});
|
||||
assert_eq!(store.lock().unwrap().get("craft_imaging.raw_develop.window"), Some(saved), "minimizing keeps the normal placement");
|
||||
|
||||
let second = context();
|
||||
let mut host = DialogHost::new();
|
||||
host.open(HostedWorkspace::new(RawDevelopWorkspace::new(open(RawTarget::Filter)), Source::new()));
|
||||
let output = second.frame(vec![], vec![], |ui| {
|
||||
host.run(ui);
|
||||
});
|
||||
let (_, builder) = output.builders.iter().find(|(id, _)| *id != ViewportId::ROOT).expect("Raw Develop Filter opens a child window");
|
||||
assert_eq!(builder.inner_size, Some(inner_size));
|
||||
assert_eq!(builder.position, Some(outer_pos));
|
||||
}
|
||||
|
||||
#[trial]
|
||||
fn raw_develop_window_keeps_its_size_when_the_saved_screen_is_gone() {
|
||||
let store = Arc::new(Mutex::new(Store::in_memory()));
|
||||
let mut saved = Placement::new([1040.0, 760.0], 2.0);
|
||||
saved.position_px = Some([-4400, 120]);
|
||||
saved.monitor = Some(MonitorKey::new("Disconnected", [3840, 2160]));
|
||||
store.lock().unwrap().set("craft_imaging.raw_develop.window", &saved);
|
||||
|
||||
let screen = Monitor::new(MonitorKey::new("Attached", [3840, 2160]), [0, 0], [3840, 2160], 2.0);
|
||||
let system = Arc::new(FakeSystem::new());
|
||||
system.set_monitors(vec![screen]);
|
||||
let windows = Windows::with(InstallSpec::new(ShellInfo::default(), system).placement(store));
|
||||
let mut host = DialogHost::new();
|
||||
host.open(HostedWorkspace::new(RawDevelopWorkspace::new(open(RawTarget::OpenRaw)), Source::new()));
|
||||
let output = windows.frame(vec![], vec![], |ui| {
|
||||
host.run(ui);
|
||||
});
|
||||
let (_, builder) = output.builders.iter().find(|(id, _)| *id != ViewportId::ROOT).expect("Raw Develop opens a child window");
|
||||
assert_eq!(builder.inner_size, Some(Vec2::new(1040.0, 760.0)));
|
||||
let pos = builder.position.expect("the recovered position is on the attached screen");
|
||||
assert!((0.0..=880.0).contains(&pos.x) && (0.0..=320.0).contains(&pos.y), "restored position is in reach: {pos:?}");
|
||||
}
|
||||
|
||||
#[trial]
|
||||
fn raw_develop_switches_raws_and_finishes_with_each_footer_button() {
|
||||
let host = Rc::new(RefCell::new(DialogHost::new()));
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
## Schemas and fixtures
|
||||
|
||||
`schemas/instance-record.schema.json` and `schemas/link-record.schema.json` describe the stored records. `tests/schemas.rs` checks that each schema and its Rust type agree, and that the stored records in `tests/fixtures/` stay valid.
|
||||
`schemas/instance-record.schema.json` and `schemas/link-record.schema.json` describe the stored records. `tests/it/schemas.rs` checks that each schema and its Rust type agree, and that the stored records in `tests/fixtures/` stay valid.
|
||||
|
||||
## Tests
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ fn sigkill_drops_the_record() {
|
||||
let _ = std::fs::remove_dir_all(&path);
|
||||
let runtime = RuntimeDir::at(&path).unwrap();
|
||||
let exe = std::env::current_exe().unwrap();
|
||||
let child = Command::new(exe).args(["--exact", "hold_until_killed", "--test-threads=1"]).env("CRAFT_HOLD_DIR", &path).spawn().unwrap();
|
||||
let child = Command::new(exe).args(["--exact", "discovery::hold_until_killed", "--test-threads=1"]).env("CRAFT_HOLD_DIR", &path).spawn().unwrap();
|
||||
let mut guard = HoldCleanup { dir: path.clone(), child: Some(child) };
|
||||
let ready = runtime.path().join("ready");
|
||||
let deadline = Instant::now() + Duration::from_secs(10);
|
||||
@@ -0,0 +1,12 @@
|
||||
mod bulk;
|
||||
mod connection_limits;
|
||||
mod discovery;
|
||||
mod fetch;
|
||||
mod hub;
|
||||
mod native_roundtrip;
|
||||
mod open_payload;
|
||||
mod protocol;
|
||||
mod provider_stall;
|
||||
mod schemas;
|
||||
mod security;
|
||||
mod watch;
|
||||
@@ -0,0 +1,2 @@
|
||||
mod corpus;
|
||||
mod omml_latex;
|
||||
@@ -5,3 +5,5 @@ mod edit_orientation;
|
||||
mod edit_pixel_size;
|
||||
mod edit_resolution;
|
||||
mod robust;
|
||||
|
||||
mod ifd0_orientation_compat;
|
||||
|
||||
+1
-4
@@ -1,8 +1,5 @@
|
||||
#[path = "support/mod.rs"]
|
||||
mod support;
|
||||
|
||||
use super::support::{dns_query, eth, ipv4_pkt, udp};
|
||||
use craft_pcap::{Dns, decode};
|
||||
use support::{dns_query, eth, ipv4_pkt, udp};
|
||||
|
||||
fn answer(kind: u16, rd: &[u8]) -> Dns {
|
||||
let mut msg = dns_query();
|
||||
+1
-4
@@ -1,8 +1,5 @@
|
||||
#[path = "support/mod.rs"]
|
||||
mod support;
|
||||
|
||||
use super::support::{dns_query, eth, ipv4_pkt, pcap, udp};
|
||||
use craft_pcap::{decode, summarize};
|
||||
use support::{dns_query, eth, ipv4_pkt, pcap, udp};
|
||||
|
||||
fn packet(message: &[u8]) -> Vec<u8> {
|
||||
eth(0x0800, &ipv4_pkt(17, [192, 0, 2, 1], [192, 0, 2, 2], &udp(51000, 53, message)))
|
||||
@@ -1,8 +1,5 @@
|
||||
#[path = "support/mod.rs"]
|
||||
mod support;
|
||||
|
||||
use super::support::{dns_query, eth, ipv4_pkt, pcap, udp};
|
||||
use craft_pcap::{decode, summarize};
|
||||
use support::{dns_query, eth, ipv4_pkt, pcap, udp};
|
||||
|
||||
fn response(record_type: u16, rdata: &[u8], declared_length: usize) -> Vec<u8> {
|
||||
let mut message = dns_query();
|
||||
@@ -0,0 +1,22 @@
|
||||
//! Integration tests for craft-pcap.
|
||||
|
||||
mod dns_discovery_answers;
|
||||
mod dns_question_class;
|
||||
mod dns_rdata_names;
|
||||
mod pcap_dns_name_limit;
|
||||
mod pcap_dns_txt_lengths;
|
||||
mod pcap_flow_time_range;
|
||||
mod pcap_http_host_boundary;
|
||||
mod pcap_http_methods;
|
||||
mod pcap_ipv4_lengths;
|
||||
mod pcap_ipv6_fragments;
|
||||
mod pcap_ipv6_no_next_header;
|
||||
mod pcap_ipv6_version;
|
||||
mod pcap_tcp_ecn;
|
||||
mod pcapng_simple_payload;
|
||||
mod regression_pcapng_framing;
|
||||
mod regression_tcp_dns_framing;
|
||||
mod regression_tcp_header_length;
|
||||
mod regression_tls_bounds;
|
||||
#[path = "../support/mod.rs"]
|
||||
mod support;
|
||||
+1
-4
@@ -1,8 +1,5 @@
|
||||
#[path = "support/mod.rs"]
|
||||
mod support;
|
||||
|
||||
use super::support::{ipv4_pkt, udp};
|
||||
use craft_pcap::{Dns, decode};
|
||||
use support::{ipv4_pkt, udp};
|
||||
|
||||
fn query(last: usize, compressed: bool) -> Dns {
|
||||
let mut msg = vec![0, 1, 1, 0, 0, if compressed { 2 } else { 1 }, 0, 0, 0, 0, 0, 0];
|
||||
+1
-4
@@ -1,8 +1,5 @@
|
||||
#[path = "support/mod.rs"]
|
||||
mod support;
|
||||
|
||||
use super::support::{ipv4_pkt, udp};
|
||||
use craft_pcap::{Dns, decode};
|
||||
use support::{ipv4_pkt, udp};
|
||||
|
||||
fn response(data: &[u8]) -> Dns {
|
||||
let mut msg = vec![0, 1, 0x81, 0x80, 0, 0, 0, 1, 0, 0, 0, 0];
|
||||
+1
-4
@@ -1,8 +1,5 @@
|
||||
#[path = "support/mod.rs"]
|
||||
mod support;
|
||||
|
||||
use super::support::{block, eth, ipv4_pkt, pcap, pcapng, udp};
|
||||
use craft_pcap::summarize;
|
||||
use support::{block, eth, ipv4_pkt, pcap, pcapng, udp};
|
||||
|
||||
fn frame() -> Vec<u8> {
|
||||
eth(0x0800, &ipv4_pkt(17, [1; 4], [2; 4], &udp(100, 200, b"body")))
|
||||
+1
-4
@@ -1,8 +1,5 @@
|
||||
#[path = "support/mod.rs"]
|
||||
mod support;
|
||||
|
||||
use super::support::{ipv4_pkt, tcp};
|
||||
use craft_pcap::{Http, decode};
|
||||
use support::{ipv4_pkt, tcp};
|
||||
|
||||
fn request(data: &[u8]) -> Http {
|
||||
decode(101, &ipv4_pkt(6, [1; 4], [2; 4], &tcp(100, 80, 0x18, data))).http.unwrap()
|
||||
@@ -1,8 +1,5 @@
|
||||
#[path = "support/mod.rs"]
|
||||
mod support;
|
||||
|
||||
use super::support::{ipv4_pkt, tcp};
|
||||
use craft_pcap::decode;
|
||||
use support::{ipv4_pkt, tcp};
|
||||
|
||||
/// WebDAV and extension methods retain the same HTTP evidence as core methods.
|
||||
#[test]
|
||||
@@ -1,8 +1,5 @@
|
||||
#[path = "support/mod.rs"]
|
||||
mod support;
|
||||
|
||||
use super::support::{ipv4_pkt, udp};
|
||||
use craft_pcap::decode;
|
||||
use support::{ipv4_pkt, udp};
|
||||
|
||||
#[test]
|
||||
fn incomplete_ipv4_base_headers_explain_why_decoding_stopped() {
|
||||
+1
-4
@@ -1,8 +1,5 @@
|
||||
#[path = "support/mod.rs"]
|
||||
mod support;
|
||||
|
||||
use super::support::{eth, udp};
|
||||
use craft_pcap::decode;
|
||||
use support::{eth, udp};
|
||||
|
||||
fn packet(offset: u16, next: u8, payload: &[u8]) -> Vec<u8> {
|
||||
let mut ip = vec![0u8; 40];
|
||||
@@ -1,8 +1,5 @@
|
||||
#[path = "support/mod.rs"]
|
||||
mod support;
|
||||
|
||||
use super::support::{eth, ipv4_pkt};
|
||||
use craft_pcap::decode;
|
||||
use support::{eth, ipv4_pkt};
|
||||
|
||||
fn raw_packets() -> (Vec<u8>, Vec<u8>) {
|
||||
let ipv4 = ipv4_pkt(17, [1; 4], [2; 4], &[0; 20]);
|
||||
+1
-4
@@ -1,8 +1,5 @@
|
||||
#[path = "support/mod.rs"]
|
||||
mod support;
|
||||
|
||||
use super::support::{block, pcapng};
|
||||
use craft_pcap::Capture;
|
||||
use support::{block, pcapng};
|
||||
|
||||
fn capture(original: u32, snaplen: u32, payload: &[u8]) -> Vec<u8> {
|
||||
let mut out = pcapng(&[]);
|
||||
+1
-4
@@ -1,8 +1,5 @@
|
||||
#[path = "support/mod.rs"]
|
||||
mod support;
|
||||
|
||||
use super::support::{block, pcapng, sample_frames};
|
||||
use craft_pcap::summarize;
|
||||
use support::{block, pcapng, sample_frames};
|
||||
|
||||
#[test]
|
||||
fn mismatched_block_footers_stop_the_capture_with_a_warning() {
|
||||
+1
-4
@@ -1,8 +1,5 @@
|
||||
#[path = "support/mod.rs"]
|
||||
mod support;
|
||||
|
||||
use super::support::{dns_query, dns_response, ipv4_pkt, tcp};
|
||||
use craft_pcap::{Decoded, decode};
|
||||
use support::{dns_query, dns_response, ipv4_pkt, tcp};
|
||||
|
||||
fn decoded(payload: &[u8]) -> Decoded {
|
||||
decode(101, &ipv4_pkt(6, [192, 0, 2, 1], [192, 0, 2, 2], &tcp(53, 51000, 0x18, payload)))
|
||||
+1
-4
@@ -1,8 +1,5 @@
|
||||
#[path = "support/mod.rs"]
|
||||
mod support;
|
||||
|
||||
use super::support::{ipv4_pkt, tcp};
|
||||
use craft_pcap::{Decoded, decode};
|
||||
use support::{ipv4_pkt, tcp};
|
||||
|
||||
fn decoded(segment: &[u8]) -> Decoded {
|
||||
decode(101, &ipv4_pkt(6, [192, 0, 2, 1], [192, 0, 2, 2], segment))
|
||||
+1
-4
@@ -1,8 +1,5 @@
|
||||
#[path = "support/mod.rs"]
|
||||
mod support;
|
||||
|
||||
use super::support::{client_hello, ipv4_pkt, tcp};
|
||||
use craft_pcap::{Decoded, decode};
|
||||
use support::{client_hello, ipv4_pkt, tcp};
|
||||
|
||||
fn decoded(record: &[u8]) -> Decoded {
|
||||
decode(101, &ipv4_pkt(6, [192, 0, 2, 1], [192, 0, 2, 2], &tcp(51000, 443, 0x18, record)))
|
||||
@@ -0,0 +1,5 @@
|
||||
mod limits;
|
||||
mod plist_line_endings;
|
||||
mod plist_marker_widths;
|
||||
mod plist_object_bounds;
|
||||
mod plist_quoted_attributes;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user