about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-12-12 14:42:28 +0000
committerbors <bors@rust-lang.org>2020-12-12 14:42:28 +0000
commit18c5ea490584fe166b7640fa19f850405f9b9e56 (patch)
tree8370c4c91a892041290a52ee7b736c812ab35fae /tests
parentbaf5f2da8b99c23bed127912f79532eb497b3e0b (diff)
parentb8501e1be12594145bcd2bae2b47af2152785622 (diff)
downloadrust-18c5ea490584fe166b7640fa19f850405f9b9e56.tar.gz
rust-18c5ea490584fe166b7640fa19f850405f9b9e56.zip
Auto merge of #6413 - phansch:bless, r=flip1995
Rewrite update-all-references bash scripts in Rust

This replaces the `update-all-references` scripts with a single

    cargo dev bless

command. It should behave mostly the same as the bash scripts. The major difference is, that it can be called from the project root and will always update the files in all of the test suites.

cc #5394

changelog: none
Diffstat (limited to 'tests')
-rwxr-xr-xtests/ui-cargo/update-all-references.sh17
-rwxr-xr-xtests/ui-cargo/update-references.sh46
-rwxr-xr-xtests/ui-toml/update-all-references.sh17
-rwxr-xr-xtests/ui-toml/update-references.sh46
-rwxr-xr-xtests/ui/update-all-references.sh20
-rwxr-xr-xtests/ui/update-references.sh56
6 files changed, 3 insertions, 199 deletions
diff --git a/tests/ui-cargo/update-all-references.sh b/tests/ui-cargo/update-all-references.sh
index 7028b251ea0..4391499a1e1 100755
--- a/tests/ui-cargo/update-all-references.sh
+++ b/tests/ui-cargo/update-all-references.sh
@@ -1,18 +1,3 @@
 #!/bin/bash
-#
-# A script to update the references for all tests. The idea is that
-# you do a run, which will generate files in the build directory
-# containing the (normalized) actual output of the compiler. You then
-# run this script, which will copy those files over. If you find
-# yourself manually editing a foo.stderr file, you're doing it wrong.
-#
-# See all `update-references.sh`, if you just want to update a single test.
 
-if [[ "$1" == "--help" || "$1" == "-h" ]]; then
-    echo "usage: $0"
-fi
-
-BUILD_DIR=$PWD/target/debug/test_build_base
-MY_DIR=$(dirname "$0")
-cd "$MY_DIR" || exit
-find . -name '*.rs' -exec ./update-references.sh "$BUILD_DIR" {} +
+echo "Please use 'cargo dev bless' instead."
diff --git a/tests/ui-cargo/update-references.sh b/tests/ui-cargo/update-references.sh
deleted file mode 100755
index 2ab51168bca..00000000000
--- a/tests/ui-cargo/update-references.sh
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/bin/bash
-
-# A script to update the references for particular tests. The idea is
-# that you do a run, which will generate files in the build directory
-# containing the (normalized) actual output of the compiler. This
-# script will then copy that output and replace the "expected output"
-# files. You can then commit the changes.
-#
-# If you find yourself manually editing a foo.stderr file, you're
-# doing it wrong.
-
-if [[ "$1" == "--help" || "$1" == "-h" || "$1" == "" || "$2" == "" ]]; then
-    echo "usage: $0 <build-directory> <relative-path-to-rs-files>"
-    echo ""
-    echo "For example:"
-    echo "   $0 ../../../build/x86_64-apple-darwin/test/ui *.rs */*.rs"
-fi
-
-MYDIR=$(dirname "$0")
-
-BUILD_DIR="$1"
-shift
-
-while [[ "$1" != "" ]]; do
-    STDERR_NAME="${1/%.rs/.stderr}"
-    STDOUT_NAME="${1/%.rs/.stdout}"
-    shift
-    if [[ -f "$BUILD_DIR"/"$STDOUT_NAME" ]] && \
-           ! (cmp -s -- "$BUILD_DIR"/"$STDOUT_NAME" "$MYDIR"/"$STDOUT_NAME"); then
-        echo updating "$MYDIR"/"$STDOUT_NAME"
-        cp "$BUILD_DIR"/"$STDOUT_NAME" "$MYDIR"/"$STDOUT_NAME"
-        if [[ ! -s "$MYDIR"/"$STDOUT_NAME" ]]; then
-            echo removing "$MYDIR"/"$STDOUT_NAME"
-            rm "$MYDIR"/"$STDOUT_NAME"
-        fi
-    fi
-    if [[ -f "$BUILD_DIR"/"$STDERR_NAME" ]] && \
-           ! (cmp -s -- "$BUILD_DIR"/"$STDERR_NAME" "$MYDIR"/"$STDERR_NAME"); then
-        echo updating "$MYDIR"/"$STDERR_NAME"
-        cp "$BUILD_DIR"/"$STDERR_NAME" "$MYDIR"/"$STDERR_NAME"
-        if [[ ! -s "$MYDIR"/"$STDERR_NAME" ]]; then
-            echo removing "$MYDIR"/"$STDERR_NAME"
-            rm "$MYDIR"/"$STDERR_NAME"
-        fi
-    fi
-done
diff --git a/tests/ui-toml/update-all-references.sh b/tests/ui-toml/update-all-references.sh
index 7028b251ea0..4391499a1e1 100755
--- a/tests/ui-toml/update-all-references.sh
+++ b/tests/ui-toml/update-all-references.sh
@@ -1,18 +1,3 @@
 #!/bin/bash
