Fixed make_random_string test code being slow on macos

This commit is contained in:
Takeshi Nakatani 2021-05-06 13:52:54 +00:00 committed by Andrew Gaul
parent bb6d2b1b74
commit 9d8f1b00f7
2 changed files with 7 additions and 10 deletions

View File

@ -1460,14 +1460,7 @@ function add_all_tests {
add_tests test_external_modification
add_tests test_read_external_object
add_tests test_update_metadata_external_small_object
if ! uname | grep -q Darwin; then
# [NOTE]
# This test is very time consuming on OSX and will not run.
# And this test should be no different between OSX and
# other OSs. so skip this test on OSX.
#
add_tests test_update_metadata_external_large_object
fi
add_tests test_update_metadata_external_large_object
add_tests test_rename_before_close
add_tests test_multipart_upload
add_tests test_multipart_copy

View File

@ -50,10 +50,12 @@ if [ `uname` = "Darwin" ]; then
export STDBUF_BIN="gstdbuf"
export TRUNCATE_BIN="gtruncate"
export SED_BIN="gsed"
export BASE64_BIN="gbase64"
else
export STDBUF_BIN="stdbuf"
export TRUNCATE_BIN="truncate"
export SED_BIN="sed"
export BASE64_BIN="base64"
fi
export SED_BUFFER_FLAG="--unbuffered"
@ -343,8 +345,10 @@ function make_random_string() {
else
END_POS=8
fi
RANDOM_STR=`cat /dev/urandom | base64 | sed 's#[/|+]##g' | head -1 | cut -c 1-${END_POS}`
echo "${RANDOM_STR}"
${BASE64_BIN} --wrap=0 < /dev/urandom | tr -d /+ | head -c ${END_POS}
return 0
}
#