-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathdetect.sh
executable file
·57 lines (51 loc) · 1.6 KB
/
detect.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env bash
# this script's location
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ -z "$1" ]; then
echo "No detecting directory is provided"
echo "Usage: ./detect.sh DIRNAME"
exit 1
fi
# Build lockbud
cargo build
# For development of lockbud use debug
export RUSTC_WRAPPER=${PWD}/target/debug/lockbud
# For usage use release
# cargo build --release
# export RUSTC_WRAPPER=${PWD}/target/release/lockbud
export RUST_BACKTRACE=full
export LOCKBUD_LOG=info
# To only detect inter,intra
#export LOCKBUD_FLAGS="--detector-kind deadlock --crate-name-list inter,intra"
# or shorter
#export LOCKBUD_FLAGS="-k deadlock -l inter,intra"
# To skip detecting inter or intra
#export LOCKBUD_FLAGS="--detector-kind deadlock --blacklist-mode --crate-name-list inter,intra"
# or shorter
#export LOCKBUD_FLAGS="-k deadlock -b -l inter,intra"
#export LOCKBUD_FLAGS="-k deadlock -b -l cc"
#export LOCKBUD_FLAGS="-k atomicity_violation"
#export LOCKBUD_FLAGS="-k memory"
#export LOCKBUD_FLAGS="-k panic"
export LOCKBUD_FLAGS="-k all"
# Find all Cargo.tomls recursively under the detecting directory
# and record them in cargo_dir.txt
cargo_dir_file=$(realpath $DIR/cargo_dir.txt)
rm -f $cargo_dir_file
touch $cargo_dir_file
pushd "$1" > /dev/null
cargo clean
cargo_tomls=$(find . -name "Cargo.toml")
for cargo_toml in ${cargo_tomls[@]}
do
echo $(dirname $cargo_toml) >> $cargo_dir_file
done
IFS=$'\n' read -d '' -r -a lines < ${cargo_dir_file}
for cargo_dir in ${lines[@]}
do
pushd ${cargo_dir} > /dev/null
cargo build
popd > /dev/null
done
popd > /dev/null
rm -f $cargo_dir_file