-#
-# A script to update the references for all tests. The idea is that
-# you do a run, which will generate files in the build directory
-# containing the (normalized) actual output of the compiler. You then
-# run this script, which will copy those files over. If you find
-# yourself manually editing a foo.stderr file, you're doing it wrong.
-#
-# See all `update-references.sh`, if you just want to update a single test.
 
-if [[ "$1" == "--help" || "$1" == "-h" ]]; then
-    echo "usage: $0"
-fi
-
-BUILD_DIR=$PWD/target/debug/test_build_base
-MY_DIR=$(dirname "$0")
-cd "$MY_DIR" || exit
-find . -name '*.rs' -exec ./update-references.sh "$BUILD_DIR" {} +
+echo "Please use 'cargo dev bless' instead."
diff --git a/tests/ui-toml/update-references.sh b/tests/ui-toml/update-references.sh
deleted file mode 100755
index 2ab51168bca..00000000000
--- a/tests/ui-toml/update-references.sh
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/bin/bash
-
-# A script to update the references for particular tests. The idea is
-# that you do a run, which will generate files in the build directory
-# containing the (normalized) actual output of the compiler. This
-# script will then copy that output and replace the "expected output"
-# files. You can then commit the changes.
-#
-# If you find yourself manually editing a foo.stderr file, you're
-# doing it wrong.
-
-if [[ "$1" == "--help" || "$1" == "-h" || "$1" == "" || "$2" == "" ]]; then
-    echo "usage: $0 <build-directory> <relative-path-to-rs-files>"
-    echo ""
-    echo "For example:"
-    echo "   $0 ../../../build/x86_64-apple-darwin/test/ui *.rs */*.rs"
-fi
-
-MYDIR=$(dirname "$0")
-
-BUILD_DIR="$1"
-shift
-
-while [[ "$1" != "" ]]; do
-    STDERR_NAME="${1/%.rs/.stderr}"
-    STDOUT_NAME="${1/%.rs/.stdout}"
-    shift
-    if [[ -f "$BUILD_DIR"/"$STDOUT_NAME" ]] && \
-           ! (cmp -s -- "$BUILD_DIR"/"$STDOUT_NAME" "$MYDIR"/"$STDOUT_NAME"); then
-        echo updating "$MYDIR"/"$STDOUT_NAME"
-        cp "$BUILD_DIR"/"$STDOUT_NAME" "$MYDIR"/"$STDOUT_NAME"
-        if [[ ! -s "$MYDIR"/"$STDOUT_NAME" ]]; then
-            echo removing "$MYDIR"/"$STDOUT_NAME"
-            rm "$MYDIR"/"$STDOUT_NAME"
-        fi
-    fi
-    if [[ -f "$BUILD_DIR"/"$STDERR_NAME" ]] && \
-           ! (cmp -s -- "$BUILD_DIR"/"$STDERR_NAME" "$MYDIR"/"$STDERR_NAME"); then
-        echo updating "$MYDIR"/"$STDERR_NAME"
-        cp "$BUILD_DIR"/"$STDERR_NAME" "$MYDIR"/"$STDERR_NAME"
-        if [[ ! -s "$MYDIR"/"$STDERR_NAME" ]]; then
-            echo removing "$MYDIR"/"$STDERR_NAME"
-            rm "$MYDIR"/"$STDERR_NAME"
-        fi
-    fi
-done
diff --git a/tests/ui/update-all-references.sh b/tests/ui/update-all-references.sh
index 30ba9188db4..4391499a1e1 100755
--- a/tests/ui/update-all-references.sh
+++ b/tests/ui/update-all-references.sh
@@ -1,21 +1,3 @@
 #!/bin/bash
 
