From cf5edfe3f92e7b40f984c3e6336f441869901eec Mon Sep 17 00:00:00 2001 From: "许杰友 Jieyou Xu (Joe)" Date: Fri, 19 Jul 2024 09:45:11 +0000 Subject: compiletest/rmake: cleanup rmake exe extension calculation --- src/tools/compiletest/src/runtest.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index a38a900b3d8..79c63710070 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -3479,7 +3479,7 @@ impl<'test> TestCx<'test> { // We construct the following directory tree for each rmake.rs test: // ``` - // base_dir/ + // / // rmake.exe // rmake_out/ // ``` @@ -3597,13 +3597,14 @@ impl<'test> TestCx<'test> { paths }; - // Finally, we need to run the recipe binary to build and run the actual tests. - // FIXME(jieyouxu): use `std::env::consts::EXE_EXTENSION`. - let recipe_bin = base_dir.join(if self.config.target.contains("windows") { - "rmake.exe" - } else { - "rmake" - }); + // Calculate the paths of the recipe binary. As previously discussed, this is placed at + // `/` with `bin_name` being `rmake` or `rmake.exe` dependending on + // platform. + let recipe_bin = { + let mut p = base_dir.join("rmake"); + p.set_extension(env::consts::EXE_EXTENSION); + p + }; debug!(?recipe_bin); // FIXME(jieyouxu): explain what the hecc we are doing here. -- cgit 1.4.1-3-g733a5