diff --git a/test/sharness/lib/install-sharness.sh b/test/sharness/lib/install-sharness.sh index ae1390d8a..b7c9eddfe 100755 --- a/test/sharness/lib/install-sharness.sh +++ b/test/sharness/lib/install-sharness.sh @@ -15,35 +15,35 @@ sharnessdir=sharness if test -f "$clonedir/$sharnessdir/SHARNESS_VERSION_$version" then - # There is the right version file. Great, we are done! - exit 0 + # There is the right version file. Great, we are done! + exit 0 fi die() { - echo >&2 "$@" - exit 1 + echo >&2 "$@" + exit 1 } checkout_version() { - git checkout "$version" || die "Could not checkout '$version'" - rm -f SHARNESS_VERSION_* || die "Could not remove 'SHARNESS_VERSION_*'" - touch "SHARNESS_VERSION_$version" || die "Could not create 'SHARNESS_VERSION_$version'" - echo "Sharness version $version is checked out!" + git checkout "$version" || die "Could not checkout '$version'" + rm -f SHARNESS_VERSION_* || die "Could not remove 'SHARNESS_VERSION_*'" + touch "SHARNESS_VERSION_$version" || die "Could not create 'SHARNESS_VERSION_$version'" + echo "Sharness version $version is checked out!" } if test -d "$clonedir/$sharnessdir/.git" then - # We need to update sharness! - cd "$clonedir/$sharnessdir" || die "Could not cd into '$clonedir/$sharnessdir' directory" - git fetch || die "Could not fetch to update sharness" - checkout_version + # We need to update sharness! + cd "$clonedir/$sharnessdir" || die "Could not cd into '$clonedir/$sharnessdir' directory" + git fetch || die "Could not fetch to update sharness" + checkout_version else - # We need to clone sharness! - mkdir -p "$clonedir" || die "Could not create '$clonedir' directory" - cd "$clonedir" || die "Could not cd into '$clonedir' directory" + # We need to clone sharness! + mkdir -p "$clonedir" || die "Could not create '$clonedir' directory" + cd "$clonedir" || die "Could not cd into '$clonedir' directory" - git clone "$urlprefix" || die "Could not clone '$urlprefix'" - cd "$sharnessdir" || die "Could not cd into '$sharnessdir' directory" - checkout_version + git clone "$urlprefix" || die "Could not clone '$urlprefix'" + cd "$sharnessdir" || die "Could not cd into '$sharnessdir' directory" + checkout_version fi exit 0 diff --git a/test/sharness/lib/test-lib.sh b/test/sharness/lib/test-lib.sh index 9b3c7e790..d443978fd 100644 --- a/test/sharness/lib/test-lib.sh +++ b/test/sharness/lib/test-lib.sh @@ -226,11 +226,11 @@ test_launch_ipfs_daemon() { } do_umount() { - if [ "$(uname -s)" = "Linux" ]; then + if [ "$(uname -s)" = "Linux" ]; then fusermount -u "$1" - else + else umount "$1" - fi + fi } test_mount_ipfs() { @@ -335,36 +335,36 @@ test_str_contains() { } disk_usage() { - # normalize du across systems - case $(uname -s) in - Linux) - DU="du -sb" + # normalize du across systems + case $(uname -s) in + Linux) + DU="du -sb" M=1 - ;; - FreeBSD) - DU="du -s -A -B 1" + ;; + FreeBSD) + DU="du -s -A -B 1" M=512 - ;; - Darwin | DragonFly | *) - DU="du -s" + ;; + Darwin | DragonFly | *) + DU="du -s" M=512 - ;; - esac + ;; + esac expr $($DU "$1" | awk "{print \$1}") "*" "$M" } # output a file's permission in human readable format generic_stat() { - # normalize stat across systems - case $(uname -s) in - Linux) - _STAT="stat -c %A" - ;; - FreeBSD | Darwin | DragonFly) - _STAT="stat -f %Sp" - ;; - esac - $_STAT "$1" || echo "failed" # Avoid returning nothing. + # normalize stat across systems + case $(uname -s) in + Linux) + _STAT="stat -c %A" + ;; + FreeBSD | Darwin | DragonFly) + _STAT="stat -f %Sp" + ;; + esac + $_STAT "$1" || echo "failed" # Avoid returning nothing. } test_check_peerid() { diff --git a/test/sharness/t0021-config.sh b/test/sharness/t0021-config.sh index ac7c51ebf..c5adc5ba9 100755 --- a/test/sharness/t0021-config.sh +++ b/test/sharness/t0021-config.sh @@ -41,12 +41,12 @@ test_config_cmd_set() { # (i.e. just setting 'ipfs config --json foo "[1, 2, 3]"') may # set it as astring instead of proper json. We leverage the # unmarshalling that has to happen. -CONFIG_SET_JSON_TEST='{ +CONFIG_SET_JSON_TEST=$(echo '{ "MDNS": { "Enabled": true, "Interval": 10 } -}' +}' | sed 's/\t/ /g') test_config_cmd() { test_config_cmd_set "beep" "boop" diff --git a/test/sharness/t0042-add-skip.sh b/test/sharness/t0042-add-skip.sh index f39ab5a8c..96f85298f 100755 --- a/test/sharness/t0042-add-skip.sh +++ b/test/sharness/t0042-add-skip.sh @@ -49,8 +49,8 @@ test_add_skip() { ' test_expect_success "'ipfs add' includes hidden files given explicitly even without --hidden" ' - mkdir -p mountdir/dotfiles && - echo "set nocompatible" > mountdir/dotfiles/.vimrc + mkdir -p mountdir/dotfiles && + echo "set nocompatible" > mountdir/dotfiles/.vimrc cat >expected <<-\EOF && added QmT4uMRDCN7EMpFeqwvKkboszbqeW1kWVGrBxBuCGqZcQc .vimrc EOF diff --git a/test/sharness/t0083-repo-fsck.sh b/test/sharness/t0083-repo-fsck.sh index 2b960dc98..438d1f166 100755 --- a/test/sharness/t0083-repo-fsck.sh +++ b/test/sharness/t0083-repo-fsck.sh @@ -70,7 +70,7 @@ test_expect_success "'ipfs repo fsck' succeeds partial lock" ' ' test_expect_success "'ipfs repo fsck' output looks good with no daemon" ' - grep "Lockfiles have been removed." fsck_out_actual2 + grep "Lockfiles have been removed." fsck_out_actual2 ' # Make sure the files are actually removed diff --git a/test/sharness/t0250-files-api.sh b/test/sharness/t0250-files-api.sh index 5ade5a4c3..01b587c0c 100755 --- a/test/sharness/t0250-files-api.sh +++ b/test/sharness/t0250-files-api.sh @@ -533,7 +533,7 @@ test_files_api() { verify_dir_contents / ' - test_expect_success "repo gc" ' + test_expect_success "repo gc" ' ipfs repo gc ' } diff --git a/test/sharness/t0271-filestore-utils.sh b/test/sharness/t0271-filestore-utils.sh index 9105c2f83..ae20d221d 100755 --- a/test/sharness/t0271-filestore-utils.sh +++ b/test/sharness/t0271-filestore-utils.sh @@ -149,8 +149,8 @@ test_filestore_verify() { grep changed verify_actual | grep -q somedir/file3 ' - # reset the state for the next test - test_init_dataset + # reset the state for the next test + test_init_dataset } test_filestore_dups() {