Skip to content

Commit df8b168

Browse files
committed
Fix potential issues with scripts
1 parent ccc955c commit df8b168

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

scripts/benchmark-bigdecimal

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
#!/bin/bash
22
#
33
# Run Criterion Benchmarks
44
#
@@ -14,7 +14,7 @@ mv Cargo.toml.bak Cargo.toml
1414

1515

1616
# store extra things for the benchmarking report
17-
if [ ! -z "$BENCHMARK_EXTRAS" ]; then
17+
if [ -n "$BENCHMARK_EXTRAS" ]; then
1818
cat <<EOF > index.html
1919
<!doctype html>
2020
<head>
@@ -36,12 +36,12 @@ EOF
3636
# Add svg plots to index html
3737
find target/criterion -name 'pdf.svg' -type f -print0 |
3838
sort -z |
39-
while read -d $'\0' svg_file
39+
while read -r -d $'\0' svg_file
4040
do
41-
name=$(echo $svg_file | cut -d '/' -f 3)
41+
name=$(echo "$svg_file" | cut -d '/' -f 3)
4242

4343
sample_datafile=target/criterion/$name/new/sample.json
44-
if [ -f $sample_datafile ]; then
44+
if [ -f "$sample_datafile" ]; then
4545
echo "<p><a href='${sample_datafile}' class='sample-json'>$name</a>" >> index.html
4646
else
4747
echo "<p>$name</p>" >> index.html

scripts/bigdecimal-property-tests

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ case "${CMD}" in
3535

3636
test)
3737
enable_property_tests
38-
cargo test $@
38+
cargo test "$@"
3939
restore_disabled_property_tests
4040
;;
4141

scripts/fetch-benchmark-data.sh

+5-5
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ function fetch_benchmark_bigdecimal_file() {
1616
local FILENAME="random-bigdecimals-$1.txt"
1717
local FILEPATH=$TEST_DATA_DIR/$FILENAME
1818

19-
if [ -e $FILEPATH ]; then
19+
if [ -e "$FILEPATH" ]; then
2020
echo "exists: $FILEPATH"
2121
else
2222
local URL=${GITLAB_URL_PATTERN//<FILENAME>/$FILENAME}
2323
echo "fetching: $FILEPATH from $URL"
2424

25-
if [ $CURL ]; then
26-
$CURL -s --fail -L $URL -o "$FILEPATH"
27-
elif [ $WGET ]; then
28-
$WGET --quiet $URL -O "$FILEPATH"
25+
if [ "$CURL" ]; then
26+
$CURL -s --fail -L "$URL" -o "$FILEPATH"
27+
elif [ "$WGET" ]; then
28+
"$WGET" --quiet "$URL" -O "$FILEPATH"
2929
else
3030
echo "No supported fetching program"
3131
fi

0 commit comments

Comments
 (0)