MCPcopy Create free account
hub / github.com/Rust-GPU/rust-gpu / run_mode

Method run_mode

tests/src/main.rs:95–180  ·  view source on GitHub ↗
(&self, mode: &'static str)

Source from the content-addressed store, hash-verified

93 /// backend provided by `codegen_backend_path`.
94 #[allow(clippy::string_add)]
95 fn run_mode(&self, mode: &'static str) {
96 /// RUSTFLAGS passed to all test files.
97 fn test_rustc_flags(
98 codegen_backend_path: &Path,
99 deps: &TestDeps,
100 indirect_deps_dirs: &[&Path],
101 ) -> String {
102 [
103 &*rust_flags(codegen_backend_path),
104 &*indirect_deps_dirs
105 .iter()
106 .map(|dir| format!("-L dependency={}", dir.display()))
107 .fold(String::new(), |a, b| b + " " + &a),
108 "--edition 2021",
109 &*format!("--extern noprelude:core={}", deps.core.display()),
110 &*format!(
111 "--extern noprelude:compiler_builtins={}",
112 deps.compiler_builtins.display()
113 ),
114 &*format!(
115 "--extern spirv_std_macros={}",
116 deps.spirv_std_macros.display()
117 ),
118 &*format!("--extern spirv_std={}", deps.spirv_std.display()),
119 &*format!("--extern glam={}", deps.glam.display()),
120 "--crate-type dylib",
121 "-Zunstable-options",
122 "-Zcrate-attr=no_std",
123 "-Zcrate-attr=feature(asm_const,asm_experimental_arch)",
124 ]
125 .join(" ")
126 }
127
128 struct Variation {
129 name: &'static str,
130 extra_flags: &'static str,
131 }
132 const VARIATIONS: &[Variation] = &[Variation {
133 name: "default",
134 extra_flags: "",
135 }];
136
137 for (env, variation) in self
138 .opt
139 .environments()
140 .flat_map(|env| VARIATIONS.iter().map(move |variation| (env, variation)))
141 {
142 // HACK(eddyb) in order to allow *some* tests to have separate output
143 // in different testing variations (i.e. experimental features), while
144 // keeping *most* of the tests unchanged, we make use of "stage IDs",
145 // which offer `// only-S` and `// ignore-S` for any stage ID `S`.
146 let stage_id = variation.name;
147
148 let target = format!("{TARGET_PREFIX}{env}");
149 let libs = build_deps(&self.deps_target_dir, &self.codegen_backend_path, &target);
150 let mut flags = test_rustc_flags(
151 &self.codegen_backend_path,
152 &libs,

Callers 1

mainFunction · 0.80

Calls 6

build_depsFunction · 0.85
environmentsMethod · 0.80
iterMethod · 0.80
target_dir_suffixMethod · 0.80
expectMethod · 0.80
parseMethod · 0.45

Tested by

no test coverage detected