Simplify running update-references.sh

This commit is contained in:
David Tolnay 2019-02-17 10:58:09 -08:00
parent 344602d27e
commit bf27b28554
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
3 changed files with 32 additions and 25 deletions

18
test_suite/README.md Normal file
View File

@ -0,0 +1,18 @@
#### To run unit tests
```sh
cargo test
```
#### To run ui tests
```sh
(cd deps && cargo clean && cargo update && cargo build)
cargo test --features compiletest
```
#### To update goldens after running ui tests
```sh
tests/ui/update-references.sh
```

View File

@ -15,6 +15,7 @@ fn ui() {
--extern serde_derive \
",
)),
build_base: std::path::PathBuf::from("../target/ui"),
..Default::default()
});
}

View File

@ -19,32 +19,20 @@
# 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
cd "$(dirname "${BASH_SOURCE[0]}")"
BUILD_DIR="../../../target/ui"
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 ] && \
! (diff $BUILD_DIR/$STDOUT_NAME $MYDIR/$STDOUT_NAME >& /dev/null); then
echo updating $MYDIR/$STDOUT_NAME
cp $BUILD_DIR/$STDOUT_NAME $MYDIR/$STDOUT_NAME
for testcase in */*.rs; do
STDERR_NAME="${testcase/%.rs/.stderr}"
STDOUT_NAME="${testcase/%.rs/.stdout}"
if [ -f "$BUILD_DIR/$STDOUT_NAME" ] && \
! (diff "$BUILD_DIR/$STDOUT_NAME" "$STDOUT_NAME" >& /dev/null); then
echo "updating $STDOUT_NAME"
cp "$BUILD_DIR/$STDOUT_NAME" "$STDOUT_NAME"
fi
if [ -f $BUILD_DIR/$STDERR_NAME ] && \
! (diff $BUILD_DIR/$STDERR_NAME $MYDIR/$STDERR_NAME >& /dev/null); then
echo updating $MYDIR/$STDERR_NAME
cp $BUILD_DIR/$STDERR_NAME $MYDIR/$STDERR_NAME
if [ -f "$BUILD_DIR/$STDERR_NAME" ] && \
! (diff "$BUILD_DIR/$STDERR_NAME" "$STDERR_NAME" >& /dev/null); then
echo "updating $STDERR_NAME"
cp "$BUILD_DIR/$STDERR_NAME" "$STDERR_NAME"
fi
done