Skip to content

Commit 6588bff

Browse files
authored
Rollup merge of rust-lang#121685 - fortanix:raoul/shellcheck_on_lvi_test_script, r=Mark-Simulacrum
Fixing shellcheck comments on lvi test script Running `shellcheck` on `tests/run-make/x86_64-fortanix-unknown-sgx-lvi/script.sh` gives plenty of warnings. This PR fixes those issues. For completeness: rust-lang#121683 fixes another warning as well
2 parents 263f329 + 70639c8 commit 6588bff

File tree

1 file changed

+13
-12
lines changed
  • tests/run-make/x86_64-fortanix-unknown-sgx-lvi

1 file changed

+13
-12
lines changed

tests/run-make/x86_64-fortanix-unknown-sgx-lvi/script.sh

+13-12
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,39 @@
1-
#!/bin/sh
1+
#!/bin/bash
22
set -exuo pipefail
33

44
function build {
55
CRATE=enclave
66

7-
mkdir -p $WORK_DIR
8-
pushd $WORK_DIR
9-
rm -rf $CRATE
10-
cp -a $TEST_DIR/enclave .
7+
mkdir -p "${WORK_DIR}"
8+
pushd "${WORK_DIR}"
9+
rm -rf "${CRATE}"
10+
cp -a "${TEST_DIR}"/enclave .
1111
pushd $CRATE
12-
echo ${WORK_DIR}
12+
echo "${WORK_DIR}"
1313
# HACK(eddyb) sets `RUSTC_BOOTSTRAP=1` so Cargo can accept nightly features.
1414
# These come from the top-level Rust workspace, that this crate is not a
1515
# member of, but Cargo tries to load the workspace `Cargo.toml` anyway.
1616
env RUSTC_BOOTSTRAP=1
17-
cargo -v run --target $TARGET
17+
cargo -v run --target "${TARGET}"
1818
popd
1919
popd
2020
}
2121

2222
function check {
2323
local func_re="$1"
2424
local checks="${TEST_DIR}/$2"
25-
local asm=$(mktemp)
25+
local asm=""
2626
local objdump="${LLVM_BIN_DIR}/llvm-objdump"
2727
local filecheck="${LLVM_BIN_DIR}/FileCheck"
2828
local enclave=${WORK_DIR}/enclave/target/x86_64-fortanix-unknown-sgx/debug/enclave
2929

30-
func="$(${objdump} --syms --demangle ${enclave} | \
30+
asm=$(mktemp)
31+
func="$(${objdump} --syms --demangle "${enclave}" | \
3132
grep --only-matching -E "[[:blank:]]+${func_re}\$" | \
3233
sed -e 's/^[[:space:]]*//' )"
3334
${objdump} --disassemble-symbols="${func}" --demangle \
34-
${enclave} > ${asm}
35-
${filecheck} --input-file ${asm} ${checks}
35+
"${enclave}" > "${asm}"
36+
${filecheck} --input-file "${asm}" "${checks}"
3637

3738
if [ "${func_re}" != "rust_plus_one_global_asm" ] &&
3839
[ "${func_re}" != "cmake_plus_one_c_global_asm" ] &&
@@ -41,7 +42,7 @@ function check {
4142
# of `shlq $0x0, (%rsp); lfence; retq` are used instead.
4243
# https://www.intel.com/content/www/us/en/developer/articles/technical/
4344
# software-security-guidance/technical-documentation/load-value-injection.html
44-
${filecheck} --implicit-check-not ret --input-file ${asm} ${checks}
45+
${filecheck} --implicit-check-not ret --input-file "${asm}" "${checks}"
4546
fi
4647
}
4748

0 commit comments

Comments
 (0)