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,61 @@ 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
58
- return 1
59
- fi
60
- ! cat rustfmt_output | grep -q " warning"
61
- if [[ $? != 0 ]]; then
62
- return 1
63
- fi
64
- ! cat rustfmt_output | grep -q " Warning"
65
- if [[ $? != 0 ]]; then
66
- return 1
67
- fi
57
+ grep -q " internal error" < rustfmt_output && return 1
58
+ grep -q " warning" < rustfmt_output && return 1
59
+ grep -q " Warning" < rustfmt_output && return 1
60
+
68
61
cargo fmt --all -- --check | & tee rustfmt_check_output
69
62
if [[ ${PIPESTATUS[0]} != 0 ]]; then
70
63
cat rustfmt_check_output
71
64
return 1
72
65
fi
73
- cargo test $test_args
74
- if [[ $? != 0 ]]; then
75
- return $?
66
+ cargo test " $test_args "
67
+ cargo_ret=$?
68
+ if [[ $cargo_ret != 0 ]]; then
69
+ return $cargo_ret
76
70
fi
77
71
}
78
72
79
73
function show_head {
80
- local head=$( git rev-parse HEAD)
74
+ local head
75
+ head=$( git rev-parse HEAD)
81
76
echo " Head commit of ${INTEGRATION} : $head "
82
77
}
83
78
84
79
case ${INTEGRATION} in
85
80
cargo)
86
- git clone --depth=1 https://github.com/rust-lang/${INTEGRATION} .git
87
- cd ${INTEGRATION}
81
+ git clone --depth=1 " https://github.com/rust-lang/${INTEGRATION} .git"
82
+ cd " ${INTEGRATION} "
88
83
show_head
89
84
export CFG_DISABLE_CROSS_TESTS=1
90
85
check_fmt_with_all_tests
91
86
cd -
92
87
;;
93
88
crater)
94
- git clone --depth=1 https://github.com/rust-lang/${INTEGRATION} .git
95
- cd ${INTEGRATION}
89
+ git clone --depth=1 " https://github.com/rust-lang/${INTEGRATION} .git"
90
+ cd " ${INTEGRATION} "
96
91
show_head
97
92
check_fmt_with_lib_tests
98
93
cd -
99
94
;;
100
95
bitflags)
101
- git clone --depth=1 https://github.com/bitflags/${INTEGRATION} .git
102
- cd ${INTEGRATION}
96
+ git clone --depth=1 " https://github.com/bitflags/${INTEGRATION} .git"
97
+ cd " ${INTEGRATION} "
103
98
show_head
104
99
check_fmt_with_all_tests
105
100
cd -
106
101
;;
107
102
tempdir)
108
- git clone --depth=1 https://github.com/rust-lang-deprecated/${INTEGRATION} .git
109
- cd ${INTEGRATION}
103
+ git clone --depth=1 " https://github.com/rust-lang-deprecated/${INTEGRATION} .git"
104
+ cd " ${INTEGRATION} "
110
105
show_head
111
106
check_fmt_with_all_tests
112
107
cd -
113
108
;;
114
109
* )
115
- git clone --depth=1 https://github.com/rust-lang/${INTEGRATION} .git
116
- cd ${INTEGRATION}
110
+ git clone --depth=1 " https://github.com/rust-lang/${INTEGRATION} .git"
111
+ cd " ${INTEGRATION} "
117
112
show_head
118
113
check_fmt_with_all_tests
119
114
cd -
0 commit comments