From 97dc66a32ad948d232432e9ccc861b808e375ba5 Mon Sep 17 00:00:00 2001 From: Michael Gmelin Date: Mon, 4 Sep 2023 16:14:24 +0200 Subject: [PATCH] Fix clang version detection, update freebsd ci --- .github/workflows/ci.yml | 6 +++--- docs/DistributedFreeBSD.md | 2 +- scripts/freebsd-ci-test.sh | 7 ++++--- src/compiler/clang.rs | 6 +++--- tests/system.rs | 6 +++--- tests/test_clang_multicall.c | 2 +- 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4eecffb04..1a1aac6ec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -258,7 +258,7 @@ jobs: fail_ci_if_error: false test_freebsd: - name: test freebsd-13.1 rust stable + name: test freebsd-13.2 rust stable runs-on: ${{ matrix.job.os }} timeout-minutes: 70 strategy: @@ -266,7 +266,7 @@ jobs: matrix: job: - { os: macos-12 } - release: ["13.1"] + release: ["13.2"] steps: - uses: actions/checkout@v4 - name: Prepare, build and test @@ -317,7 +317,7 @@ jobs: if: failure() uses: ./.github/actions/artifact_failure with: - name: test-freebsd-13.1-stable + name: test-freebsd-13.2-stable release: name: release diff --git a/docs/DistributedFreeBSD.md b/docs/DistributedFreeBSD.md index a31197673..adc696558 100644 --- a/docs/DistributedFreeBSD.md +++ b/docs/DistributedFreeBSD.md @@ -25,7 +25,7 @@ It's up to the user to create the reference pot that serves as a template to clone from when instantiating image and build containers, e.g.: ```sh -pot create -p sccache-template -N alias -i "lo0|127.0.0.2" -t single -b 13.1 +pot create -p sccache-template -N alias -i "lo0|127.0.0.2" -t single -b 13.2 pot set-cmd -p sccache-template -c /usr/bin/true pot set-attr -p sccache-template -A no-rc-script -V YES pot snapshot -p sccache-template diff --git a/scripts/freebsd-ci-test.sh b/scripts/freebsd-ci-test.sh index 3d595888e..716a606ff 100755 --- a/scripts/freebsd-ci-test.sh +++ b/scripts/freebsd-ci-test.sh @@ -24,8 +24,8 @@ # $HOME/.potcache # # mkdir $HOME/.potcache -# fetch -o $HOME/.potcache/13.1-RELEASE_base.txz \ -# https://ftp.freebsd.org/pub/FreeBSD/releases/amd64/13.1-RELEASE/base.txz +# fetch -o $HOME/.potcache/13.2-RELEASE_base.txz \ +# https://ftp.freebsd.org/pub/FreeBSD/releases/amd64/13.2-RELEASE/base.txz # # This script can be run from a github action. When run locally, make # sure to install the required packages: @@ -78,7 +78,8 @@ build_and_test_project() export RUSTFLAGS="-C debuginfo=0" cargo build --features "dist-client,dist-server" || FAULT=1 echo "#### testing sccache (cargo)" - cargo test --features "dist-client,dist-server" || FAULT=1 + cargo test --features "dist-client,dist-server" -- \ + --test-threads 1 || FAULT=1 unset RUSTFLAGS if [ "$FAULT" -eq 0 ]; then # save build time by avoiding "cargo install" diff --git a/src/compiler/clang.rs b/src/compiler/clang.rs index 2903006d2..dcec258ed 100644 --- a/src/compiler/clang.rs +++ b/src/compiler/clang.rs @@ -38,9 +38,9 @@ use crate::errors::*; /// A struct on which to implement `CCompilerImpl`. #[derive(Clone, Debug)] pub struct Clang { - /// true iff this is clang++. + /// true if this is clang++. pub clangplusplus: bool, - /// true iff this is Apple's clang(++). + /// true if this is Apple's clang(++). pub is_appleclang: bool, /// String from __VERSION__ macro. pub version: Option, @@ -63,7 +63,7 @@ impl Clang { None => return false, }; - let parsed_version = match Version::parse(version_str) { + let parsed_version = match Version::parse(version_str.trim_end_matches('"')) { Ok(parsed_version) => parsed_version, Err(e) => return false, }; diff --git a/tests/system.rs b/tests/system.rs index 8c78c1fde..ae165f942 100644 --- a/tests/system.rs +++ b/tests/system.rs @@ -415,8 +415,8 @@ fn run_sccache_command_tests(compiler: Compiler, tempdir: &Path) { } // If we are testing with clang-14 or later, we expect the -fminimize-whitespace flag to be used. - if compiler.name == "clang" { - let version_cmd = Command::new(compiler.name) + if compiler.name == "clang" || compiler.name == "clang++" { + let version_cmd = Command::new(compiler.exe.clone()) .arg("--version") .output() .expect("Failure when getting compiler version"); @@ -432,7 +432,7 @@ fn run_sccache_command_tests(compiler: Compiler, tempdir: &Path) { let (major, is_appleclang) = match re.captures(version_output) { Some(c) => ( c.name("major").unwrap().as_str().parse::().unwrap(), - c.name("apple").is_none(), + c.name("apple").is_some(), ), None => panic!( "Version info not found in --version output: {}", diff --git a/tests/test_clang_multicall.c b/tests/test_clang_multicall.c index a8dd6b85e..4821a39ff 100644 --- a/tests/test_clang_multicall.c +++ b/tests/test_clang_multicall.c @@ -1,7 +1,7 @@ #include // this is c++ code, but the extension is .c, -// so clang doesn't change it's behavior because of the extension +// so clang doesn't change its behavior because of the extension int main() { std::cout << "Hello, world!" << std::endl;