-# A script to update the references for all tests. The idea is that
-# you do a run, which will generate files in the build directory
-# containing the (normalized) actual output of the compiler. You then
-# run this script, which will copy those files over. If you find
-# yourself manually editing a foo.stderr file, you're doing it wrong.
-#
-# See all `update-references.sh`, if you just want to update a single test.
-
-if [[ "$1" == "--help" || "$1" == "-h" ]]; then
-    echo "usage: $0"
-fi
-
-CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-$PWD/target}
-PROFILE=${PROFILE:-debug}
-BUILD_DIR=${CARGO_TARGET_DIR}/${PROFILE}/test_build_base
-
-MY_DIR=$(dirname "$0")
-cd "$MY_DIR" || exit
-find . -name '*.rs' -exec ./update-references.sh "$BUILD_DIR" {} +
+echo "Please use 'cargo dev bless' instead."
diff --git a/tests/ui/update-references.sh b/tests/ui/update-references.sh
deleted file mode 100755
index e16ed600ef8..00000000000
--- a/tests/ui/update-references.sh
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/bin/bash
-
-# A script to update the references for particular tests. The idea is
-# that you do a run, which will generate files in the build directory
-# containing the (normalized) actual output of the compiler. This
-# script will then copy that output and replace the "expected output"
-# files. You can then commit the changes.
-#
-# If you find yourself manually editing a `foo.stderr` file, you're
-# doing it wrong.
-
-if [[ "$1" == "--help" || "$1" == "-h" || "$1" == "" || "$2" == "" ]]; then
-    echo "usage: $0 <build-directory> <relative-path-to-rs-files>"
-    echo ""
-    echo "For example:"
-    echo "   $0 ../../../build/x86_64-apple-darwin/test/ui *.rs */*.rs"
-fi
-
-MYDIR=$(dirname "$0")
-
-BUILD_DIR="$1"
-shift
-
-while [[ "$1" != "" ]]; do
-    STDERR_NAME="${1/%.rs/.stderr}"
-    STDOUT_NAME="${1/%.rs/.stdout}"
-    FIXED_NAME="${1/%.rs/.fixed}"
-    shift
-    if [[ -f "$BUILD_DIR"/"$STDOUT_NAME" ]] && \
-           ! (cmp -s -- "$BUILD_DIR"/"$STDOUT_NAME" "$MYDIR"/"$STDOUT_NAME"); then
-        echo updating "$MYDIR"/"$STDOUT_NAME"
-        cp "$BUILD_DIR"/"$STDOUT_NAME" "$MYDIR"/"$STDOUT_NAME"
-        if [[ ! -s "$MYDIR"/"$STDOUT_NAME" ]]; then
-            echo removing "$MYDIR"/"$STDOUT_NAME"
-            rm "$MYDIR"/"$STDOUT_NAME"
-        fi
-    fi
-    if [[ -f "$BUILD_DIR"/"$STDERR_NAME" ]] && \
-           ! (cmp -s -- "$BUILD_DIR"/"$STDERR_NAME" "$MYDIR"/"$STDERR_NAME"); then
-        echo updating "$MYDIR"/"$STDERR_NAME"
-        cp "$BUILD_DIR"/"$STDERR_NAME" "$MYDIR"/"$STDERR_NAME"
-        if [[ ! -s "$MYDIR"/"$STDERR_NAME" ]]; then
-            echo removing "$MYDIR"/"$STDERR_NAME"
-            rm "$MYDIR"/"$STDERR_NAME"
-        fi
-    fi
-    if [[ -f "$BUILD_DIR"/"$FIXED_NAME" ]] && \
-           ! (cmp -s -- "$BUILD_DIR"/"$FIXED_NAME" "$MYDIR"/"$FIXED_NAME"); then
-        echo updating "$MYDIR"/"$FIXED_NAME"
-        cp "$BUILD_DIR"/"$FIXED_NAME" "$MYDIR"/"$FIXED_NAME"
-        if [[ ! -s "$MYDIR"/"$FIXED_NAME" ]]; then
-            echo removing "$MYDIR"/"$FIXED_NAME"
-            rm "$MYDIR"/"$FIXED_NAME"
-        fi
-    fi
-done