Skip to content

We should replace rustc_codegen_spirv::linker::test unit tests with compiletest ones. #957

Open
@eddyb

Description

@eddyb

The main unique aspect of these tests is they take SPIR-V assembly as an input, not Rust code, e.g.:

#[test]
fn unresolved_symbol() {
let a = assemble_spirv(
r#"OpCapability Linkage
OpDecorate %1 LinkageAttributes "foo" Import
%2 = OpTypeFloat 32
%1 = OpVariable %2 Uniform"#,
);
let b = assemble_spirv("OpCapability Linkage");
let result = assemble_and_link(&[&a, &b]);
assert_eq!(
result.err().as_deref(),
Some("error: Unresolved symbol \"foo\"")
);
}

However, we might be able to use module_asm! to feed SPIR-V assembly into the compilation, and compiletest does have the ability to introduce dependencies to link against. The main weirdness we might need to deal with is all the definitions from e.g. core that we don't use, but DCE might be able to clean that up.

(Or we could even use e.g. extern "C" FFI in Rust code to describe such situations without module_asm! at all!)

If we can do this transition, we wouldn't have to deal with weird artificial compiler sessions and e.g.:

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: testIssues around testing rust-gpu.t: enhancementA new feature or improvement to an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions