Skip to content

Commit

Permalink
Fix clang version detection, update freebsd ci
Browse files Browse the repository at this point in the history
  • Loading branch information
grembo authored and sylvestre committed Sep 4, 2023
1 parent 1ab4cff commit 97dc66a
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 14 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -258,15 +258,15 @@ 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:
fail-fast: false
matrix:
job:
- { os: macos-12 }
release: ["13.1"]
release: ["13.2"]
steps:
- uses: actions/checkout@v4
- name: Prepare, build and test
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/DistributedFreeBSD.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions scripts/freebsd-ci-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions src/compiler/clang.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,
Expand All @@ -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,
};
Expand Down
6 changes: 3 additions & 3 deletions tests/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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::<usize>().unwrap(),
c.name("apple").is_none(),
c.name("apple").is_some(),
),
None => panic!(
"Version info not found in --version output: {}",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_clang_multicall.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <iostream>

// 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;
Expand Down

0 comments on commit 97dc66a

Please sign in to comment.