Reland [mlir] Fix integration test when %host_cc path contains spaces (#128542)

Reland https://github.com/llvm/llvm-project/pull/128439

Some builders have spaces at the end of the `host_cc` path.
diff --git a/mlir/test/Integration/Dialect/MemRef/memref_abi.c b/mlir/test/Integration/Dialect/MemRef/memref_abi.c
index 3fb1917..110ab44 100644
--- a/mlir/test/Integration/Dialect/MemRef/memref_abi.c
+++ b/mlir/test/Integration/Dialect/MemRef/memref_abi.c
@@ -12,7 +12,7 @@
 // RUN: llc %t.ll -o %t.o -filetype=obj
 
 // Compile the current C file and link it to the MLIR code:
-// RUN: %host_cc %s %t.o -o %t.exe
+// RUN: "%host_cc" %s %t.o -o %t.exe
 
 // Exec
 // RUN: %t.exe | FileCheck %s
diff --git a/mlir/test/lit.cfg.py b/mlir/test/lit.cfg.py
index 8578c769..9b5cadd 100644
--- a/mlir/test/lit.cfg.py
+++ b/mlir/test/lit.cfg.py
@@ -56,8 +56,8 @@
 config.substitutions.append(("%shlibext", config.llvm_shlib_ext))
 config.substitutions.append(("%llvm_src_root", config.llvm_src_root))
 config.substitutions.append(("%mlir_src_root", config.mlir_src_root))
-config.substitutions.append(("%host_cxx", config.host_cxx))
-config.substitutions.append(("%host_cc", config.host_cc))
+config.substitutions.append(("%host_cxx", config.host_cxx.strip()))
+config.substitutions.append(("%host_cc", config.host_cc.strip()))
 
 
 # Searches for a runtime library with the given name and returns the found path.