From 0357ffe67064cde9d2087c6df213a47dd74bee04 Mon Sep 17 00:00:00 2001 From: Jakob Stoklund Olesen Date: Tue, 30 Aug 2016 07:46:18 -0700 Subject: [PATCH] Require a specific rustfmt version in test-all script. Rustfmt is still so immature that developers can't have different versions installed, or there will be minute differences in formatting causing the tests to fail. Only run rustfmt as part of the test-all script if the expected version is available. --- cranelift/test-all.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/cranelift/test-all.sh b/cranelift/test-all.sh index e4914b9541..586f2b76f1 100755 --- a/cranelift/test-all.sh +++ b/cranelift/test-all.sh @@ -21,10 +21,23 @@ function banner() { echo "====== $@ ======" } -# Run rustfmt if we have it. (Travis probably won't). -if cargo install --list | grep -q '^rustfmt '; then +# Run rustfmt if we have it. +# +# Rustfmt is still immature enough that its formatting decisions can change +# between versions. This makes it difficult to enforce a certain style in a +# test script since not all developers will upgrade rustfmt at the same time. +# To work around this, we only verify formatting when a specific version of +# rustfmt is installed. +# +# This version should always be bumped to the newest version available. +RUSTFMT_VERSION="0.5.0" + +if cargo install --list | grep -q "^rustfmt v$RUSTFMT_VERSION"; then banner "Rust formatting" $topdir/src/format-all.sh --write-mode=diff +else + echo "Please install rustfmt v$RUSTFMT_VERSION to verify formatting." + echo "If a newer version of rustfmt is available, update this script." fi PKGS="cretonne cretonne-reader cretonne-tools"