mirror of
https://github.com/serde-rs/serde.git
synced 2025-10-02 07:21:12 +00:00
Simplify running update-references.sh
This commit is contained in:
parent
344602d27e
commit
bf27b28554
18
test_suite/README.md
Normal file
18
test_suite/README.md
Normal 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
|
||||||
|
```
|
@ -15,6 +15,7 @@ fn ui() {
|
|||||||
--extern serde_derive \
|
--extern serde_derive \
|
||||||
",
|
",
|
||||||
)),
|
)),
|
||||||
|
build_base: std::path::PathBuf::from("../target/ui"),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -19,32 +19,20 @@
|
|||||||
# If you find yourself manually editing a foo.stderr file, you're
|
# If you find yourself manually editing a foo.stderr file, you're
|
||||||
# doing it wrong.
|
# doing it wrong.
|
||||||
|
|
||||||
if [[ "$1" == "--help" || "$1" == "-h" || "$1" == "" || "$2" == "" ]]; then
|
cd "$(dirname "${BASH_SOURCE[0]}")"
|
||||||
echo "usage: $0 <build-directory> <relative-path-to-rs-files>"
|
BUILD_DIR="../../../target/ui"
|
||||||
echo ""
|
|
||||||
echo "For example:"
|
|
||||||
echo " $0 ../../../build/x86_64-apple-darwin/test/ui *.rs */*.rs"
|
|
||||||
fi
|
|
||||||
|
|
||||||
MYDIR=$(dirname $0)
|
for testcase in */*.rs; do
|
||||||
|
STDERR_NAME="${testcase/%.rs/.stderr}"
|
||||||
BUILD_DIR="$1"
|
STDOUT_NAME="${testcase/%.rs/.stdout}"
|
||||||
shift
|
if [ -f "$BUILD_DIR/$STDOUT_NAME" ] && \
|
||||||
|
! (diff "$BUILD_DIR/$STDOUT_NAME" "$STDOUT_NAME" >& /dev/null); then
|
||||||
while [[ "$1" != "" ]]; do
|
echo "updating $STDOUT_NAME"
|
||||||
STDERR_NAME="${1/%.rs/.stderr}"
|
cp "$BUILD_DIR/$STDOUT_NAME" "$STDOUT_NAME"
|
||||||
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
|
|
||||||
fi
|
fi
|
||||||
if [ -f $BUILD_DIR/$STDERR_NAME ] && \
|
if [ -f "$BUILD_DIR/$STDERR_NAME" ] && \
|
||||||
! (diff $BUILD_DIR/$STDERR_NAME $MYDIR/$STDERR_NAME >& /dev/null); then
|
! (diff "$BUILD_DIR/$STDERR_NAME" "$STDERR_NAME" >& /dev/null); then
|
||||||
echo updating $MYDIR/$STDERR_NAME
|
echo "updating $STDERR_NAME"
|
||||||
cp $BUILD_DIR/$STDERR_NAME $MYDIR/$STDERR_NAME
|
cp "$BUILD_DIR/$STDERR_NAME" "$STDERR_NAME"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user