Skip to content

Commit a9f722a

Browse files
committed
MINOR FIXES
1 parent 23561f5 commit a9f722a

File tree

2 files changed

+23
-10
lines changed

2 files changed

+23
-10
lines changed

process_result_md.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#!/usr/bin/env bash
12
# Enable error handling and detailed logging
23
set +e
34
set +x

tests/report_generator_test.rs

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ use qqn_optimizer::experiment_runner::{ReportGenerator, UnifiedReportTestSuite};
99

1010
#[tokio::test]
1111
async fn test_report_generator_complete_pipeline() -> anyhow::Result<()> {
12-
// Create a temporary directory for test output
13-
let temp_dir = TempDir::new()?;
14-
let output_path = temp_dir.path().to_str().unwrap().to_string();
12+
let report_path_prefix = "results/test_report_generator_";
13+
let timestamp = chrono::Utc::now().format("%Y%m%d_%H%M%S");
14+
let output_dir_name = format!("{report_path_prefix}{timestamp}");
15+
let output_dir = std::path::PathBuf::from(&output_dir_name);
16+
fs::create_dir_all(&output_dir)?;
1517

1618
// Create test data using the existing test suite
1719
let test_data = UnifiedReportTestSuite::create_test_data();
@@ -22,7 +24,7 @@ async fn test_report_generator_complete_pipeline() -> anyhow::Result<()> {
2224

2325
// Create ReportGenerator with test configuration
2426
let config = BenchmarkConfig::default();
25-
let report_generator = ReportGenerator::new(output_path.clone(), config);
27+
let report_generator = ReportGenerator::new(output_dir_name.clone(), config);
2628

2729
// Convert test data to the format expected by generate_main_report
2830
let data_refs: Vec<_> = test_data.iter().map(|(p, r)| (p, r.clone())).collect();
@@ -34,7 +36,7 @@ async fn test_report_generator_complete_pipeline() -> anyhow::Result<()> {
3436
.await?;
3537

3638
// Verify that the main output directory structure was created
37-
let output_dir = Path::new(&output_path);
39+
let output_dir = Path::new(&output_dir_name);
3840
assert!(output_dir.exists(), "Output directory should exist");
3941

4042
// Check for expected subdirectories
@@ -181,21 +183,24 @@ async fn test_report_generator_complete_pipeline() -> anyhow::Result<()> {
181183

182184
#[tokio::test]
183185
async fn test_report_generator_with_family_mode() -> anyhow::Result<()> {
184-
// Test the family optimization mode as well
185-
let temp_dir = TempDir::new()?;
186-
let output_path = temp_dir.path().to_str().unwrap().to_string();
186+
187+
let report_path_prefix = "results/test_report_generator_family_mode_";
188+
let timestamp = chrono::Utc::now().format("%Y%m%d_%H%M%S");
189+
let output_dir_name = format!("{report_path_prefix}{timestamp}");
190+
let output_dir = std::path::PathBuf::from(&output_dir_name);
191+
fs::create_dir_all(&output_dir)?;
187192

188193
let test_data = UnifiedReportTestSuite::create_test_data();
189194
let config = BenchmarkConfig::default();
190-
let report_generator = ReportGenerator::new(output_path.clone(), config);
195+
let report_generator = ReportGenerator::new(output_dir_name.clone(), config);
191196
let data_refs: Vec<_> = test_data.iter().map(|(p, r)| (p, r.clone())).collect();
192197

193198
// Run with family optimization enabled
194199
report_generator
195200
.generate_main_report(&data_refs, true)
196201
.await?;
197202

198-
let output_dir = Path::new(&output_path);
203+
let output_dir = Path::new(&output_dir_name);
199204
assert!(output_dir.exists(), "Output directory should exist");
200205

201206
// Verify the same basic structure exists
@@ -216,6 +221,13 @@ async fn test_report_generator_with_family_mode() -> anyhow::Result<()> {
216221

217222
#[test]
218223
fn test_report_generator_creation() {
224+
225+
let report_path_prefix = "results/test_report_generator_";
226+
let timestamp = chrono::Utc::now().format("%Y%m%d_%H%M%S");
227+
let output_dir_name = format!("{report_path_prefix}{timestamp}");
228+
let output_dir = std::path::PathBuf::from(&output_dir_name);
229+
fs::create_dir_all(&output_dir).unwrap();
230+
219231
// Test basic ReportGenerator creation
220232
let config = BenchmarkConfig::default();
221233
let _report_generator = ReportGenerator::new("test_output".to_string(), config);

0 commit comments

Comments
 (0)