tenseleyflow/bencch / a38177d

Browse files

Clarify standalone unavailable artifacts

Authored by espadonne
SHA
a38177d6dd32c062446dd3d9d77d6f55273cf0aa
Parents
dc213db
Tree
ab3f575

2 changed files

StatusFile+-
M .github/workflows/standalone-bootstrap.yml 10 0
M bench/src/lib.rs 79 1
.github/workflows/standalone-bootstrap.ymlmodified
@@ -59,6 +59,16 @@ jobs:
5959
           grep "backend_mode: external-driver" introspect.txt
6060
           grep "requested_artifacts: asm, runtime" introspect.txt
6161
 
62
+      - name: Verify external-only linked-only introspect guidance
63
+        run: |
64
+          if cargo run --manifest-path .bencch-external/Cargo.toml -p afs-tests --bin bencch -- introspect armfortas fixtures/runtime/if_else.f90 --artifact armfortas.ir > linked-only-introspect.txt 2>&1; then
65
+            echo "expected linked-only armfortas introspect to fail in external-only build" >&2
66
+            exit 1
67
+          fi
68
+          grep "backend_mode: unavailable" linked-only-introspect.txt
69
+          grep "failure_stage: none" linked-only-introspect.txt
70
+          grep "requested armfortas.ir" linked-only-introspect.txt
71
+
6272
       - name: Verify external-only compare
6373
         run: |
6474
           cargo run --manifest-path .bencch-external/Cargo.toml -p afs-tests --bin bencch -- compare fixtures/fake_compilers/match_42_a.sh fixtures/fake_compilers/match_42_b.sh --program fixtures/runtime/if_else.f90 > compare.txt
bench/src/lib.rsmodified
@@ -1094,6 +1094,16 @@ fn run_introspect(config: &IntrospectConfig) -> Result<ObservedProgram, String>
10941094
     })
10951095
 }
10961096
 
1097
+fn requested_linked_armfortas_artifacts(requested: &BTreeSet<ArtifactKey>) -> Vec<String> {
1098
+    requested
1099
+        .iter()
1100
+        .filter_map(|artifact| match artifact {
1101
+            ArtifactKey::Extra(name) if name.starts_with("armfortas.") => Some(name.clone()),
1102
+            _ => None,
1103
+        })
1104
+        .collect()
1105
+}
1106
+
10971107
 fn observe_compiler(
10981108
     spec: &CompilerSpec,
10991109
     program: &Path,
@@ -1143,6 +1153,33 @@ fn observe_armfortas(
11431153
     tools: &ToolchainConfig,
11441154
 ) -> Result<CompilerObservation, String> {
11451155
     let stages = armfortas_requested_stages(requested)?;
1156
+    let linked_only_artifacts = requested_linked_armfortas_artifacts(requested);
1157
+    let linked_backend = tools.armfortas_adapters();
1158
+    if !linked_only_artifacts.is_empty() && linked_backend.capture_mode_name() == "unavailable" {
1159
+        let detail = format!(
1160
+            "linked armfortas capture is unavailable in this build; requested {}; use scripts/bootstrap-linked-armfortas.sh or request only asm/obj/run from an external armfortas binary",
1161
+            linked_only_artifacts.join(", ")
1162
+        );
1163
+        return Ok(CompilerObservation {
1164
+            compiler: CompilerSpec::Named(NamedCompiler::Armfortas),
1165
+            program: program.to_path_buf(),
1166
+            opt_level,
1167
+            compile_exit_code: 1,
1168
+            artifacts: BTreeMap::from([(
1169
+                ArtifactKey::Diagnostics,
1170
+                ArtifactValue::Text(detail.clone()),
1171
+            )]),
1172
+            provenance: ObservationProvenance {
1173
+                compiler_identity: "armfortas".into(),
1174
+                adapter_kind: "named".into(),
1175
+                backend_mode: linked_backend.capture_mode_name().into(),
1176
+                backend_detail: linked_backend.capture_description().into(),
1177
+                artifacts_captured: vec!["diagnostics".into()],
1178
+                comparison_basis: None,
1179
+                failure_stage: None,
1180
+            },
1181
+        });
1182
+    }
11461183
     let cli_observable_only = requested.iter().all(|artifact| {
11471184
         matches!(
11481185
             artifact,
@@ -1169,7 +1206,7 @@ fn observe_armfortas(
11691206
         };
11701207
         (mode, detail, backend.capture(&request))
11711208
     } else {
1172
-        let backend = tools.armfortas_adapters();
1209
+        let backend = linked_backend;
11731210
         let detail = backend.capture_description().to_string();
11741211
         let mode = backend.capture_mode_name().to_string();
11751212
         let request = CaptureRequest {
@@ -5485,6 +5522,18 @@ fn compose_armfortas_failure_detail(artifacts: &ExecutionArtifacts) -> String {
54855522
 }
54865523
 
54875524
 fn compose_observation_failure_detail(observation: &CompilerObservation) -> String {
5525
+    if observation.provenance.backend_mode == "unavailable" {
5526
+        let mut detail = format!(
5527
+            "{} unavailable for requested artifacts in this build",
5528
+            observation.compiler.display_name()
5529
+        );
5530
+        if let Some(diagnostics) = observation_diagnostics_text(observation) {
5531
+            detail.push('\n');
5532
+            detail.push_str(diagnostics);
5533
+        }
5534
+        return detail;
5535
+    }
5536
+
54885537
     let mut detail = String::new();
54895538
     detail.push_str(&format!("{} failed", observation.compiler.display_name()));
54905539
     if let Some(stage) = &observation.provenance.failure_stage {
@@ -10742,6 +10791,35 @@ mod tests {
1074210791
         assert!(rendered.contains("failure_stage: none"));
1074310792
     }
1074410793
 
10794
+    #[test]
10795
+    fn compose_observation_failure_detail_uses_unavailable_wording() {
10796
+        let observation = CompilerObservation {
10797
+            compiler: CompilerSpec::Named(NamedCompiler::Armfortas),
10798
+            program: PathBuf::from("demo.f90"),
10799
+            opt_level: OptLevel::O0,
10800
+            compile_exit_code: 1,
10801
+            artifacts: BTreeMap::from([(
10802
+                ArtifactKey::Diagnostics,
10803
+                ArtifactValue::Text(
10804
+                    "linked armfortas capture is unavailable in this build".into(),
10805
+                ),
10806
+            )]),
10807
+            provenance: ObservationProvenance {
10808
+                compiler_identity: "armfortas".into(),
10809
+                adapter_kind: "named".into(),
10810
+                backend_mode: "unavailable".into(),
10811
+                backend_detail: "unavailable without linked-armfortas feature".into(),
10812
+                artifacts_captured: vec!["diagnostics".into()],
10813
+                comparison_basis: None,
10814
+                failure_stage: None,
10815
+            },
10816
+        };
10817
+
10818
+        let detail = compose_observation_failure_detail(&observation);
10819
+        assert!(detail.contains("armfortas unavailable for requested artifacts in this build"));
10820
+        assert!(!detail.contains("failed in"));
10821
+    }
10822
+
1074510823
     #[cfg(unix)]
1074610824
     #[test]
1074710825
     fn execute_generic_suite_case_uses_introspect_engine() {