From 19198f4709119f276fcf8340487dfae4a828f681 Mon Sep 17 00:00:00 2001 From: ptaylor Date: Fri, 18 Oct 2024 07:43:27 +0000 Subject: [PATCH] Test nvcc and clang-cuda in workflows/ci.yml * Test nvcc and clang-cuda in workflows/ci.yml * Fix clang-cuda tests * Ensure /tmp/sccache_*.txt files are included in failed job artifacts on Windows --- .github/actions/artifact_failure/action.yml | 7 +- .github/actions/nvcc-toolchain/action.yml | 16 ++++ .../actions/nvcc-toolchain/install-cuda.ps1 | 50 +++++++++++++ .../actions/nvcc-toolchain/install-cuda.sh | 72 ++++++++++++++++++ .github/workflows/ci.yml | 74 +++++++++++++++++-- src/compiler/clang.rs | 20 +++++ src/compiler/gcc.rs | 37 ++++++++-- src/compiler/nvhpc.rs | 1 + src/config.rs | 2 + tests/system.rs | 70 ++++++++++++------ 10 files changed, 309 insertions(+), 40 deletions(-) create mode 100644 .github/actions/nvcc-toolchain/action.yml create mode 100644 .github/actions/nvcc-toolchain/install-cuda.ps1 create mode 100755 .github/actions/nvcc-toolchain/install-cuda.sh diff --git a/.github/actions/artifact_failure/action.yml b/.github/actions/artifact_failure/action.yml index d83c7622..071fe091 100644 --- a/.github/actions/artifact_failure/action.yml +++ b/.github/actions/artifact_failure/action.yml @@ -16,7 +16,8 @@ runs: lsof +D `pwd` || true killall sccache || true killall sccache-dist || true - + # possible temp dirs for either linux or windows + cp "${TMP:-${TEMP:-${TMPDIR:-/tmp}}}"/sccache_*.txt . 2>/dev/null || true tar --exclude='target' \ --exclude='docs' \ --exclude='bins' \ @@ -25,6 +26,4 @@ runs: - uses: actions/upload-artifact@v3 with: name: ${{ inputs.name }} - path: | - target/failure-${{ inputs.name }}.tar.gz - /tmp/sccache_*.txt + path: target/failure-${{ inputs.name }}.tar.gz diff --git a/.github/actions/nvcc-toolchain/action.yml b/.github/actions/nvcc-toolchain/action.yml new file mode 100644 index 00000000..9154b941 --- /dev/null +++ b/.github/actions/nvcc-toolchain/action.yml @@ -0,0 +1,16 @@ +name: nvcc-toolchain +inputs: + cuda-version: + description: CUDA Toolkit version + required: true + +runs: + using: composite + steps: + - if: runner.os == 'Linux' + shell: bash + run: .github/actions/nvcc-toolchain/install-cuda.sh ${{ inputs.cuda-version }} + + - if: runner.os == 'Windows' + shell: powershell + run: .\.github\actions\nvcc-toolchain\install-cuda.ps1 -cudaVersion ${{ inputs.cuda-version }} diff --git a/.github/actions/nvcc-toolchain/install-cuda.ps1 b/.github/actions/nvcc-toolchain/install-cuda.ps1 new file mode 100644 index 00000000..a0732e15 --- /dev/null +++ b/.github/actions/nvcc-toolchain/install-cuda.ps1 @@ -0,0 +1,50 @@ +Param( + [Parameter(Mandatory=$false)] + [string] + $cudaVersion="12.6.0" +) + +# Use System.Version to tokenize version +$version = [Version]$cudaVersion + +$major = $version.Major +$minor = $version.Minor +$build = $version.Build + +# Minimum build is 0, not -1 as default in case "12.5" is passed +if ($build -lt 0) { + $build = 0 +} + +# mmb == major minor build +$mmbVersionTag = "${major}.${minor}.${build}" +# mm = major minor +$mmVersionTag = "${major}.${minor}" + +# `cuda_${mmbVersionTag}_windows_network.exe` name only valid back to CUDA v11.5.1. +# Before that it was named `cuda_${mmbVersionTag}_win10_network.exe`. +$cudaVersionUrl = "https://developer.download.nvidia.com/compute/cuda/${mmbVersionTag}/network_installers/cuda_${mmbVersionTag}_windows_network.exe" +$cudaComponents = + "nvcc_$mmVersionTag", + "curand_$mmVersionTag", + "curand_dev_$mmVersionTag", + "cudart_$mmVersionTag", + "cupti_$mmVersionTag", + "nvrtc_$mmVersionTag", + "nvrtc_dev_$mmVersionTag", + "nvml_dev_$mmVersionTag", + "nvtx_$mmVersionTag" + +Invoke-WebRequest -Uri "$cudaVersionUrl" -OutFile "./cuda_network.exe" -UseBasicParsing +Start-Process -Wait -PassThru -FilePath .\cuda_network.exe -ArgumentList "-s $cudaComponents" + +$ENV:PATH="$ENV:PATH;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v$mmVersionTag\bin" +$ENV:CUDA_PATH="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v$mmVersionTag" + +$PATH_STR="PATH=$ENV:PATH" +$PATH_STR | Out-File -Append $ENV:GITHUB_ENV + +$CUDA_PATH_STR="CUDA_PATH=$ENV:CUDA_PATH" +$CUDA_PATH_STR | Out-File -Append $ENV:GITHUB_ENV + +Remove-Item .\cuda_network.exe diff --git a/.github/actions/nvcc-toolchain/install-cuda.sh b/.github/actions/nvcc-toolchain/install-cuda.sh new file mode 100755 index 00000000..8a9e7617 --- /dev/null +++ b/.github/actions/nvcc-toolchain/install-cuda.sh @@ -0,0 +1,72 @@ +#! /usr/bin/env bash +set -eu + +export DEBIAN_FRONTEND=noninteractive + +get_cuda_deb() { + local deb="$( \ + wget --no-hsts -q -O- "${1}/Packages" \ + | grep -P "^Filename: \./${2}(.*)\.deb$" \ + | sort -Vr | head -n1 | cut -d' ' -f2 \ + )"; + if [ -z "$deb" ]; then + echo "Error: No matching .deb found for '${1}' and '${2}'" >&2 + return 1 + fi + wget --no-hsts -q -O "/tmp/${deb#./}" "${1}/${deb#./}"; + echo -n "/tmp/${deb#./}"; +} + +VERSION="$1"; + +NVARCH="$(uname -p)"; + +if test "$NVARCH" = aarch64; then + NVARCH="sbsa"; +fi + +OSNAME="$( + . /etc/os-release; + major="$(cut -d'.' -f1 <<< "${VERSION_ID}")"; + minor="$(cut -d'.' -f2 <<< "${VERSION_ID}")"; + echo "$ID$((major - (major % 2)))${minor}"; +)"; + +CUDA_HOME="/usr/local/cuda"; + +cuda_repo_base="https://developer.download.nvidia.com/compute/cuda/repos"; +cuda_repo="${cuda_repo_base}/${OSNAME}/${NVARCH}"; + +cuda_ver="$VERSION"; +cuda_ver="$(grep -Po '^[0-9]+\.[0-9]+' <<< "${cuda_ver}")"; +cuda_ver="${cuda_ver/./-}"; + +if ! dpkg -s cuda-keyring; then + sudo apt-get install -y --no-install-recommends \ + "$(get_cuda_deb "${cuda_repo}" cuda-keyring)" \ + ; +fi + +PKGS=(); +PKGS+=("cuda-toolkit-${cuda_ver}"); + +sudo apt-get update; +sudo apt-get install -y --no-install-recommends "${PKGS[@]}"; + +if ! test -L "${CUDA_HOME}"; then + # Create /usr/local/cuda symlink + sudo ln -s "${CUDA_HOME}-${cuda_ver}" "${CUDA_HOME}"; +fi + +export PATH="$PATH:$CUDA_HOME/bin" + +which -a nvcc +nvcc --version + +cat </dev/null 2>&1; then + sudo apt remove -y gcc-14 g++-14 + sudo apt autoremove -y + fi + sudo apt install -y --no-install-recommends clang gcc + echo 'gcc version:' + gcc --version + echo 'clang version:' + clang --version + + - if: matrix.cuda != '' && contains(fromJSON('["Linux", "Windows"]'), runner.os) + name: Install nvcc + uses: ./.github/actions/nvcc-toolchain + with: + cuda-version: ${{ matrix.cuda }} - name: Build tests run: cargo test --no-run --locked --all-targets ${{ matrix.extra_args }} @@ -206,7 +257,8 @@ jobs: fail-fast: false matrix: include: - - os: ubuntu-20.04 + - os: ubuntu-22.04 + cuda: "11.8" rustc: nightly allow_failure: true extra_args: --features=unstable @@ -231,6 +283,12 @@ jobs: run: sudo apt-get install -y clang gcc if: ${{ matrix.os == 'ubuntu-20.04' }} + - if: matrix.cuda != '' && contains(fromJSON('["Linux", "Windows"]'), runner.os) + name: Install nvcc + uses: ./.github/actions/nvcc-toolchain + with: + cuda-version: ${{ matrix.cuda }} + - name: "`grcov` ~ install" run: cargo install grcov diff --git a/src/compiler/clang.rs b/src/compiler/clang.rs index 29e8f17b..44215120 100644 --- a/src/compiler/clang.rs +++ b/src/compiler/clang.rs @@ -140,6 +140,7 @@ impl CCompilerImpl for Clang { self.kind(), rewrite_includes_only, ignorable_whitespace_flags, + language_to_clang_arg, ) .await } @@ -168,6 +169,7 @@ impl CCompilerImpl for Clang { env_vars, self.kind(), rewrite_includes_only, + language_to_clang_arg, ) .map(|(command, dist_command, cacheable)| { (CCompileCommand::new(command), dist_command, cacheable) @@ -175,6 +177,24 @@ impl CCompilerImpl for Clang { } } +pub fn language_to_clang_arg(lang: Language) -> Option<&'static str> { + match lang { + Language::C => Some("c"), + Language::CHeader => Some("c-header"), + Language::Cxx => Some("c++"), + Language::CxxHeader => Some("c++-header"), + Language::ObjectiveC => Some("objective-c"), + Language::ObjectiveCxx => Some("objective-c++"), + Language::ObjectiveCxxHeader => Some("objective-c++-header"), + Language::Cuda => Some("cuda"), + Language::Ptx => None, + Language::Cubin => None, + Language::Rust => None, // Let the compiler decide + Language::Hip => Some("hip"), + Language::GenericHeader => None, // Let the compiler decide + } +} + counted_array!(pub static ARGS: [ArgInfo; _] = [ take_arg!("--dependent-lib", OsString, Concatenated('='), PassThrough), take_arg!("--hip-device-lib-path", PathBuf, Concatenated('='), PassThroughPath), diff --git a/src/compiler/gcc.rs b/src/compiler/gcc.rs index 1e334c65..b854a4fb 100644 --- a/src/compiler/gcc.rs +++ b/src/compiler/gcc.rs @@ -90,6 +90,7 @@ impl CCompilerImpl for Gcc { self.kind(), rewrite_includes_only, ignorable_whitespace_flags, + language_to_gcc_arg, ) .await } @@ -118,6 +119,7 @@ impl CCompilerImpl for Gcc { env_vars, self.kind(), rewrite_includes_only, + language_to_gcc_arg, ) .map(|(command, dist_command, cacheable)| { (CCompileCommand::new(command), dist_command, cacheable) @@ -710,7 +712,7 @@ pub fn language_to_gcc_arg(lang: Language) -> Option<&'static str> { } #[allow(clippy::too_many_arguments)] -fn preprocess_cmd( +fn preprocess_cmd( cmd: &mut T, parsed_args: &ParsedArguments, cwd: &Path, @@ -719,10 +721,12 @@ fn preprocess_cmd( kind: CCompilerKind, rewrite_includes_only: bool, ignorable_whitespace_flags: Vec, + language_to_arg: F, ) where + F: Fn(Language) -> Option<&'static str>, T: RunCommand, { - let language = language_to_gcc_arg(parsed_args.language); + let language = language_to_arg(parsed_args.language); if let Some(lang) = &language { cmd.arg("-x").arg(lang); } @@ -791,7 +795,7 @@ fn preprocess_cmd( } #[allow(clippy::too_many_arguments)] -pub async fn preprocess( +pub async fn preprocess( creator: &T, executable: &Path, parsed_args: &ParsedArguments, @@ -801,8 +805,10 @@ pub async fn preprocess( kind: CCompilerKind, rewrite_includes_only: bool, ignorable_whitespace_flags: Vec, + language_to_arg: F, ) -> Result where + F: Fn(Language) -> Option<&'static str>, T: CommandCreatorSync, { trace!("preprocess"); @@ -816,6 +822,7 @@ where kind, rewrite_includes_only, ignorable_whitespace_flags, + language_to_arg, ); if log_enabled!(Trace) { trace!("preprocess: {:?}", cmd); @@ -823,7 +830,8 @@ where run_input_output(cmd, None).await } -pub fn generate_compile_commands( +#[allow(clippy::too_many_arguments)] +pub fn generate_compile_commands( path_transformer: &mut dist::PathTransformer, executable: &Path, parsed_args: &ParsedArguments, @@ -831,11 +839,15 @@ pub fn generate_compile_commands( env_vars: &[(OsString, OsString)], kind: CCompilerKind, rewrite_includes_only: bool, + language_to_arg: F, ) -> Result<( SingleCompileCommand, Option, Cacheable, -)> { +)> +where + F: Fn(Language) -> Option<&'static str>, +{ // Unused arguments #[cfg(not(feature = "dist-client"))] { @@ -853,7 +865,7 @@ pub fn generate_compile_commands( // Pass the language explicitly as we might have gotten it from the // command line. - let language = language_to_gcc_arg(parsed_args.language); + let language = language_to_arg(parsed_args.language); let mut arguments: Vec = vec![]; if let Some(lang) = &language { arguments.extend(vec!["-x".into(), lang.into()]) @@ -885,7 +897,7 @@ pub fn generate_compile_commands( let dist_command = (|| { // https://gcc.gnu.org/onlinedocs/gcc-4.9.0/gcc/Overall-Options.html let mut language: Option = - language_to_gcc_arg(parsed_args.language).map(|lang| lang.into()); + language_to_arg(parsed_args.language).map(|lang| lang.into()); if !rewrite_includes_only { match parsed_args.language { Language::C => language = Some("cpp-output".into()), @@ -1689,6 +1701,7 @@ mod test { CCompilerKind::Gcc, true, vec![], + language_to_gcc_arg, ); // make sure the architectures were rewritten to prepocessor defines let expected_args = ovec![ @@ -1724,6 +1737,7 @@ mod test { CCompilerKind::Gcc, true, vec![], + language_to_gcc_arg, ); // make sure the architectures were rewritten to prepocessor defines let expected_args = ovec![ @@ -1758,6 +1772,7 @@ mod test { CCompilerKind::Clang, true, vec![], + language_to_gcc_arg, ); let expected_args = ovec!["-x", "c", "-E", "-frewrite-includes", "--", "foo.c"]; assert_eq!(cmd.args, expected_args); @@ -1783,6 +1798,7 @@ mod test { CCompilerKind::Gcc, true, vec![], + language_to_gcc_arg, ); // disable with extensions enabled assert!(!cmd.args.contains(&"-fdirectives-only".into())); @@ -1808,6 +1824,7 @@ mod test { CCompilerKind::Gcc, true, vec![], + language_to_gcc_arg, ); // no reason to disable it with no extensions enabled assert!(cmd.args.contains(&"-fdirectives-only".into())); @@ -1833,6 +1850,7 @@ mod test { CCompilerKind::Gcc, true, vec![], + language_to_gcc_arg, ); // disable with extensions enabled assert!(!cmd.args.contains(&"-fdirectives-only".into())); @@ -2178,6 +2196,7 @@ mod test { &[], CCompilerKind::Gcc, false, + language_to_gcc_arg, ) .unwrap(); #[cfg(feature = "dist-client")] @@ -2208,6 +2227,7 @@ mod test { &[], CCompilerKind::Clang, false, + language_to_gcc_arg, ) .unwrap(); let expected_args = ovec!["-x", "c", "-c", "-o", "foo.o", "--", "foo.c"]; @@ -2268,6 +2288,7 @@ mod test { CCompilerKind::Gcc, true, vec![], + language_to_gcc_arg, ); assert!(cmd.args.contains(&"-x".into()) && cmd.args.contains(&"c++-header".into())); } @@ -2292,6 +2313,7 @@ mod test { CCompilerKind::Gcc, true, vec![], + language_to_gcc_arg, ); assert!(cmd.args.contains(&"-x".into()) && cmd.args.contains(&"c++-header".into())); } @@ -2316,6 +2338,7 @@ mod test { CCompilerKind::Gcc, true, vec![], + language_to_gcc_arg, ); assert!(!cmd.args.contains(&"-x".into())); } diff --git a/src/compiler/nvhpc.rs b/src/compiler/nvhpc.rs index 71ea26d3..5c1788fe 100644 --- a/src/compiler/nvhpc.rs +++ b/src/compiler/nvhpc.rs @@ -180,6 +180,7 @@ impl CCompilerImpl for Nvhpc { env_vars, self.kind(), rewrite_includes_only, + gcc::language_to_gcc_arg, ) .map(|(command, dist_command, cacheable)| { (CCompileCommand::new(command), dist_command, cacheable) diff --git a/src/config.rs b/src/config.rs index fbc94ce7..23570ed4 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1391,6 +1391,7 @@ fn test_s3_no_credentials_valid_false() { #[test] fn test_gcs_service_account() { + env::set_var("SCCACHE_S3_NO_CREDENTIALS", "false"); env::set_var("SCCACHE_GCS_BUCKET", "my-bucket"); env::set_var("SCCACHE_GCS_SERVICE_ACCOUNT", "my@example.com"); env::set_var("SCCACHE_GCS_RW_MODE", "READ_WRITE"); @@ -1410,6 +1411,7 @@ fn test_gcs_service_account() { None => unreachable!(), }; + env::remove_var("SCCACHE_S3_NO_CREDENTIALS"); env::remove_var("SCCACHE_GCS_BUCKET"); env::remove_var("SCCACHE_GCS_SERVICE_ACCOUNT"); env::remove_var("SCCACHE_GCS_RW_MODE"); diff --git a/tests/system.rs b/tests/system.rs index d009b7fb..7330519d 100644 --- a/tests/system.rs +++ b/tests/system.rs @@ -128,7 +128,17 @@ fn compile_cuda_cmdline>( exe, compile_flag, input, - "--cuda-gpu-arch=sm_50", + "--cuda-gpu-arch=sm_70", + format!( + "--cuda-path={}", + env::var_os("CUDA_PATH") + .or(env::var_os("CUDA_HOME")) + .unwrap_or("/usr/local/cuda".into()) + .to_string_lossy() + ), + "--no-cuda-version-check", + // work around for clang-cuda on windows-2019 (https://github.com/microsoft/STL/issues/2359) + "-D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH", "-o", output ) @@ -206,7 +216,7 @@ fn test_basic_compile(compiler: Compiler, tempdir: &Path) { exe, env_vars, } = compiler; - trace!("run_sccache_command_test: {}", name); + println!("test_basic_compile: {}", name); // Compile a source file. copy_to_tempdir(&[INPUT, INPUT_ERR], tempdir); @@ -258,7 +268,7 @@ fn test_noncacheable_stats(compiler: Compiler, tempdir: &Path) { exe, env_vars, } = compiler; - trace!("test_noncacheable_stats: {}", name); + println!("test_noncacheable_stats: {}", name); copy_to_tempdir(&[INPUT], tempdir); trace!("compile"); @@ -517,7 +527,7 @@ fn test_gcc_clang_no_warnings_from_macro_expansion(compiler: Compiler, tempdir: exe, env_vars, } = compiler; - trace!("test_gcc_clang_no_warnings_from_macro_expansion: {}", name); + println!("test_gcc_clang_no_warnings_from_macro_expansion: {}", name); // Compile a source file. copy_to_tempdir(&[INPUT_MACRO_EXPANSION], tempdir); @@ -543,7 +553,7 @@ fn test_compile_with_define(compiler: Compiler, tempdir: &Path) { exe, env_vars, } = compiler; - trace!("test_compile_with_define: {}", name); + println!("test_compile_with_define: {}", name); // Compile a source file. copy_to_tempdir(&[INPUT_WITH_DEFINE], tempdir); @@ -631,7 +641,7 @@ fn test_nvcc_cuda_compiles(compiler: &Compiler, tempdir: &Path) { exe, env_vars, } = compiler; - trace!("run_sccache_command_test: {}", name); + println!("test_nvcc_cuda_compiles: {}", name); // Compile multiple source files. copy_to_tempdir(&[INPUT_FOR_CUDA_A, INPUT_FOR_CUDA_B], tempdir); @@ -642,6 +652,7 @@ fn test_nvcc_cuda_compiles(compiler: &Compiler, tempdir: &Path) { name, exe, "-c", + // relative path for input INPUT_FOR_CUDA_A, // relative path for output out_file.file_name().unwrap().to_string_lossy().as_ref(), @@ -677,6 +688,7 @@ fn test_nvcc_cuda_compiles(compiler: &Compiler, tempdir: &Path) { name, exe, "-c", + // relative path for input INPUT_FOR_CUDA_A, // absolute path for output out_file.to_string_lossy().as_ref(), @@ -720,7 +732,8 @@ fn test_nvcc_cuda_compiles(compiler: &Compiler, tempdir: &Path) { name, exe, "-c", - INPUT_FOR_CUDA_B, + // absolute path for input + &tempdir.join(INPUT_FOR_CUDA_B).to_string_lossy(), // absolute path for output out_file.to_string_lossy().as_ref(), Vec::new(), @@ -848,7 +861,7 @@ fn test_nvcc_proper_lang_stat_tracking(compiler: Compiler, tempdir: &Path) { } = compiler; zero_stats(); - trace!("run_sccache_command_test: {}", name); + println!("test_nvcc_proper_lang_stat_tracking: {}", name); // Compile multiple source files. copy_to_tempdir(&[INPUT_FOR_CUDA_C, INPUT], tempdir); @@ -925,7 +938,7 @@ fn test_clang_cuda_compiles(compiler: &Compiler, tempdir: &Path) { exe, env_vars, } = compiler; - trace!("run_sccache_command_test: {}", name); + println!("test_clang_cuda_compiles: {}", name); // Compile multiple source files. copy_to_tempdir(&[INPUT_FOR_CUDA_A, INPUT_FOR_CUDA_B], tempdir); @@ -1022,16 +1035,17 @@ fn test_clang_proper_lang_stat_tracking(compiler: Compiler, tempdir: &Path) { } = compiler; zero_stats(); - trace!("run_sccache_command_test: {}", name); + println!("test_clang_proper_lang_stat_tracking: {}", name); // Compile multiple source files. copy_to_tempdir(&[INPUT_FOR_CUDA_C, INPUT], tempdir); let out_file = tempdir.join(OUTPUT); trace!("compile CUDA A"); sccache_command() - .args(compile_cmdline( + .args(compile_cuda_cmdline( name, &exe, + "-c", INPUT_FOR_CUDA_C, OUTPUT, Vec::new(), @@ -1043,9 +1057,10 @@ fn test_clang_proper_lang_stat_tracking(compiler: Compiler, tempdir: &Path) { fs::remove_file(&out_file).unwrap(); trace!("compile CUDA A"); sccache_command() - .args(compile_cmdline( + .args(compile_cuda_cmdline( name, &exe, + "-c", INPUT_FOR_CUDA_C, OUTPUT, Vec::new(), @@ -1096,7 +1111,7 @@ fn test_hip_compiles(compiler: &Compiler, tempdir: &Path) { exe, env_vars, } = compiler; - trace!("run_sccache_command_test: {}", name); + println!("test_hip_compiles: {}", name); // Compile multiple source files. copy_to_tempdir(&[INPUT_FOR_HIP_A, INPUT_FOR_HIP_B], tempdir); @@ -1193,7 +1208,7 @@ fn test_hip_compiles_multi_targets(compiler: &Compiler, tempdir: &Path) { exe, env_vars, } = compiler; - trace!("run_sccache_command_test: {}", name); + println!("test_hip_compiles_multi_targets: {}", name); // Compile multiple source files. copy_to_tempdir(&[INPUT_FOR_HIP_A, INPUT_FOR_HIP_B], tempdir); @@ -1330,13 +1345,13 @@ fn test_clang_cache_whitespace_normalization( exe, env_vars, } = compiler; - println!("run_sccache_command_test: {}", name); - println!("expecting hit: {}", hit); + println!("test_clang_cache_whitespace_normalization: {}", name); + debug!("expecting hit: {}", hit); // Compile a source file. copy_to_tempdir(&[INPUT_WITH_WHITESPACE, INPUT_WITH_WHITESPACE_ALT], tempdir); zero_stats(); - println!("compile whitespace"); + debug!("compile whitespace"); sccache_command() .args(compile_cmdline( name, @@ -1349,7 +1364,7 @@ fn test_clang_cache_whitespace_normalization( .envs(env_vars.clone()) .assert() .success(); - println!("request stats"); + debug!("request stats"); get_stats(|info| { assert_eq!(1, info.stats.compile_requests); assert_eq!(1, info.stats.requests_executed); @@ -1357,7 +1372,7 @@ fn test_clang_cache_whitespace_normalization( assert_eq!(1, info.stats.cache_misses.all()); }); - println!("compile whitespace_alt"); + debug!("compile whitespace_alt"); sccache_command() .args(compile_cmdline( name, @@ -1370,7 +1385,7 @@ fn test_clang_cache_whitespace_normalization( .envs(env_vars) .assert() .success(); - println!("request stats (expecting cache hit)"); + debug!("request stats (expecting cache hit)"); if hit { get_stats(move |info| { assert_eq!(2, info.stats.compile_requests); @@ -1444,7 +1459,13 @@ fn find_cuda_compilers() -> Vec { }) }) .collect::>(), - Err(_) => vec![], + Err(_) => { + eprintln!( + "unable to find `nvcc` in PATH={:?}", + env::var_os("PATH").unwrap_or_default() + ); + vec![] + } }; compilers } @@ -1544,6 +1565,13 @@ fn test_cuda_sccache_command(preprocessor_cache_mode: bool) { .tempdir() .unwrap(); let compilers = find_cuda_compilers(); + println!( + "CUDA compilers: {:?}", + compilers + .iter() + .map(|c| c.exe.to_string_lossy()) + .collect::>() + ); if compilers.is_empty() { warn!("No compilers found, skipping test"); } else {