@@ -30,6 +30,7 @@ Error() {
30
30
RUST_BACKTRACE=1
31
31
SHOULD_FAIL=${SHOULD_FAIL:- } # Default to false
32
32
VALGRIND_TESTS=${VALGRIND_TESTS:- }
33
+ CARGO=" ${CARGO:- cargo} "
33
34
34
35
# Feature vars
35
36
if [ -n " ${ALL_FEATURES:- } " -a -n " ${NO_DEFAULT_FEATURES:- } " ]; then
@@ -135,15 +136,15 @@ run_kcov() {
135
136
json_format_args=" --quiet --message-format=json"
136
137
137
138
# Test binaries
138
- cargo_test_args=" cargo test --no-run"
139
+ cargo_test_args=" ${CARGO} test --no-run"
139
140
${cargo_test_args} -v
140
141
TEST_BINS=" $( ${cargo_test_args} ${json_format_args} \
141
142
| jq -r " select(.profile.test == true) | .filenames[]" ) "
142
143
143
144
# Exaple binaries
144
145
EXAMPLE_BINS=
145
146
for example in $SIMPLE_RUN_EXAMPLES ; do
146
- cargo_build_example_args=" cargo build --example $example "
147
+ cargo_build_example_args=" ${CARGO} build --example $example "
147
148
${cargo_build_example_args} -v
148
149
example_bin=" $( ${cargo_build_example_args} ${json_format_args} \
149
150
| jq -r ' .executable | strings' ) "
@@ -191,7 +192,7 @@ cov() {
191
192
}
192
193
193
194
bench () {
194
- cargo bench
195
+ ${CARGO} bench
195
196
}
196
197
197
198
profile_args () {
@@ -211,7 +212,7 @@ test_rust_file() {
211
212
212
213
capstone_dir=" $( pwd) "
213
214
cd " $tmp_dir "
214
- cargo new --bin test_project -v
215
+ ${CARGO} new --bin test_project -v
215
216
cd test_project
216
217
echo " capstone = { path = \" $capstone_dir \" }" >> Cargo.toml
217
218
cat Cargo.toml
@@ -223,7 +224,7 @@ test_rust_file() {
223
224
$( profile_args)
224
225
--verbose
225
226
)
226
- cargo check " ${cargo_cmd_args[@]} " || exit 1
227
+ ${CARGO} check " ${cargo_cmd_args[@]} " || exit 1
227
228
228
229
rm -rf " $tmp_dir "
229
230
) || exit 1
@@ -240,16 +241,16 @@ run_tests() {
240
241
" ${CARGO_FEATURE_ARGS[@]} "
241
242
)
242
243
expect_exit_status " $SHOULD_FAIL " \
243
- cargo test " ${cargo_cmd_args[@]} " \
244
+ ${CARGO} test " ${cargo_cmd_args[@]} " \
244
245
--color=always -- --color=always \
245
246
2>&1 | tee " $TMPFILE "
246
247
# Use 2>&1 above instead of '|&' because OS X uses Bash 3
247
248
for example in $SIMPLE_RUN_EXAMPLES ; do
248
- cargo run " ${cargo_cmd_args[@]} " --example " $example "
249
+ ${CARGO} run " ${cargo_cmd_args[@]} " --example " $example "
249
250
done
250
251
(
251
252
cd ../cstool
252
- cargo run $( profile_args) -- \
253
+ ${CARGO} run $( profile_args) -- \
253
254
--arch x86 --mode mode64 --file ../capstone-rs/test-inputs/x86_64.bin_ls.bin |
254
255
head -n20
255
256
)
0 commit comments