Skip to content

Commit d53a41d

Browse files
committed
Another round of attempting ignores
1 parent 5908c88 commit d53a41d

3 files changed

Lines changed: 74 additions & 2 deletions

File tree

crates/test/src/csharp.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::{Compile, LanguageMethods, Runner, Verify};
1+
use crate::{Compile, Component, Kind, Language, LanguageMethods, RunCase, Runner, Verify};
22
use anyhow::Result;
33
use heck::*;
44
use std::env;
@@ -53,6 +53,24 @@ impl LanguageMethods for Csharp {
5353
)
5454
}
5555

56+
fn should_fail_run(&self, _runner: &Runner, case: &RunCase<'_>, component: &Component) -> bool {
57+
// TODO: remove these exclusions as bugs are fixed
58+
match case.name {
59+
// With a C# runner this test fails with "resource is of another
60+
// type" when dropping a subtask.
61+
"ping-pong" => component.kind == Kind::Runner,
62+
63+
// The C# test component fails to produce a result for its
64+
// async-lifted export when its write is cancelled by a runner
65+
// written in another language.
66+
"future-cancel-read" => {
67+
component.kind == Kind::Test && case.runner.language != Language::Csharp
68+
}
69+
70+
_ => false,
71+
}
72+
}
73+
5674
fn prepare(&self, runner: &mut Runner) -> Result<()> {
5775
runner.run_command(dotnet().arg("--version"))?;
5876

crates/test/src/go.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::{Compile, LanguageMethods, Runner, Verify};
1+
use crate::{Compile, Component, Language, LanguageMethods, RunCase, Runner, Verify};
22
use anyhow::{Context as _, Result};
33
use std::env;
44
use std::fs;
@@ -73,6 +73,19 @@ impl LanguageMethods for Go {
7373
false
7474
}
7575

76+
fn should_fail_run(
77+
&self,
78+
_runner: &Runner,
79+
case: &RunCase<'_>,
80+
_component: &Component,
81+
) -> bool {
82+
// The C components of the `strings` test use `--string-encoding
83+
// utf16`, so adapters composed between this Go component and a C
84+
// component transcode strings, which requires reallocation support in
85+
// `cabi_realloc` that the Go support library does not yet implement.
86+
case.name == "strings" && case.components().any(|c| c.language == Language::C)
87+
}
88+
7689
fn default_bindgen_args_for_codegen(&self) -> &[&str] {
7790
&["--generate-stubs"]
7891
}

crates/test/src/lib.rs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,24 @@ struct Verify<'a> {
251251
world: &'a str,
252252
}
253253

254+
/// Helper structure describing a single composed runtime test case, sent to
255+
/// `LanguageMethods::should_fail_run`.
256+
struct RunCase<'a> {
257+
/// The name of the test, e.g. the directory name such as `ping-pong`.
258+
name: &'a str,
259+
/// The component providing the "runner" world for this case.
260+
runner: &'a Component,
261+
/// The components providing "test" worlds composed with `runner`.
262+
tests: &'a [&'a Component],
263+
}
264+
265+
impl RunCase<'_> {
266+
/// Returns all components involved in this case.
267+
fn components(&self) -> impl Iterator<Item = &Component> {
268+
[self.runner].into_iter().chain(self.tests.iter().copied())
269+
}
270+
}
271+
254272
/// Helper structure to package up runtime state associated with executing tests.
255273
struct Runner {
256274
opts: Opts,
@@ -767,6 +785,16 @@ impl Runner {
767785
component.path.file_name().unwrap().to_str().unwrap()
768786
));
769787
}
788+
let should_fail = {
789+
let tests = test_components.iter().map(|(c, _)| c).collect::<Vec<_>>();
790+
let case = RunCase {
791+
name: &case_name,
792+
runner: &runner,
793+
tests: &tests,
794+
};
795+
case.components()
796+
.any(|c| c.language.obj().should_fail_run(self, &case, c))
797+
};
770798
let case_name = case_name.to_string();
771799
let runner = runner.clone();
772800
let runner_path = runner_path.to_path_buf();
@@ -777,6 +805,7 @@ impl Runner {
777805
.with_context(|| format!("failed to run `{}`", case.name));
778806
me.render_error(
779807
StepResult::new(result)
808+
.should_fail(should_fail)
780809
.metadata("runner", runner.path.display())
781810
.metadata("compiled runner", runner_path.display()),
782811
)
@@ -1308,6 +1337,18 @@ trait LanguageMethods {
13081337
false
13091338
}
13101339

1340+
/// Returns whether this language expects the composed runtime test `case`
1341+
/// to fail to execute, where `component` is this language's component
1342+
/// within the case.
1343+
///
1344+
/// This is invoked once per component in a case, so `component` may be
1345+
/// either the runner or one of the test components; the case is expected
1346+
/// to fail if any component's language says so.
1347+
fn should_fail_run(&self, runner: &Runner, case: &RunCase<'_>, component: &Component) -> bool {
1348+
let _ = (runner, case, component);
1349+
false
1350+
}
1351+
13111352
/// Performs a "check" or a verify that the generated bindings described by
13121353
/// `Verify` are indeed valid.
13131354
fn verify(&self, runner: &Runner, verify: &Verify) -> Result<()>;

0 commit comments

Comments
 (0)