2
2
3
3
set -ex
4
4
5
- : ${INTEGRATION?" The INTEGRATION environment variable must be set." }
5
+ : " ${INTEGRATION?' The INTEGRATION environment variable must be set.' } "
6
6
7
7
# FIXME: this means we can get a stale cargo-fmt from a previous run.
8
8
#
@@ -42,8 +42,9 @@ function check_fmt_with_lib_tests {
42
42
43
43
function check_fmt_base {
44
44
local test_args=" $1 "
45
- local build=$( cargo test $test_args 2>&1 )
46
- if [[ " $build " =~ " build failed" ]] || [[ " $build " =~ " test result: FAILED." ]]; then
45
+ local build
46
+ build=$( cargo test " $test_args " 2>&1 )
47
+ if [[ " $build " =~ " build failed" ]] || [[ " $build " =~ test\ result\:\ FAILED\. ]]; then
47
48
return 0
48
49
fi
49
50
touch rustfmt.toml
@@ -53,67 +54,72 @@ function check_fmt_base {
53
54
return 1
54
55
fi
55
56
cat rustfmt_output
56
- ! cat rustfmt_output | grep -q " internal error"
57
- if [[ $? != 0 ]]; then
57
+ grep -q " internal error" < rustfmt_output
58
+ cmd_ret=$?
59
+ if [[ $cmd_ret == 0 ]]; then
58
60
return 1
59
61
fi
60
- ! cat rustfmt_output | grep -q " warning"
61
- if [[ $? != 0 ]]; then
62
+ grep -q " warning" < rustfmt_output
63
+ cmd_ret=$?
64
+ if [[ $cmd_ret == 0 ]]; then
62
65
return 1
63
66
fi
64
- ! cat rustfmt_output | grep -q " Warning"
65
- if [[ $? != 0 ]]; then
67
+ grep -q " Warning" < rustfmt_output
68
+ cmd_ret=$?
69
+ if [[ $cmd_ret == 0 ]]; then
66
70
return 1
67
71
fi
68
72
cargo fmt --all -- --check | & tee rustfmt_check_output
69
73
if [[ ${PIPESTATUS[0]} != 0 ]]; then
70
74
cat rustfmt_check_output
71
75
return 1
72
76
fi
73
- cargo test $test_args
74
- if [[ $? != 0 ]]; then
75
- return $?
77
+ cargo test " $test_args "
78
+ cargo_ret=$?
79
+ if [[ $cargo_ret != 0 ]]; then
80
+ return $cargo_ret
76
81
fi
77
82
}
78
83
79
84
function show_head {
80
- local head=$( git rev-parse HEAD)
85
+ local head
86
+ head=$( git rev-parse HEAD)
81
87
echo " Head commit of ${INTEGRATION} : $head "
82
88
}
83
89
84
90
case ${INTEGRATION} in
85
91
cargo)
86
- git clone --depth=1 https://github.com/rust-lang/${INTEGRATION} .git
87
- cd ${INTEGRATION}
92
+ git clone --depth=1 " https://github.com/rust-lang/${INTEGRATION} .git"
93
+ cd " ${INTEGRATION} "
88
94
show_head
89
95
export CFG_DISABLE_CROSS_TESTS=1
90
96
check_fmt_with_all_tests
91
97
cd -
92
98
;;
93
99
crater)
94
- git clone --depth=1 https://github.com/rust-lang/${INTEGRATION} .git
95
- cd ${INTEGRATION}
100
+ git clone --depth=1 " https://github.com/rust-lang/${INTEGRATION} .git"
101
+ cd " ${INTEGRATION} "
96
102
show_head
97
103
check_fmt_with_lib_tests
98
104
cd -
99
105
;;
100
106
bitflags)
101
- git clone --depth=1 https://github.com/bitflags/${INTEGRATION} .git
102
- cd ${INTEGRATION}
107
+ git clone --depth=1 " https://github.com/bitflags/${INTEGRATION} .git"
108
+ cd " ${INTEGRATION} "
103
109
show_head
104
110
check_fmt_with_all_tests
105
111
cd -
106
112
;;
107
113
tempdir)
108
- git clone --depth=1 https://github.com/rust-lang-deprecated/${INTEGRATION} .git
109
- cd ${INTEGRATION}
114
+ git clone --depth=1 " https://github.com/rust-lang-deprecated/${INTEGRATION} .git"
115
+ cd " ${INTEGRATION} "
110
116
show_head
111
117
check_fmt_with_all_tests
112
118
cd -
113
119
;;
114
120
* )
115
- git clone --depth=1 https://github.com/rust-lang/${INTEGRATION} .git
116
- cd ${INTEGRATION}
121
+ git clone --depth=1 " https://github.com/rust-lang/${INTEGRATION} .git"
122
+ cd " ${INTEGRATION} "
117
123
show_head
118
124
check_fmt_with_all_tests
119
125
cd -
0 commit comments