diff options
Diffstat (limited to 'contrib/scalar/t')
-rw-r--r-- | contrib/scalar/t/Makefile | 81 | ||||
-rwxr-xr-x | contrib/scalar/t/t9099-scalar.sh | 123 |
2 files changed, 0 insertions, 204 deletions
diff --git a/contrib/scalar/t/Makefile b/contrib/scalar/t/Makefile deleted file mode 100644 index 01e82e5..0000000 --- a/contrib/scalar/t/Makefile +++ /dev/null @@ -1,81 +0,0 @@ -# Import tree-wide shared Makefile behavior and libraries -include ../../../shared.mak - -# Run scalar tests -# -# Copyright (c) 2005,2021 Junio C Hamano, Johannes Schindelin -# - --include ../../../config.mak.autogen --include ../../../config.mak - -SHELL_PATH ?= $(SHELL) -PERL_PATH ?= /usr/bin/perl -RM ?= rm -f -PROVE ?= prove -DEFAULT_TEST_TARGET ?= test -TEST_LINT ?= test-lint - -ifdef TEST_OUTPUT_DIRECTORY -TEST_RESULTS_DIRECTORY = $(TEST_OUTPUT_DIRECTORY)/test-results -else -TEST_RESULTS_DIRECTORY = ../../../t/test-results -endif - -# Shell quote; -SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) -PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH)) -TEST_RESULTS_DIRECTORY_SQ = $(subst ','\'',$(TEST_RESULTS_DIRECTORY)) - -T = $(sort $(wildcard t[0-9][0-9][0-9][0-9]-*.sh)) - -all: $(DEFAULT_TEST_TARGET) - -test: $(TEST_LINT) - $(MAKE) aggregate-results-and-cleanup - -prove: $(TEST_LINT) - @echo "*** prove ***"; GIT_CONFIG=.git/config $(PROVE) --exec '$(SHELL_PATH_SQ)' $(GIT_PROVE_OPTS) $(T) :: $(GIT_TEST_OPTS) - $(MAKE) clean-except-prove-cache - -$(T): - @echo "*** $@ ***"; GIT_CONFIG=.git/config '$(SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS) - -clean-except-prove-cache: - $(RM) -r 'trash directory'.* '$(TEST_RESULTS_DIRECTORY_SQ)' - $(RM) -r valgrind/bin - -clean: clean-except-prove-cache - $(RM) .prove - -test-lint: test-lint-duplicates test-lint-executable test-lint-shell-syntax - -test-lint-duplicates: - @dups=`echo $(T) | tr ' ' '\n' | sed 's/-.*//' | sort | uniq -d` && \ - test -z "$$dups" || { \ - echo >&2 "duplicate test numbers:" $$dups; exit 1; } - -test-lint-executable: - @bad=`for i in $(T); do test -x "$$i" || echo $$i; done` && \ - test -z "$$bad" || { \ - echo >&2 "non-executable tests:" $$bad; exit 1; } - -test-lint-shell-syntax: - @'$(PERL_PATH_SQ)' ../../../t/check-non-portable-shell.pl $(T) - -aggregate-results-and-cleanup: $(T) - $(MAKE) aggregate-results - $(MAKE) clean - -aggregate-results: - for f in '$(TEST_RESULTS_DIRECTORY_SQ)'/t*-*.counts; do \ - echo "$$f"; \ - done | '$(SHELL_PATH_SQ)' ../../../t/aggregate-results.sh - -valgrind: - $(MAKE) GIT_TEST_OPTS="$(GIT_TEST_OPTS) --valgrind" - -test-results: - mkdir -p test-results - -.PHONY: $(T) aggregate-results clean valgrind diff --git a/contrib/scalar/t/t9099-scalar.sh b/contrib/scalar/t/t9099-scalar.sh deleted file mode 100755 index 10b1172..0000000 --- a/contrib/scalar/t/t9099-scalar.sh +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/sh - -test_description='test the `scalar` command' - -TEST_DIRECTORY=$PWD/../../../t -export TEST_DIRECTORY - -# Make it work with --no-bin-wrappers -PATH=$PWD/..:$PATH - -. ../../../t/test-lib.sh - -GIT_TEST_MAINT_SCHEDULER="crontab:test-tool crontab ../cron.txt,launchctl:true,schtasks:true" -export GIT_TEST_MAINT_SCHEDULER - -test_expect_success 'scalar shows a usage' ' - test_expect_code 129 scalar -h -' - -test_expect_success 'scalar unregister' ' - git init vanish/src && - scalar register vanish/src && - git config --get --global --fixed-value \ - maintenance.repo "$(pwd)/vanish/src" && - scalar list >scalar.repos && - grep -F "$(pwd)/vanish/src" scalar.repos && - rm -rf vanish/src/.git && - scalar unregister vanish && - test_must_fail git config --get --global --fixed-value \ - maintenance.repo "$(pwd)/vanish/src" && - scalar list >scalar.repos && - ! grep -F "$(pwd)/vanish/src" scalar.repos -' - -test_expect_success 'set up repository to clone' ' - test_commit first && - test_commit second && - test_commit third && - git switch -c parallel first && - mkdir -p 1/2 && - test_commit 1/2/3 && - git config uploadPack.allowFilter true && - git config uploadPack.allowAnySHA1InWant true -' - -test_expect_success 'scalar clone' ' - second=$(git rev-parse --verify second:second.t) && - scalar clone "file://$(pwd)" cloned --single-branch && - ( - cd cloned/src && - - git config --get --global --fixed-value maintenance.repo \ - "$(pwd)" && - - git for-each-ref --format="%(refname)" refs/remotes/origin/ >actual && - echo "refs/remotes/origin/parallel" >expect && - test_cmp expect actual && - - test_path_is_missing 1/2 && - test_must_fail git rev-list --missing=print $second && - git rev-list $second && - git cat-file blob $second >actual && - echo "second" >expect && - test_cmp expect actual - ) -' - -test_expect_success 'scalar reconfigure' ' - git init one/src && - scalar register one && - git -C one/src config core.preloadIndex false && - scalar reconfigure one && - test true = "$(git -C one/src config core.preloadIndex)" && - git -C one/src config core.preloadIndex false && - scalar reconfigure -a && - test true = "$(git -C one/src config core.preloadIndex)" -' - -test_expect_success 'scalar delete without enlistment shows a usage' ' - test_expect_code 129 scalar delete -' - -test_expect_success 'scalar delete with enlistment' ' - scalar delete cloned && - test_path_is_missing cloned -' - -test_expect_success 'scalar supports -c/-C' ' - test_when_finished "scalar delete sub" && - git init sub && - scalar -C sub -c status.aheadBehind=bogus register && - test -z "$(git -C sub config --local status.aheadBehind)" && - test true = "$(git -C sub config core.preloadIndex)" -' - -test_expect_success '`scalar [...] <dir>` errors out when dir is missing' ' - ! scalar run config cloned 2>err && - grep "cloned. does not exist" err -' - -SQ="'" -test_expect_success UNZIP 'scalar diagnose' ' - scalar clone "file://$(pwd)" cloned --single-branch && - git repack && - echo "$(pwd)/.git/objects/" >>cloned/src/.git/objects/info/alternates && - test_commit -C cloned/src loose && - scalar diagnose cloned >out 2>err && - grep "Available space" out && - sed -n "s/.*$SQ\\(.*\\.zip\\)$SQ.*/\\1/p" <err >zip_path && - zip_path=$(cat zip_path) && - test -n "$zip_path" && - unzip -v "$zip_path" && - folder=${zip_path%.zip} && - test_path_is_missing "$folder" && - unzip -p "$zip_path" diagnostics.log >out && - test_file_not_empty out && - unzip -p "$zip_path" packs-local.txt >out && - grep "$(pwd)/.git/objects" out && - unzip -p "$zip_path" objects-local.txt >out && - grep "^Total: [1-9]" out -' - -test_done |