From 9d8f1b00f7a597a98e51ff9c1a45a6b9b9e64f0d Mon Sep 17 00:00:00 2001 From: Takeshi Nakatani Date: Thu, 6 May 2021 13:52:54 +0000 Subject: [PATCH] Fixed make_random_string test code being slow on macos --- test/integration-test-main.sh | 9 +-------- test/test-utils.sh | 8 ++++++-- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/test/integration-test-main.sh b/test/integration-test-main.sh index 53e1a2f..9d22042 100755 --- a/test/integration-test-main.sh +++ b/test/integration-test-main.sh @@ -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 diff --git a/test/test-utils.sh b/test/test-utils.sh index 46d06d8..2dbe112 100644 --- a/test/test-utils.sh +++ b/test/test-utils.sh @@ -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 } #