()
| 4981 | #[test] |
| 4982 | #[ignore = "direct Git-to-graph Hyperfine canary; set ATOMIC_DIRECT_STREAM_GIT and ATOMIC_DIRECT_STREAM_ARTIFACT"] |
| 4983 | fn direct_stream_hyperfine() { |
| 4984 | let git = |
| 4985 | GitRepository::open(std::env::var_os("ATOMIC_DIRECT_STREAM_GIT").unwrap()).unwrap(); |
| 4986 | let artifact = PathBuf::from(std::env::var_os("ATOMIC_DIRECT_STREAM_ARTIFACT").unwrap()); |
| 4987 | fs::create_dir_all(&artifact).unwrap(); |
| 4988 | assert!(!artifact.join("repo").exists()); |
| 4989 | let mut repo = Repository::init(artifact.join("repo")).unwrap(); |
| 4990 | let importer = ParallelImporter::new( |
| 4991 | &git, |
| 4992 | ParallelImportOptions { |
| 4993 | graph_only: true, |
| 4994 | target_view: repo.current_view().into(), |
| 4995 | ..Default::default() |
| 4996 | }, |
| 4997 | ); |
| 4998 | let all = importer |
| 4999 | .collect_commit_oids_from_tip( |
| 5000 | &git, |
| 5001 | Oid::from_str("c5161524980522320c7d3425e714cc0965a869a5").unwrap(), |
| 5002 | ) |
| 5003 | .unwrap(); |
| 5004 | let count: usize = std::env::var("ATOMIC_DIRECT_STREAM_COMMITS") |
| 5005 | .unwrap_or_else(|_| "100".into()) |
| 5006 | .parse() |
| 5007 | .unwrap(); |
| 5008 | assert!(count > 0 && count <= all.len()); |
| 5009 | let started = Instant::now(); |
| 5010 | let result = importer.import_graph_stream( |
| 5011 | &mut repo, |
| 5012 | all[count - 1], |
| 5013 | GitStreamLimits::new(100, 32 * 1024 * 1024).unwrap(), |
| 5014 | ); |
| 5015 | let elapsed = started.elapsed().as_secs_f64(); |
| 5016 | let mut report = serde_json::json!({"requested":count,"elapsed_seconds":elapsed,"direct":true,"ordinary_recorder_trap_enabled":true,"source_preparation_pass":false,"graph_only":true,"historical_verification":false,"post_checks":false,"materialized":false,"build_label":std::env::var("ATOMIC_DIRECT_STREAM_BUILD_LABEL").unwrap_or_else(|_|"unoptimized test".into()),"result":result.as_ref().ok().map(|outcome| serde_json::json!({"commits":outcome.commits,"batches":outcome.batches,"state":outcome.state.to_base32(),"private_publish_seconds":outcome.private_publish_seconds,"final_proof_promotion_seconds":outcome.final_proof_promotion_seconds})),"error":result.as_ref().err().map(ToString::to_string)}); |
| 5017 | fs::write( |
| 5018 | artifact.join("direct-result.json"), |
| 5019 | serde_json::to_vec_pretty(&report).unwrap(), |
| 5020 | ) |
| 5021 | .unwrap(); |
| 5022 | println!("DIRECT STREAM {report}"); |
| 5023 | result.unwrap(); |
| 5024 | assert_eq!(fs::read_dir(repo.root()).unwrap().count(), 1); |
| 5025 | drop(repo); |
| 5026 | let repo = Repository::open(artifact.join("repo")).unwrap(); |
| 5027 | assert_eq!(repo.effective_history(None).unwrap().len(), count); |
| 5028 | for oid in &all[..count] { |
| 5029 | let hash = repo.checked_git_sha(&oid.to_string()).unwrap().unwrap(); |
| 5030 | assert!(repo.load_change(&hash).unwrap().file_ops().is_empty()); |
| 5031 | } |
| 5032 | let wc = repo.require_working_copy_id().unwrap(); |
| 5033 | repo.materialize(wc).unwrap(); |
| 5034 | assert!(repo |
| 5035 | .status(wc, atomic_repository::StatusOptions::default()) |
| 5036 | .unwrap() |
| 5037 | .is_clean()); |
| 5038 | report["post_checks"] = serde_json::json!(true); |
| 5039 | report["materialized"] = serde_json::json!(true); |
| 5040 | fs::write( |
nothing calls this directly
no test coverage detected