summaryrefslogtreecommitdiff
path: root/tests/RustTest.sh
diff options
context:
space:
mode:
authorCasper <casperneo@uchicago.edu>2021-01-22 13:07:32 -0500
committerGitHub <noreply@github.com>2021-01-22 13:07:32 -0500
commit1da0a2dfac4bd9a6876a7c39c4eea5eeefc36aa2 (patch)
treea48ac3f7455c980b05ca41d3e44d5e367b0260d2 /tests/RustTest.sh
parent796ed68faf434cac90f094a5fdf47137ba74e5a2 (diff)
downloadflatbuffers-1da0a2dfac4bd9a6876a7c39c4eea5eeefc36aa2.tar.gz
flatbuffers-1da0a2dfac4bd9a6876a7c39c4eea5eeefc36aa2.tar.bz2
flatbuffers-1da0a2dfac4bd9a6876a7c39c4eea5eeefc36aa2.zip
Rust Object API (#6070)
* inital commit of rust object api * Required fields support. * clang fallthrough * Fix unused variables * just don't fall through * remove comment * s/panic/unreachable * Tests for object API * Added defaults * deleted unintentionally added files and updated .bat file * fix bat file * clang format * Cargo clippy checks * remove commented out code * clippy allows * Remove matches! macro since we're not yet at Rust v1.42 * install clippy in RustTest.sh * move line Co-authored-by: Casper Neo <cneo@google.com>
Diffstat (limited to 'tests/RustTest.sh')
-rwxr-xr-xtests/RustTest.sh39
1 files changed, 18 insertions, 21 deletions
diff --git a/tests/RustTest.sh b/tests/RustTest.sh
index a74690af..7fa64926 100755
--- a/tests/RustTest.sh
+++ b/tests/RustTest.sh
@@ -21,33 +21,30 @@ if [[ "$1" == "mips-unknown-linux-gnu" ]]; then
export CARGO_TARGET_MIPS_UNKNOWN_LINUX_GNU_RUNNER="qemu-mips -L /usr/mips-linux-gnu"
fi
+
+function check_test_result() {
+ if [[ $? == 0 ]]; then
+ echo OK: $1 passed.
+ else
+ echo KO: $1 failed.
+ exit 1
+ fi
+}
+
cd ./rust_usage_test
cargo test $TARGET_FLAG -- --quiet
-TEST_RESULT=$?
-if [[ $TEST_RESULT == 0 ]]; then
- echo "OK: Rust tests passed."
-else
- echo "KO: Rust tests failed."
- exit 1
-fi
+check_test_result "Rust tests"
+
cargo run $TARGET_FLAG --bin=flatbuffers_alloc_check
-TEST_RESULT=$?
-if [[ $TEST_RESULT == 0 ]]; then
- echo "OK: Rust heap alloc test passed."
-else
- echo "KO: Rust heap alloc test failed."
- exit 1
-fi
+check_test_result "Rust flatbuffers heap alloc test"
cargo run $TARGET_FLAG --bin=flexbuffers_alloc_check
-TEST_RESULT=$?
-if [[ $TEST_RESULT == 0 ]]; then
- echo "OK: Rust heap alloc test passed."
-else
- echo "KO: Rust heap alloc test failed."
- exit 1
-fi
+check_test_result "Rust flexbuffers heap alloc test"
+
+rustup component add clippy
+cargo clippy $TARGET_FLAG
+check_test_result "No Cargo clippy lints test"
cargo bench $TARGET_FLAG