Merge branch 'ps/ci-meson'
The meson-build procedure is integrated into CI to catch and prevent bitrotting. * ps/ci-meson: ci: wire up Meson builds t: introduce compatibility options to clar-based tests t: fix out-of-tree tests for some git-p4 tests Makefile: detect missing Meson tests meson: detect missing tests at configure time t/unit-tests: rename clar-based unit tests to have a common prefix Makefile: drop -DSUPPRESS_ANNOTATED_LEAKS ci/lib: support custom output directories when creating test artifactsmaint
commit
83c8f76235
|
@ -282,6 +282,9 @@ jobs:
|
||||||
- jobname: osx-gcc
|
- jobname: osx-gcc
|
||||||
cc: gcc-13
|
cc: gcc-13
|
||||||
pool: macos-13
|
pool: macos-13
|
||||||
|
- jobname: osx-meson
|
||||||
|
cc: clang
|
||||||
|
pool: macos-13
|
||||||
- jobname: linux-gcc-default
|
- jobname: linux-gcc-default
|
||||||
cc: gcc
|
cc: gcc
|
||||||
pool: ubuntu-latest
|
pool: ubuntu-latest
|
||||||
|
@ -294,11 +297,15 @@ jobs:
|
||||||
- jobname: linux-asan-ubsan
|
- jobname: linux-asan-ubsan
|
||||||
cc: clang
|
cc: clang
|
||||||
pool: ubuntu-latest
|
pool: ubuntu-latest
|
||||||
|
- jobname: linux-meson
|
||||||
|
cc: gcc
|
||||||
|
pool: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
CC: ${{matrix.vector.cc}}
|
CC: ${{matrix.vector.cc}}
|
||||||
CC_PACKAGE: ${{matrix.vector.cc_package}}
|
CC_PACKAGE: ${{matrix.vector.cc_package}}
|
||||||
jobname: ${{matrix.vector.jobname}}
|
jobname: ${{matrix.vector.jobname}}
|
||||||
distro: ${{matrix.vector.pool}}
|
distro: ${{matrix.vector.pool}}
|
||||||
|
TEST_OUTPUT_DIRECTORY: ${{github.workspace}}/t
|
||||||
runs-on: ${{matrix.vector.pool}}
|
runs-on: ${{matrix.vector.pool}}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
|
@ -20,6 +20,7 @@ test:linux:
|
||||||
- saas-linux-medium-amd64
|
- saas-linux-medium-amd64
|
||||||
variables:
|
variables:
|
||||||
CUSTOM_PATH: "/custom"
|
CUSTOM_PATH: "/custom"
|
||||||
|
TEST_OUTPUT_DIRECTORY: "/tmp/test-output"
|
||||||
before_script:
|
before_script:
|
||||||
- ./ci/install-dependencies.sh
|
- ./ci/install-dependencies.sh
|
||||||
script:
|
script:
|
||||||
|
@ -31,6 +32,7 @@ test:linux:
|
||||||
if test "$CI_JOB_STATUS" != 'success'
|
if test "$CI_JOB_STATUS" != 'success'
|
||||||
then
|
then
|
||||||
sudo --preserve-env --set-home --user=builder ./ci/print-test-failures.sh
|
sudo --preserve-env --set-home --user=builder ./ci/print-test-failures.sh
|
||||||
|
mv "$TEST_OUTPUT_DIRECTORY"/failed-test-artifacts t/
|
||||||
fi
|
fi
|
||||||
parallel:
|
parallel:
|
||||||
matrix:
|
matrix:
|
||||||
|
@ -67,6 +69,9 @@ test:linux:
|
||||||
image: fedora:latest
|
image: fedora:latest
|
||||||
- jobname: linux-musl
|
- jobname: linux-musl
|
||||||
image: alpine:latest
|
image: alpine:latest
|
||||||
|
- jobname: linux-meson
|
||||||
|
image: ubuntu:latest
|
||||||
|
CC: gcc
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- t/failed-test-artifacts
|
- t/failed-test-artifacts
|
||||||
|
@ -104,6 +109,9 @@ test:osx:
|
||||||
- jobname: osx-reftable
|
- jobname: osx-reftable
|
||||||
image: macos-14-xcode-15
|
image: macos-14-xcode-15
|
||||||
CC: clang
|
CC: clang
|
||||||
|
- jobname: osx-meson
|
||||||
|
image: macos-14-xcode-15
|
||||||
|
CC: clang
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- t/failed-test-artifacts
|
- t/failed-test-artifacts
|
||||||
|
|
5
Makefile
5
Makefile
|
@ -1344,8 +1344,8 @@ THIRD_PARTY_SOURCES += sha1dc/%
|
||||||
THIRD_PARTY_SOURCES += $(UNIT_TEST_DIR)/clar/%
|
THIRD_PARTY_SOURCES += $(UNIT_TEST_DIR)/clar/%
|
||||||
THIRD_PARTY_SOURCES += $(UNIT_TEST_DIR)/clar/clar/%
|
THIRD_PARTY_SOURCES += $(UNIT_TEST_DIR)/clar/clar/%
|
||||||
|
|
||||||
CLAR_TEST_SUITES += ctype
|
CLAR_TEST_SUITES += u-ctype
|
||||||
CLAR_TEST_SUITES += strvec
|
CLAR_TEST_SUITES += u-strvec
|
||||||
CLAR_TEST_PROG = $(UNIT_TEST_BIN)/unit-tests$(X)
|
CLAR_TEST_PROG = $(UNIT_TEST_BIN)/unit-tests$(X)
|
||||||
CLAR_TEST_OBJS = $(patsubst %,$(UNIT_TEST_DIR)/%.o,$(CLAR_TEST_SUITES))
|
CLAR_TEST_OBJS = $(patsubst %,$(UNIT_TEST_DIR)/%.o,$(CLAR_TEST_SUITES))
|
||||||
CLAR_TEST_OBJS += $(UNIT_TEST_DIR)/clar/clar.o
|
CLAR_TEST_OBJS += $(UNIT_TEST_DIR)/clar/clar.o
|
||||||
|
@ -1490,7 +1490,6 @@ ifneq ($(filter undefined,$(SANITIZERS)),)
|
||||||
BASIC_CFLAGS += -DSHA1DC_FORCE_ALIGNED_ACCESS
|
BASIC_CFLAGS += -DSHA1DC_FORCE_ALIGNED_ACCESS
|
||||||
endif
|
endif
|
||||||
ifneq ($(filter leak,$(SANITIZERS)),)
|
ifneq ($(filter leak,$(SANITIZERS)),)
|
||||||
BASIC_CFLAGS += -DSUPPRESS_ANNOTATED_LEAKS
|
|
||||||
BASIC_CFLAGS += -O0
|
BASIC_CFLAGS += -O0
|
||||||
SANITIZE_LEAK = YesCompiledWithIt
|
SANITIZE_LEAK = YesCompiledWithIt
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -58,6 +58,7 @@ ubuntu-*|ubuntu32-*|debian-*)
|
||||||
make libssl-dev libcurl4-openssl-dev libexpat-dev wget sudo default-jre \
|
make libssl-dev libcurl4-openssl-dev libexpat-dev wget sudo default-jre \
|
||||||
tcl tk gettext zlib1g-dev perl-modules liberror-perl libauthen-sasl-perl \
|
tcl tk gettext zlib1g-dev perl-modules liberror-perl libauthen-sasl-perl \
|
||||||
libemail-valid-perl libio-pty-perl libio-socket-ssl-perl libnet-smtp-ssl-perl libdbd-sqlite3-perl libcgi-pm-perl \
|
libemail-valid-perl libio-pty-perl libio-socket-ssl-perl libnet-smtp-ssl-perl libdbd-sqlite3-perl libcgi-pm-perl \
|
||||||
|
libpcre2-dev meson ninja-build pkg-config \
|
||||||
${CC_PACKAGE:-${CC:-gcc}} $PYTHON_PACKAGE
|
${CC_PACKAGE:-${CC:-gcc}} $PYTHON_PACKAGE
|
||||||
|
|
||||||
case "$distro" in
|
case "$distro" in
|
||||||
|
@ -90,6 +91,12 @@ macos-*)
|
||||||
sudo xattr -d com.apple.quarantine "$CUSTOM_PATH/p4" "$CUSTOM_PATH/p4d" 2>/dev/null || true
|
sudo xattr -d com.apple.quarantine "$CUSTOM_PATH/p4" "$CUSTOM_PATH/p4d" 2>/dev/null || true
|
||||||
rm helix-core-server.tgz
|
rm helix-core-server.tgz
|
||||||
|
|
||||||
|
case "$jobname" in
|
||||||
|
osx-meson)
|
||||||
|
brew install meson ninja pcre2
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
if test -n "$CC_PACKAGE"
|
if test -n "$CC_PACKAGE"
|
||||||
then
|
then
|
||||||
BREW_PACKAGE=${CC_PACKAGE/-/@}
|
BREW_PACKAGE=${CC_PACKAGE/-/@}
|
||||||
|
|
14
ci/lib.sh
14
ci/lib.sh
|
@ -181,9 +181,9 @@ handle_failed_tests () {
|
||||||
}
|
}
|
||||||
|
|
||||||
create_failed_test_artifacts () {
|
create_failed_test_artifacts () {
|
||||||
mkdir -p t/failed-test-artifacts
|
mkdir -p "${TEST_OUTPUT_DIRECTORY:-t}"/failed-test-artifacts
|
||||||
|
|
||||||
for test_exit in t/test-results/*.exit
|
for test_exit in "${TEST_OUTPUT_DIRECTORY:-t}"/test-results/*.exit
|
||||||
do
|
do
|
||||||
test 0 != "$(cat "$test_exit")" || continue
|
test 0 != "$(cat "$test_exit")" || continue
|
||||||
|
|
||||||
|
@ -192,11 +192,11 @@ create_failed_test_artifacts () {
|
||||||
printf "\\e[33m\\e[1m=== Failed test: ${test_name} ===\\e[m\\n"
|
printf "\\e[33m\\e[1m=== Failed test: ${test_name} ===\\e[m\\n"
|
||||||
echo "The full logs are in the 'print test failures' step below."
|
echo "The full logs are in the 'print test failures' step below."
|
||||||
echo "See also the 'failed-tests-*' artifacts attached to this run."
|
echo "See also the 'failed-tests-*' artifacts attached to this run."
|
||||||
cat "t/test-results/$test_name.markup"
|
cat "${TEST_OUTPUT_DIRECTORY:-t}/test-results/$test_name.markup"
|
||||||
|
|
||||||
trash_dir="t/trash directory.$test_name"
|
trash_dir="${TEST_OUTPUT_DIRECTORY:-t}/trash directory.$test_name"
|
||||||
cp "t/test-results/$test_name.out" t/failed-test-artifacts/
|
cp "${TEST_OUTPUT_DIRECTORY:-t}/test-results/$test_name.out" "${TEST_OUTPUT_DIRECTORY:-t}"/failed-test-artifacts/
|
||||||
tar czf t/failed-test-artifacts/"$test_name".trash.tar.gz "$trash_dir"
|
tar czf "${TEST_OUTPUT_DIRECTORY:-t}/failed-test-artifacts/$test_name.trash.tar.gz" "$trash_dir"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ then
|
||||||
CC="${CC_PACKAGE:-${CC:-gcc}}"
|
CC="${CC_PACKAGE:-${CC:-gcc}}"
|
||||||
DONT_SKIP_TAGS=t
|
DONT_SKIP_TAGS=t
|
||||||
handle_failed_tests () {
|
handle_failed_tests () {
|
||||||
echo "FAILED_TEST_ARTIFACTS=t/failed-test-artifacts" >>$GITHUB_ENV
|
echo "FAILED_TEST_ARTIFACTS=${TEST_OUTPUT_DIRECTORY:-t}/failed-test-artifacts" >>$GITHUB_ENV
|
||||||
create_failed_test_artifacts
|
create_failed_test_artifacts
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ do
|
||||||
;;
|
;;
|
||||||
github-actions)
|
github-actions)
|
||||||
mkdir -p failed-test-artifacts
|
mkdir -p failed-test-artifacts
|
||||||
echo "FAILED_TEST_ARTIFACTS=t/failed-test-artifacts" >>$GITHUB_ENV
|
echo "FAILED_TEST_ARTIFACTS=${TEST_OUTPUT_DIRECTORY:t}/failed-test-artifacts" >>$GITHUB_ENV
|
||||||
cp "${TEST_EXIT%.exit}.out" failed-test-artifacts/
|
cp "${TEST_EXIT%.exit}.out" failed-test-artifacts/
|
||||||
tar czf failed-test-artifacts/"$test_name".trash.tar.gz "$trash_dir"
|
tar czf failed-test-artifacts/"$test_name".trash.tar.gz "$trash_dir"
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -48,12 +48,29 @@ pedantic)
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
group Build make
|
case "$jobname" in
|
||||||
if test -n "$run_tests"
|
*-meson)
|
||||||
then
|
group "Configure" meson setup build . \
|
||||||
group "Run tests" make test ||
|
--warnlevel 2 --werror \
|
||||||
handle_failed_tests
|
--wrap-mode nofallback
|
||||||
fi
|
group "Build" meson compile -C build --
|
||||||
check_unignored_build_artifacts
|
if test -n "$run_tests"
|
||||||
|
then
|
||||||
|
group "Run tests" meson test -C build --print-errorlogs --test-args="$GIT_TEST_OPTS" || (
|
||||||
|
./t/aggregate-results.sh "${TEST_OUTPUT_DIRECTORY:-t}/test-results"
|
||||||
|
handle_failed_tests
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
group Build make
|
||||||
|
if test -n "$run_tests"
|
||||||
|
then
|
||||||
|
group "Run tests" make test ||
|
||||||
|
handle_failed_tests
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
check_unignored_build_artifacts
|
||||||
save_good_tree
|
save_good_tree
|
||||||
|
|
|
@ -712,7 +712,6 @@ else
|
||||||
build_options_config.set('SANITIZE_ADDRESS', '')
|
build_options_config.set('SANITIZE_ADDRESS', '')
|
||||||
endif
|
endif
|
||||||
if get_option('b_sanitize').contains('leak')
|
if get_option('b_sanitize').contains('leak')
|
||||||
libgit_c_args += '-DSUPPRESS_ANNOTATED_LEAKS'
|
|
||||||
build_options_config.set('SANITIZE_LEAK', 'YesCompiledWithIt')
|
build_options_config.set('SANITIZE_LEAK', 'YesCompiledWithIt')
|
||||||
else
|
else
|
||||||
build_options_config.set('SANITIZE_LEAK', '')
|
build_options_config.set('SANITIZE_LEAK', '')
|
||||||
|
|
|
@ -353,6 +353,18 @@ struct option {
|
||||||
.callback = parse_opt_noop_cb, \
|
.callback = parse_opt_noop_cb, \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *parse_options_noop_ignored_value MAYBE_UNUSED;
|
||||||
|
#define OPT_NOOP_ARG(s, l) { \
|
||||||
|
.type = OPTION_CALLBACK, \
|
||||||
|
.short_name = (s), \
|
||||||
|
.long_name = (l), \
|
||||||
|
.value = &parse_options_noop_ignored_value, \
|
||||||
|
.argh = "ignored", \
|
||||||
|
.help = N_("no-op (backward compatibility)"), \
|
||||||
|
.flags = PARSE_OPT_HIDDEN, \
|
||||||
|
.callback = parse_opt_noop_cb, \
|
||||||
|
}
|
||||||
|
|
||||||
#define OPT_ALIAS(s, l, source_long_name) { \
|
#define OPT_ALIAS(s, l, source_long_name) { \
|
||||||
.type = OPTION_ALIAS, \
|
.type = OPTION_ALIAS, \
|
||||||
.short_name = (s), \
|
.short_name = (s), \
|
||||||
|
|
18
t/Makefile
18
t/Makefile
|
@ -59,7 +59,7 @@ CHAINLINTSUPPRESS = GIT_TEST_EXT_CHAIN_LINT=0 && export GIT_TEST_EXT_CHAIN_LINT
|
||||||
|
|
||||||
all:: $(DEFAULT_TEST_TARGET)
|
all:: $(DEFAULT_TEST_TARGET)
|
||||||
|
|
||||||
test: pre-clean check-chainlint $(TEST_LINT)
|
test: pre-clean check-chainlint check-meson $(TEST_LINT)
|
||||||
$(CHAINLINTSUPPRESS) $(MAKE) aggregate-results-and-cleanup
|
$(CHAINLINTSUPPRESS) $(MAKE) aggregate-results-and-cleanup
|
||||||
|
|
||||||
failed:
|
failed:
|
||||||
|
@ -114,6 +114,22 @@ check-chainlint:
|
||||||
{ $(CHAINLINT) --emit-all '$(CHAINLINTTMP_SQ)'/tests >'$(CHAINLINTTMP_SQ)'/actual || true; } && \
|
{ $(CHAINLINT) --emit-all '$(CHAINLINTTMP_SQ)'/tests >'$(CHAINLINTTMP_SQ)'/actual || true; } && \
|
||||||
diff -u '$(CHAINLINTTMP_SQ)'/expect '$(CHAINLINTTMP_SQ)'/actual
|
diff -u '$(CHAINLINTTMP_SQ)'/expect '$(CHAINLINTTMP_SQ)'/actual
|
||||||
|
|
||||||
|
check-meson:
|
||||||
|
@# awk acts up when trying to match single quotes, so we use \047 instead.
|
||||||
|
@printf "%s\n" \
|
||||||
|
"integration_tests t[0-9][0-9][0-9][0-9]-*.sh" \
|
||||||
|
"unit_test_programs unit-tests/t-*.c" \
|
||||||
|
"clar_test_suites unit-tests/u-*.c" | \
|
||||||
|
while read -r variable pattern; do \
|
||||||
|
meson_tests=$$(awk "/^$$variable = \[\$$/ {flag=1 ; next } /^]$$/ { flag=0 } flag { gsub(/^ \047/, \"\"); gsub(/\047,\$$/, \"\"); print }" meson.build) && \
|
||||||
|
actual_tests=$$(ls $$pattern) && \
|
||||||
|
if test "$$meson_tests" != "$$actual_tests"; then \
|
||||||
|
echo "Meson tests differ from actual tests:"; \
|
||||||
|
diff -u <(echo "$$meson_tests") <(echo "$$actual_tests"); \
|
||||||
|
exit 1; \
|
||||||
|
fi; \
|
||||||
|
done
|
||||||
|
|
||||||
test-lint: test-lint-duplicates test-lint-executable test-lint-shell-syntax \
|
test-lint: test-lint-duplicates test-lint-executable test-lint-shell-syntax \
|
||||||
test-lint-filenames
|
test-lint-filenames
|
||||||
ifneq ($(GIT_TEST_CHAIN_LINT),0)
|
ifneq ($(GIT_TEST_CHAIN_LINT),0)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
clar_test_suites = [
|
clar_test_suites = [
|
||||||
'unit-tests/ctype.c',
|
'unit-tests/u-ctype.c',
|
||||||
'unit-tests/strvec.c',
|
'unit-tests/u-strvec.c',
|
||||||
]
|
]
|
||||||
|
|
||||||
clar_sources = [
|
clar_sources = [
|
||||||
|
@ -1092,6 +1092,42 @@ integration_tests = [
|
||||||
't9903-bash-prompt.sh',
|
't9903-bash-prompt.sh',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Sanity check that we are not missing any tests present in 't/'. This check
|
||||||
|
# only runs once at configure time and is thus best-effort, only. It is
|
||||||
|
# sufficient to catch missing test suites in our CI though.
|
||||||
|
foreach glob, tests : {
|
||||||
|
't[0-9][0-9][0-9][0-9]-*.sh': integration_tests,
|
||||||
|
'unit-tests/t-*.c': unit_test_programs,
|
||||||
|
'unit-tests/u-*.c': clar_test_suites,
|
||||||
|
}
|
||||||
|
actual_tests = run_command(shell, '-c', 'ls ' + glob,
|
||||||
|
check: true,
|
||||||
|
env: script_environment,
|
||||||
|
).stdout().strip().split('\n')
|
||||||
|
|
||||||
|
if tests != actual_tests
|
||||||
|
missing_tests = [ ]
|
||||||
|
foreach actual_test : actual_tests
|
||||||
|
if actual_test not in tests
|
||||||
|
missing_tests += actual_test
|
||||||
|
endif
|
||||||
|
endforeach
|
||||||
|
if missing_tests.length() > 0
|
||||||
|
error('Test files found, but not configured:\n\n - ' + '\n - '.join(missing_tests))
|
||||||
|
endif
|
||||||
|
|
||||||
|
superfluous_tests = [ ]
|
||||||
|
foreach integration_test : tests
|
||||||
|
if integration_test not in actual_tests
|
||||||
|
superfluous_tests += integration_test
|
||||||
|
endif
|
||||||
|
endforeach
|
||||||
|
if superfluous_tests.length() > 0
|
||||||
|
error('Test files configured, but not found:\n\n - ' + '\n - '.join(superfluous_tests))
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endforeach
|
||||||
|
|
||||||
# GIT_BUILD_DIR needs to be Unix-style without drive prefixes as it get added
|
# GIT_BUILD_DIR needs to be Unix-style without drive prefixes as it get added
|
||||||
# to the PATH variable. And given that drive prefixes contain a colon we'd
|
# to the PATH variable. And given that drive prefixes contain a colon we'd
|
||||||
# otherwise end up with a broken PATH if we didn't convert it.
|
# otherwise end up with a broken PATH if we didn't convert it.
|
||||||
|
|
|
@ -8,29 +8,29 @@ failing, and produces maximally sane output in git.'
|
||||||
|
|
||||||
. ./lib-git-p4.sh
|
. ./lib-git-p4.sh
|
||||||
|
|
||||||
python_target_version='2'
|
|
||||||
|
|
||||||
###############################
|
###############################
|
||||||
## SECTION REPEATED IN t9836 ##
|
## SECTION REPEATED IN t9836 ##
|
||||||
###############################
|
###############################
|
||||||
|
|
||||||
# Please note: this test calls "git-p4.py" rather than "git-p4", because the
|
# These tests are specific to Python 2. Write a custom script that executes
|
||||||
# latter references a specific path so we can't easily force it to run under
|
# git-p4 directly with the Python 2 interpreter to ensure that we use that
|
||||||
# the python version we need to.
|
# version even if Git was compiled with Python 3.
|
||||||
|
python_target_binary=$(which python2)
|
||||||
python_major_version=$(python -V 2>&1 | cut -c 8)
|
if test -n "$python_target_binary"
|
||||||
python_target_binary=$(which python$python_target_version)
|
|
||||||
if ! test "$python_major_version" = "$python_target_version" && test "$python_target_binary"
|
|
||||||
then
|
then
|
||||||
mkdir temp_python
|
mkdir temp_python
|
||||||
PATH="$(pwd)/temp_python:$PATH" && export PATH
|
PATH="$(pwd)/temp_python:$PATH"
|
||||||
ln -s $python_target_binary temp_python/python
|
export PATH
|
||||||
|
|
||||||
|
write_script temp_python/git-p4-python2 <<-EOF
|
||||||
|
exec "$python_target_binary" "$(git --exec-path)/git-p4" "\$@"
|
||||||
|
EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
python_major_version=$(python -V 2>&1 | cut -c 8)
|
git p4-python2 >err
|
||||||
if ! test "$python_major_version" = "$python_target_version"
|
if ! grep 'valid commands' err
|
||||||
then
|
then
|
||||||
skip_all="skipping python$python_target_version-specific git p4 tests; python$python_target_version not available"
|
skip_all="skipping python2 git p4 tests; python2 not available"
|
||||||
test_done
|
test_done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -81,14 +81,14 @@ test_expect_success 'init depot' '
|
||||||
test_expect_success 'clone non-utf8 repo with strict encoding' '
|
test_expect_success 'clone non-utf8 repo with strict encoding' '
|
||||||
test_when_finished cleanup_git &&
|
test_when_finished cleanup_git &&
|
||||||
test_when_finished remove_user_cache &&
|
test_when_finished remove_user_cache &&
|
||||||
test_must_fail git -c git-p4.metadataDecodingStrategy=strict p4.py clone --dest="$git" //depot@all 2>err &&
|
test_must_fail git -c git-p4.metadataDecodingStrategy=strict p4-python2 clone --dest="$git" //depot@all 2>err &&
|
||||||
grep "Decoding perforce metadata failed!" err
|
grep "Decoding perforce metadata failed!" err
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'check utf-8 contents with passthrough strategy' '
|
test_expect_success 'check utf-8 contents with passthrough strategy' '
|
||||||
test_when_finished cleanup_git &&
|
test_when_finished cleanup_git &&
|
||||||
test_when_finished remove_user_cache &&
|
test_when_finished remove_user_cache &&
|
||||||
git -c git-p4.metadataDecodingStrategy=passthrough p4.py clone --dest="$git" //depot@all &&
|
git -c git-p4.metadataDecodingStrategy=passthrough p4-python2 clone --dest="$git" //depot@all &&
|
||||||
(
|
(
|
||||||
cd "$git" &&
|
cd "$git" &&
|
||||||
git log >actual &&
|
git log >actual &&
|
||||||
|
@ -100,7 +100,7 @@ test_expect_success 'check utf-8 contents with passthrough strategy' '
|
||||||
test_expect_success 'check latin-1 contents corrupted in git with passthrough strategy' '
|
test_expect_success 'check latin-1 contents corrupted in git with passthrough strategy' '
|
||||||
test_when_finished cleanup_git &&
|
test_when_finished cleanup_git &&
|
||||||
test_when_finished remove_user_cache &&
|
test_when_finished remove_user_cache &&
|
||||||
git -c git-p4.metadataDecodingStrategy=passthrough p4.py clone --dest="$git" //depot@all &&
|
git -c git-p4.metadataDecodingStrategy=passthrough p4-python2 clone --dest="$git" //depot@all &&
|
||||||
(
|
(
|
||||||
cd "$git" &&
|
cd "$git" &&
|
||||||
git log >actual &&
|
git log >actual &&
|
||||||
|
@ -114,7 +114,7 @@ test_expect_success 'check latin-1 contents corrupted in git with passthrough st
|
||||||
test_expect_success 'check utf-8 contents with fallback strategy' '
|
test_expect_success 'check utf-8 contents with fallback strategy' '
|
||||||
test_when_finished cleanup_git &&
|
test_when_finished cleanup_git &&
|
||||||
test_when_finished remove_user_cache &&
|
test_when_finished remove_user_cache &&
|
||||||
git -c git-p4.metadataDecodingStrategy=fallback p4.py clone --dest="$git" //depot@all &&
|
git -c git-p4.metadataDecodingStrategy=fallback p4-python2 clone --dest="$git" //depot@all &&
|
||||||
(
|
(
|
||||||
cd "$git" &&
|
cd "$git" &&
|
||||||
git log >actual &&
|
git log >actual &&
|
||||||
|
@ -126,7 +126,7 @@ test_expect_success 'check utf-8 contents with fallback strategy' '
|
||||||
test_expect_success 'check latin-1 contents with fallback strategy' '
|
test_expect_success 'check latin-1 contents with fallback strategy' '
|
||||||
test_when_finished cleanup_git &&
|
test_when_finished cleanup_git &&
|
||||||
test_when_finished remove_user_cache &&
|
test_when_finished remove_user_cache &&
|
||||||
git -c git-p4.metadataDecodingStrategy=fallback p4.py clone --dest="$git" //depot@all &&
|
git -c git-p4.metadataDecodingStrategy=fallback p4-python2 clone --dest="$git" //depot@all &&
|
||||||
(
|
(
|
||||||
cd "$git" &&
|
cd "$git" &&
|
||||||
git log >actual &&
|
git log >actual &&
|
||||||
|
@ -138,7 +138,7 @@ test_expect_success 'check latin-1 contents with fallback strategy' '
|
||||||
test_expect_success 'check cp-1252 contents with fallback strategy' '
|
test_expect_success 'check cp-1252 contents with fallback strategy' '
|
||||||
test_when_finished cleanup_git &&
|
test_when_finished cleanup_git &&
|
||||||
test_when_finished remove_user_cache &&
|
test_when_finished remove_user_cache &&
|
||||||
git -c git-p4.metadataDecodingStrategy=fallback p4.py clone --dest="$git" //depot@all &&
|
git -c git-p4.metadataDecodingStrategy=fallback p4-python2 clone --dest="$git" //depot@all &&
|
||||||
(
|
(
|
||||||
cd "$git" &&
|
cd "$git" &&
|
||||||
git log >actual &&
|
git log >actual &&
|
||||||
|
@ -150,7 +150,7 @@ test_expect_success 'check cp-1252 contents with fallback strategy' '
|
||||||
test_expect_success 'check cp850 contents parsed with correct fallback' '
|
test_expect_success 'check cp850 contents parsed with correct fallback' '
|
||||||
test_when_finished cleanup_git &&
|
test_when_finished cleanup_git &&
|
||||||
test_when_finished remove_user_cache &&
|
test_when_finished remove_user_cache &&
|
||||||
git -c git-p4.metadataDecodingStrategy=fallback -c git-p4.metadataFallbackEncoding=cp850 p4.py clone --dest="$git" //depot@all &&
|
git -c git-p4.metadataDecodingStrategy=fallback -c git-p4.metadataFallbackEncoding=cp850 p4-python2 clone --dest="$git" //depot@all &&
|
||||||
(
|
(
|
||||||
cd "$git" &&
|
cd "$git" &&
|
||||||
git log >actual &&
|
git log >actual &&
|
||||||
|
@ -162,7 +162,7 @@ test_expect_success 'check cp850 contents parsed with correct fallback' '
|
||||||
test_expect_success 'check cp850-only contents escaped when cp1252 is fallback' '
|
test_expect_success 'check cp850-only contents escaped when cp1252 is fallback' '
|
||||||
test_when_finished cleanup_git &&
|
test_when_finished cleanup_git &&
|
||||||
test_when_finished remove_user_cache &&
|
test_when_finished remove_user_cache &&
|
||||||
git -c git-p4.metadataDecodingStrategy=fallback p4.py clone --dest="$git" //depot@all &&
|
git -c git-p4.metadataDecodingStrategy=fallback p4-python2 clone --dest="$git" //depot@all &&
|
||||||
(
|
(
|
||||||
cd "$git" &&
|
cd "$git" &&
|
||||||
git log >actual &&
|
git log >actual &&
|
||||||
|
@ -174,7 +174,7 @@ test_expect_success 'check cp850-only contents escaped when cp1252 is fallback'
|
||||||
test_expect_success 'check cp-1252 contents on later sync after clone with fallback strategy' '
|
test_expect_success 'check cp-1252 contents on later sync after clone with fallback strategy' '
|
||||||
test_when_finished cleanup_git &&
|
test_when_finished cleanup_git &&
|
||||||
test_when_finished remove_user_cache &&
|
test_when_finished remove_user_cache &&
|
||||||
git -c git-p4.metadataDecodingStrategy=fallback p4.py clone --dest="$git" //depot@all &&
|
git -c git-p4.metadataDecodingStrategy=fallback p4-python2 clone --dest="$git" //depot@all &&
|
||||||
(
|
(
|
||||||
cd "$cli" &&
|
cd "$cli" &&
|
||||||
P4USER=cp1252_author &&
|
P4USER=cp1252_author &&
|
||||||
|
@ -186,7 +186,7 @@ test_expect_success 'check cp-1252 contents on later sync after clone with fallb
|
||||||
(
|
(
|
||||||
cd "$git" &&
|
cd "$git" &&
|
||||||
|
|
||||||
git p4.py sync --branch=master &&
|
git p4-python2 sync --branch=master &&
|
||||||
|
|
||||||
git log p4/master >actual &&
|
git log p4/master >actual &&
|
||||||
grep "sœme more cp-1252 tæxt" actual &&
|
grep "sœme more cp-1252 tæxt" actual &&
|
||||||
|
@ -201,7 +201,7 @@ test_expect_success 'check cp-1252 contents on later sync after clone with fallb
|
||||||
test_expect_success 'passthrough (latin-1 contents corrupted in git) is the default with python2' '
|
test_expect_success 'passthrough (latin-1 contents corrupted in git) is the default with python2' '
|
||||||
test_when_finished cleanup_git &&
|
test_when_finished cleanup_git &&
|
||||||
test_when_finished remove_user_cache &&
|
test_when_finished remove_user_cache &&
|
||||||
git -c git-p4.metadataDecodingStrategy=passthrough p4.py clone --dest="$git" //depot@all &&
|
git -c git-p4.metadataDecodingStrategy=passthrough p4-python2 clone --dest="$git" //depot@all &&
|
||||||
(
|
(
|
||||||
cd "$git" &&
|
cd "$git" &&
|
||||||
git log >actual &&
|
git log >actual &&
|
||||||
|
|
|
@ -8,29 +8,29 @@ failing, and produces maximally sane output in git.'
|
||||||
|
|
||||||
. ./lib-git-p4.sh
|
. ./lib-git-p4.sh
|
||||||
|
|
||||||
python_target_version='3'
|
|
||||||
|
|
||||||
###############################
|
###############################
|
||||||
## SECTION REPEATED IN t9835 ##
|
## SECTION REPEATED IN t9835 ##
|
||||||
###############################
|
###############################
|
||||||
|
|
||||||
# Please note: this test calls "git-p4.py" rather than "git-p4", because the
|
# These tests are specific to Python 3. Write a custom script that executes
|
||||||
# latter references a specific path so we can't easily force it to run under
|
# git-p4 directly with the Python 3 interpreter to ensure that we use that
|
||||||
# the python version we need to.
|
# version even if Git was compiled with Python 2.
|
||||||
|
python_target_binary=$(which python3)
|
||||||
python_major_version=$(python -V 2>&1 | cut -c 8)
|
if test -n "$python_target_binary"
|
||||||
python_target_binary=$(which python$python_target_version)
|
|
||||||
if ! test "$python_major_version" = "$python_target_version" && test "$python_target_binary"
|
|
||||||
then
|
then
|
||||||
mkdir temp_python
|
mkdir temp_python
|
||||||
PATH="$(pwd)/temp_python:$PATH" && export PATH
|
PATH="$(pwd)/temp_python:$PATH"
|
||||||
ln -s $python_target_binary temp_python/python
|
export PATH
|
||||||
|
|
||||||
|
write_script temp_python/git-p4-python3 <<-EOF
|
||||||
|
exec "$python_target_binary" "$(git --exec-path)/git-p4" "\$@"
|
||||||
|
EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
python_major_version=$(python -V 2>&1 | cut -c 8)
|
git p4-python3 >err
|
||||||
if ! test "$python_major_version" = "$python_target_version"
|
if ! grep 'valid commands' err
|
||||||
then
|
then
|
||||||
skip_all="skipping python$python_target_version-specific git p4 tests; python$python_target_version not available"
|
skip_all="skipping python3 git p4 tests; python3 not available"
|
||||||
test_done
|
test_done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -81,14 +81,14 @@ test_expect_success 'init depot' '
|
||||||
test_expect_success 'clone non-utf8 repo with strict encoding' '
|
test_expect_success 'clone non-utf8 repo with strict encoding' '
|
||||||
test_when_finished cleanup_git &&
|
test_when_finished cleanup_git &&
|
||||||
test_when_finished remove_user_cache &&
|
test_when_finished remove_user_cache &&
|
||||||
test_must_fail git -c git-p4.metadataDecodingStrategy=strict p4.py clone --dest="$git" //depot@all 2>err &&
|
test_must_fail git -c git-p4.metadataDecodingStrategy=strict p4-python3 clone --dest="$git" //depot@all 2>err &&
|
||||||
grep "Decoding perforce metadata failed!" err
|
grep "Decoding perforce metadata failed!" err
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'check utf-8 contents with passthrough strategy' '
|
test_expect_success 'check utf-8 contents with passthrough strategy' '
|
||||||
test_when_finished cleanup_git &&
|
test_when_finished cleanup_git &&
|
||||||
test_when_finished remove_user_cache &&
|
test_when_finished remove_user_cache &&
|
||||||
git -c git-p4.metadataDecodingStrategy=passthrough p4.py clone --dest="$git" //depot@all &&
|
git -c git-p4.metadataDecodingStrategy=passthrough p4-python3 clone --dest="$git" //depot@all &&
|
||||||
(
|
(
|
||||||
cd "$git" &&
|
cd "$git" &&
|
||||||
git log >actual &&
|
git log >actual &&
|
||||||
|
@ -100,7 +100,7 @@ test_expect_success 'check utf-8 contents with passthrough strategy' '
|
||||||
test_expect_success 'check latin-1 contents corrupted in git with passthrough strategy' '
|
test_expect_success 'check latin-1 contents corrupted in git with passthrough strategy' '
|
||||||
test_when_finished cleanup_git &&
|
test_when_finished cleanup_git &&
|
||||||
test_when_finished remove_user_cache &&
|
test_when_finished remove_user_cache &&
|
||||||
git -c git-p4.metadataDecodingStrategy=passthrough p4.py clone --dest="$git" //depot@all &&
|
git -c git-p4.metadataDecodingStrategy=passthrough p4-python3 clone --dest="$git" //depot@all &&
|
||||||
(
|
(
|
||||||
cd "$git" &&
|
cd "$git" &&
|
||||||
git log >actual &&
|
git log >actual &&
|
||||||
|
@ -114,7 +114,7 @@ test_expect_success 'check latin-1 contents corrupted in git with passthrough st
|
||||||
test_expect_success 'check utf-8 contents with fallback strategy' '
|
test_expect_success 'check utf-8 contents with fallback strategy' '
|
||||||
test_when_finished cleanup_git &&
|
test_when_finished cleanup_git &&
|
||||||
test_when_finished remove_user_cache &&
|
test_when_finished remove_user_cache &&
|
||||||
git -c git-p4.metadataDecodingStrategy=fallback p4.py clone --dest="$git" //depot@all &&
|
git -c git-p4.metadataDecodingStrategy=fallback p4-python3 clone --dest="$git" //depot@all &&
|
||||||
(
|
(
|
||||||
cd "$git" &&
|
cd "$git" &&
|
||||||
git log >actual &&
|
git log >actual &&
|
||||||
|
@ -126,7 +126,7 @@ test_expect_success 'check utf-8 contents with fallback strategy' '
|
||||||
test_expect_success 'check latin-1 contents with fallback strategy' '
|
test_expect_success 'check latin-1 contents with fallback strategy' '
|
||||||
test_when_finished cleanup_git &&
|
test_when_finished cleanup_git &&
|
||||||
test_when_finished remove_user_cache &&
|
test_when_finished remove_user_cache &&
|
||||||
git -c git-p4.metadataDecodingStrategy=fallback p4.py clone --dest="$git" //depot@all &&
|
git -c git-p4.metadataDecodingStrategy=fallback p4-python3 clone --dest="$git" //depot@all &&
|
||||||
(
|
(
|
||||||
cd "$git" &&
|
cd "$git" &&
|
||||||
git log >actual &&
|
git log >actual &&
|
||||||
|
@ -138,7 +138,7 @@ test_expect_success 'check latin-1 contents with fallback strategy' '
|
||||||
test_expect_success 'check cp-1252 contents with fallback strategy' '
|
test_expect_success 'check cp-1252 contents with fallback strategy' '
|
||||||
test_when_finished cleanup_git &&
|
test_when_finished cleanup_git &&
|
||||||
test_when_finished remove_user_cache &&
|
test_when_finished remove_user_cache &&
|
||||||
git -c git-p4.metadataDecodingStrategy=fallback p4.py clone --dest="$git" //depot@all &&
|
git -c git-p4.metadataDecodingStrategy=fallback p4-python3 clone --dest="$git" //depot@all &&
|
||||||
(
|
(
|
||||||
cd "$git" &&
|
cd "$git" &&
|
||||||
git log >actual &&
|
git log >actual &&
|
||||||
|
@ -150,7 +150,7 @@ test_expect_success 'check cp-1252 contents with fallback strategy' '
|
||||||
test_expect_success 'check cp850 contents parsed with correct fallback' '
|
test_expect_success 'check cp850 contents parsed with correct fallback' '
|
||||||
test_when_finished cleanup_git &&
|
test_when_finished cleanup_git &&
|
||||||
test_when_finished remove_user_cache &&
|
test_when_finished remove_user_cache &&
|
||||||
git -c git-p4.metadataDecodingStrategy=fallback -c git-p4.metadataFallbackEncoding=cp850 p4.py clone --dest="$git" //depot@all &&
|
git -c git-p4.metadataDecodingStrategy=fallback -c git-p4.metadataFallbackEncoding=cp850 p4-python3 clone --dest="$git" //depot@all &&
|
||||||
(
|
(
|
||||||
cd "$git" &&
|
cd "$git" &&
|
||||||
git log >actual &&
|
git log >actual &&
|
||||||
|
@ -162,7 +162,7 @@ test_expect_success 'check cp850 contents parsed with correct fallback' '
|
||||||
test_expect_success 'check cp850-only contents escaped when cp1252 is fallback' '
|
test_expect_success 'check cp850-only contents escaped when cp1252 is fallback' '
|
||||||
test_when_finished cleanup_git &&
|
test_when_finished cleanup_git &&
|
||||||
test_when_finished remove_user_cache &&
|
test_when_finished remove_user_cache &&
|
||||||
git -c git-p4.metadataDecodingStrategy=fallback p4.py clone --dest="$git" //depot@all &&
|
git -c git-p4.metadataDecodingStrategy=fallback p4-python3 clone --dest="$git" //depot@all &&
|
||||||
(
|
(
|
||||||
cd "$git" &&
|
cd "$git" &&
|
||||||
git log >actual &&
|
git log >actual &&
|
||||||
|
@ -174,7 +174,7 @@ test_expect_success 'check cp850-only contents escaped when cp1252 is fallback'
|
||||||
test_expect_success 'check cp-1252 contents on later sync after clone with fallback strategy' '
|
test_expect_success 'check cp-1252 contents on later sync after clone with fallback strategy' '
|
||||||
test_when_finished cleanup_git &&
|
test_when_finished cleanup_git &&
|
||||||
test_when_finished remove_user_cache &&
|
test_when_finished remove_user_cache &&
|
||||||
git -c git-p4.metadataDecodingStrategy=fallback p4.py clone --dest="$git" //depot@all &&
|
git -c git-p4.metadataDecodingStrategy=fallback p4-python3 clone --dest="$git" //depot@all &&
|
||||||
(
|
(
|
||||||
cd "$cli" &&
|
cd "$cli" &&
|
||||||
P4USER=cp1252_author &&
|
P4USER=cp1252_author &&
|
||||||
|
@ -186,7 +186,7 @@ test_expect_success 'check cp-1252 contents on later sync after clone with fallb
|
||||||
(
|
(
|
||||||
cd "$git" &&
|
cd "$git" &&
|
||||||
|
|
||||||
git p4.py sync --branch=master &&
|
git p4-python3 sync --branch=master &&
|
||||||
|
|
||||||
git log p4/master >actual &&
|
git log p4/master >actual &&
|
||||||
grep "sœme more cp-1252 tæxt" actual &&
|
grep "sœme more cp-1252 tæxt" actual &&
|
||||||
|
@ -202,7 +202,7 @@ test_expect_success 'check cp-1252 contents on later sync after clone with fallb
|
||||||
test_expect_success 'fallback (both utf-8 and cp-1252 contents handled) is the default with python3' '
|
test_expect_success 'fallback (both utf-8 and cp-1252 contents handled) is the default with python3' '
|
||||||
test_when_finished cleanup_git &&
|
test_when_finished cleanup_git &&
|
||||||
test_when_finished remove_user_cache &&
|
test_when_finished remove_user_cache &&
|
||||||
git p4.py clone --dest="$git" //depot@all &&
|
git p4-python3 clone --dest="$git" //depot@all &&
|
||||||
(
|
(
|
||||||
cd "$git" &&
|
cd "$git" &&
|
||||||
git log >actual &&
|
git log >actual &&
|
||||||
|
|
|
@ -11,6 +11,9 @@ shift
|
||||||
|
|
||||||
for suite in "$@"
|
for suite in "$@"
|
||||||
do
|
do
|
||||||
sed -ne "s/^\(void test_$(basename "${suite%.c}")__[a-zA-Z_0-9][a-zA-Z_0-9]*(void)\)$/extern \1;/p" "$suite" ||
|
suite_name=$(basename "$suite")
|
||||||
|
suite_name=${suite_name%.c}
|
||||||
|
suite_name=${suite_name#u-}
|
||||||
|
sed -ne "s/^\(void test_${suite_name}__[a-zA-Z_0-9][a-zA-Z_0-9]*(void)\)$/extern \1;/p" "$suite" ||
|
||||||
exit 1
|
exit 1
|
||||||
done >"$OUTPUT"
|
done >"$OUTPUT"
|
||||||
|
|
|
@ -18,8 +18,25 @@ int cmd_main(int argc, const char **argv)
|
||||||
N_("immediately exit upon the first failed test")),
|
N_("immediately exit upon the first failed test")),
|
||||||
OPT_STRING_LIST('r', "run", &run_args, N_("suite[::test]"),
|
OPT_STRING_LIST('r', "run", &run_args, N_("suite[::test]"),
|
||||||
N_("run only test suite or individual test <suite[::test]>")),
|
N_("run only test suite or individual test <suite[::test]>")),
|
||||||
OPT_STRING_LIST('x', "exclude", &exclude_args, N_("suite"),
|
OPT_STRING_LIST(0, "exclude", &exclude_args, N_("suite"),
|
||||||
N_("exclude test suite <suite>")),
|
N_("exclude test suite <suite>")),
|
||||||
|
/*
|
||||||
|
* Compatibility wrappers so that we don't have to filter
|
||||||
|
* options understood by integration tests.
|
||||||
|
*/
|
||||||
|
OPT_NOOP_NOARG('d', "debug"),
|
||||||
|
OPT_NOOP_NOARG(0, "github-workflow-markup"),
|
||||||
|
OPT_NOOP_NOARG(0, "no-bin-wrappers"),
|
||||||
|
OPT_NOOP_ARG(0, "root"),
|
||||||
|
OPT_NOOP_ARG(0, "stress"),
|
||||||
|
OPT_NOOP_NOARG(0, "tee"),
|
||||||
|
OPT_NOOP_NOARG(0, "with-dashes"),
|
||||||
|
OPT_NOOP_ARG(0, "valgrind"),
|
||||||
|
OPT_NOOP_ARG(0, "valgrind-only"),
|
||||||
|
OPT_NOOP_NOARG('v', "verbose"),
|
||||||
|
OPT_NOOP_NOARG('V', "verbose-log"),
|
||||||
|
OPT_NOOP_ARG(0, "verbose-only"),
|
||||||
|
OPT_NOOP_NOARG('x', NULL),
|
||||||
OPT_END(),
|
OPT_END(),
|
||||||
};
|
};
|
||||||
struct strvec args = STRVEC_INIT;
|
struct strvec args = STRVEC_INIT;
|
||||||
|
|
Loading…
Reference in New Issue