Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI][Rust] Move Rust Format Script #8726

Merged
merged 2 commits into from
Aug 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions tests/lint/rust_format.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

TVM_HOME="$(git rev-parse --show-toplevel)"
RUST_DIR="$TVM_HOME/rust"

if [[ "$1" == "-i" ]]; then
INPLACE_FORMAT=1
shift 1
else
INPLACE_FORMAT=0
fi

cd $RUST_DIR

if [[ ${INPLACE_FORMAT} -eq 1 ]]; then
cargo fmt
else
cargo fmt -- --check
fi
3 changes: 3 additions & 0 deletions tests/scripts/task_lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ tests/lint/cpplint.sh
echo "clang-format check..."
tests/lint/clang_format.sh

echo "Rust check..."
tests/lint/rust_format.sh

echo "black check..."
tests/lint/python_format.sh

Expand Down
3 changes: 0 additions & 3 deletions tests/scripts/task_rust.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ echo "Using TVM_CARGO_VERSION=$TVM_CARGO_VERSION"
export TVM_BIND_THREADS=0
export OMP_NUM_THREADS=1

cd $RUST_DIR
cargo fmt -- --check

# First we test tvm-sys the core Rust bindings.
cd $RUST_DIR/tvm-sys
# First we test w/o the bindings feature on.
Expand Down