Rust-GPU / Rust-GPU/rust-gpu

[Migrated] We should replace `rustc_codegen_spirv::linker::test` unit tests with compiletest ones.

Open
#101 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
3.4k
Forks
125
PR merge metrics
No merged PRs in 30d

Description

Issue automatically imported from old repo: https://github.com/EmbarkStudios/rust-gpu/issues/957
Old labels: t: enhancement,a: test
Originally creatd by eddyb on 2022-11-30T16:58:43Z


The main unique aspect of these tests is they take SPIR-V assembly as an input, not Rust code, e.g.:
https://github.com/EmbarkStudios/rust-gpu/blob/acb05d379982f35e6d4fbd85ff28af3e9876cf4c/crates/rustc_codegen_spirv/src/linker/test.rs#L185-L202

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.:

  • #956

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with crates/rustc_codegen_spirv/src/linker/test.rs, especially the tests around the referenced lines, and review the compiletest support and issue #956. Determine whether module_asm!, compiletest dependencies, or Rust FFI can represent the SPIR-V assembly inputs. Done means the linker tests use compiletest without the artificial compiler sessions.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers, testing-qa
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.