Skip to content

Commit

Permalink
move rust lint script (apache#8726)
Browse files Browse the repository at this point in the history
  • Loading branch information
mehrdadh authored and Andrew Zhao Luo committed Sep 1, 2021
1 parent c105a1b commit d833218
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 3 deletions.
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

0 comments on commit d833218

Please sign in to comment.