diff options
-rw-r--r-- | .github/workflows/main.yml | 7 | ||||
-rw-r--r-- | .gitlab-ci.yml | 8 | ||||
-rw-r--r-- | Makefile | 5 | ||||
-rwxr-xr-x | ci/install-dependencies.sh | 7 | ||||
-rwxr-xr-x | ci/lib.sh | 14 | ||||
-rwxr-xr-x | ci/print-test-failures.sh | 2 | ||||
-rwxr-xr-x | ci/run-build-and-tests.sh | 31 | ||||
-rw-r--r-- | meson.build | 1 | ||||
-rw-r--r-- | parse-options.h | 12 | ||||
-rw-r--r-- | t/Makefile | 18 | ||||
-rw-r--r-- | t/meson.build | 40 | ||||
-rwxr-xr-x | t/t9835-git-p4-metadata-encoding-python2.sh | 50 | ||||
-rwxr-xr-x | t/t9836-git-p4-metadata-encoding-python3.sh | 50 | ||||
-rwxr-xr-x | t/unit-tests/generate-clar-decls.sh | 5 | ||||
-rw-r--r-- | t/unit-tests/u-ctype.c (renamed from t/unit-tests/ctype.c) | 0 | ||||
-rw-r--r-- | t/unit-tests/u-strvec.c (renamed from t/unit-tests/strvec.c) | 0 | ||||
-rw-r--r-- | t/unit-tests/unit-test.c | 19 |
17 files changed, 195 insertions, 74 deletions
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1c0aa56b16..900be9957a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -282,6 +282,9 @@ jobs: - jobname: osx-gcc cc: gcc-13 pool: macos-13 + - jobname: osx-meson + cc: clang + pool: macos-13 - jobname: linux-gcc-default cc: gcc pool: ubuntu-latest @@ -294,11 +297,15 @@ jobs: - jobname: linux-asan-ubsan cc: clang pool: ubuntu-latest + - jobname: linux-meson + cc: gcc + pool: ubuntu-latest env: CC: ${{matrix.vector.cc}} CC_PACKAGE: ${{matrix.vector.cc_package}} jobname: ${{matrix.vector.jobname}} distro: ${{matrix.vector.pool}} + TEST_OUTPUT_DIRECTORY: ${{github.workspace}}/t runs-on: ${{matrix.vector.pool}} steps: - uses: actions/checkout@v4 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 008966cae4..9254e01583 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -20,6 +20,7 @@ test:linux: - saas-linux-medium-amd64 variables: CUSTOM_PATH: "/custom" + TEST_OUTPUT_DIRECTORY: "/tmp/test-output" before_script: - ./ci/install-dependencies.sh script: @@ -31,6 +32,7 @@ test:linux: if test "$CI_JOB_STATUS" != 'success' then sudo --preserve-env --set-home --user=builder ./ci/print-test-failures.sh + mv "$TEST_OUTPUT_DIRECTORY"/failed-test-artifacts t/ fi parallel: matrix: @@ -67,6 +69,9 @@ test:linux: image: fedora:latest - jobname: linux-musl image: alpine:latest + - jobname: linux-meson + image: ubuntu:latest + CC: gcc artifacts: paths: - t/failed-test-artifacts @@ -104,6 +109,9 @@ test:osx: - jobname: osx-reftable image: macos-14-xcode-15 CC: clang + - jobname: osx-meson + image: macos-14-xcode-15 + CC: clang artifacts: paths: - t/failed-test-artifacts @@ -1344,8 +1344,8 @@ THIRD_PARTY_SOURCES += sha1dc/% THIRD_PARTY_SOURCES += $(UNIT_TEST_DIR)/clar/% THIRD_PARTY_SOURCES += $(UNIT_TEST_DIR)/clar/clar/% -CLAR_TEST_SUITES += ctype -CLAR_TEST_SUITES += strvec +CLAR_TEST_SUITES += u-ctype +CLAR_TEST_SUITES += u-strvec CLAR_TEST_PROG = $(UNIT_TEST_BIN)/unit-tests$(X) CLAR_TEST_OBJS = $(patsubst %,$(UNIT_TEST_DIR)/%.o,$(CLAR_TEST_SUITES)) CLAR_TEST_OBJS += $(UNIT_TEST_DIR)/clar/clar.o @@ -1490,7 +1490,6 @@ ifneq ($(filter undefined,$(SANITIZERS)),) BASIC_CFLAGS += -DSHA1DC_FORCE_ALIGNED_ACCESS endif ifneq ($(filter leak,$(SANITIZERS)),) -BASIC_CFLAGS += -DSUPPRESS_ANNOTATED_LEAKS BASIC_CFLAGS += -O0 SANITIZE_LEAK = YesCompiledWithIt endif diff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh index d020cb7aa5..d1cb9fa878 100755 --- a/ci/install-dependencies.sh +++ b/ci/install-dependencies.sh @@ -58,6 +58,7 @@ ubuntu-*|ubuntu32-*|debian-*) make libssl-dev libcurl4-openssl-dev libexpat-dev wget sudo default-jre \ 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 \ + libpcre2-dev meson ninja-build pkg-config \ ${CC_PACKAGE:-${CC:-gcc}} $PYTHON_PACKAGE case "$distro" in @@ -90,6 +91,12 @@ macos-*) sudo xattr -d com.apple.quarantine "$CUSTOM_PATH/p4" "$CUSTOM_PATH/p4d" 2>/dev/null || true rm helix-core-server.tgz + case "$jobname" in + osx-meson) + brew install meson ninja pcre2 + ;; + esac + if test -n "$CC_PACKAGE" then BREW_PACKAGE=${CC_PACKAGE/-/@} @@ -181,9 +181,9 @@ handle_failed_tests () { } 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 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" echo "The full logs are in the 'print test failures' step below." 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" - cp "t/test-results/$test_name.out" t/failed-test-artifacts/ - tar czf t/failed-test-artifacts/"$test_name".trash.tar.gz "$trash_dir" + trash_dir="${TEST_OUTPUT_DIRECTORY:-t}/trash directory.$test_name" + cp "${TEST_OUTPUT_DIRECTORY:-t}/test-results/$test_name.out" "${TEST_OUTPUT_DIRECTORY:-t}"/failed-test-artifacts/ + tar czf "${TEST_OUTPUT_DIRECTORY:-t}/failed-test-artifacts/$test_name.trash.tar.gz" "$trash_dir" done } @@ -237,7 +237,7 @@ then CC="${CC_PACKAGE:-${CC:-gcc}}" DONT_SKIP_TAGS=t 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 return 1 } diff --git a/ci/print-test-failures.sh b/ci/print-test-failures.sh index b1f80aeac3..655687dd82 100755 --- a/ci/print-test-failures.sh +++ b/ci/print-test-failures.sh @@ -46,7 +46,7 @@ do ;; github-actions) 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/ tar czf failed-test-artifacts/"$test_name".trash.tar.gz "$trash_dir" continue diff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh index 2e28d02b20..c4a41bba0b 100755 --- a/ci/run-build-and-tests.sh +++ b/ci/run-build-and-tests.sh @@ -48,12 +48,29 @@ pedantic) ;; esac -group Build make -if test -n "$run_tests" -then - group "Run tests" make test || - handle_failed_tests -fi -check_unignored_build_artifacts +case "$jobname" in +*-meson) + group "Configure" meson setup build . \ + --warnlevel 2 --werror \ + --wrap-mode nofallback + group "Build" meson compile -C build -- + 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 diff --git a/meson.build b/meson.build index 8e34a895dc..c7a909e48f 100644 --- a/meson.build +++ b/meson.build @@ -712,7 +712,6 @@ else build_options_config.set('SANITIZE_ADDRESS', '') endif if get_option('b_sanitize').contains('leak') - libgit_c_args += '-DSUPPRESS_ANNOTATED_LEAKS' build_options_config.set('SANITIZE_LEAK', 'YesCompiledWithIt') else build_options_config.set('SANITIZE_LEAK', '') diff --git a/parse-options.h b/parse-options.h index f0801d4532..d01361ca97 100644 --- a/parse-options.h +++ b/parse-options.h @@ -353,6 +353,18 @@ struct option { .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) { \ .type = OPTION_ALIAS, \ .short_name = (s), \ diff --git a/t/Makefile b/t/Makefile index 131ffd778f..290fb03ff0 100644 --- a/t/Makefile +++ b/t/Makefile @@ -59,7 +59,7 @@ CHAINLINTSUPPRESS = GIT_TEST_EXT_CHAIN_LINT=0 && export GIT_TEST_EXT_CHAIN_LINT 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 failed: @@ -114,6 +114,22 @@ check-chainlint: { $(CHAINLINT) --emit-all '$(CHAINLINTTMP_SQ)'/tests >'$(CHAINLINTTMP_SQ)'/actual || true; } && \ 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-filenames ifneq ($(GIT_TEST_CHAIN_LINT),0) diff --git a/t/meson.build b/t/meson.build index 13fe854ba0..602ebfe6a2 100644 --- a/t/meson.build +++ b/t/meson.build @@ -1,6 +1,6 @@ clar_test_suites = [ - 'unit-tests/ctype.c', - 'unit-tests/strvec.c', + 'unit-tests/u-ctype.c', + 'unit-tests/u-strvec.c', ] clar_sources = [ @@ -1092,6 +1092,42 @@ integration_tests = [ '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 # 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. diff --git a/t/t9835-git-p4-metadata-encoding-python2.sh b/t/t9835-git-p4-metadata-encoding-python2.sh index 036bf79c66..6116f806f6 100755 --- a/t/t9835-git-p4-metadata-encoding-python2.sh +++ b/t/t9835-git-p4-metadata-encoding-python2.sh @@ -8,29 +8,29 @@ failing, and produces maximally sane output in git.' . ./lib-git-p4.sh -python_target_version='2' - ############################### ## SECTION REPEATED IN t9836 ## ############################### -# Please note: this test calls "git-p4.py" rather than "git-p4", because the -# latter references a specific path so we can't easily force it to run under -# the python version we need to. - -python_major_version=$(python -V 2>&1 | cut -c 8) -python_target_binary=$(which python$python_target_version) -if ! test "$python_major_version" = "$python_target_version" && test "$python_target_binary" +# These tests are specific to Python 2. Write a custom script that executes +# git-p4 directly with the Python 2 interpreter to ensure that we use that +# version even if Git was compiled with Python 3. +python_target_binary=$(which python2) +if test -n "$python_target_binary" then mkdir temp_python - PATH="$(pwd)/temp_python:$PATH" && export PATH - ln -s $python_target_binary temp_python/python + PATH="$(pwd)/temp_python:$PATH" + export PATH + + write_script temp_python/git-p4-python2 <<-EOF + exec "$python_target_binary" "$(git --exec-path)/git-p4" "\$@" + EOF fi -python_major_version=$(python -V 2>&1 | cut -c 8) -if ! test "$python_major_version" = "$python_target_version" +git p4-python2 >err +if ! grep 'valid commands' err 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 fi @@ -81,14 +81,14 @@ test_expect_success 'init depot' ' test_expect_success 'clone non-utf8 repo with strict encoding' ' test_when_finished cleanup_git && 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 ' test_expect_success 'check utf-8 contents with passthrough strategy' ' test_when_finished cleanup_git && 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" && 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_when_finished cleanup_git && 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" && 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_when_finished cleanup_git && 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" && 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_when_finished cleanup_git && 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" && 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_when_finished cleanup_git && 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" && 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_when_finished cleanup_git && 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" && 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_when_finished cleanup_git && 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" && 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_when_finished cleanup_git && 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" && P4USER=cp1252_author && @@ -186,7 +186,7 @@ test_expect_success 'check cp-1252 contents on later sync after clone with fallb ( cd "$git" && - git p4.py sync --branch=master && + git p4-python2 sync --branch=master && git log p4/master >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_when_finished cleanup_git && 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" && git log >actual && diff --git a/t/t9836-git-p4-metadata-encoding-python3.sh b/t/t9836-git-p4-metadata-encoding-python3.sh index 63350dc4b5..5e5217a66b 100755 --- a/t/t9836-git-p4-metadata-encoding-python3.sh +++ b/t/t9836-git-p4-metadata-encoding-python3.sh @@ -8,29 +8,29 @@ failing, and produces maximally sane output in git.' . ./lib-git-p4.sh -python_target_version='3' - ############################### ## SECTION REPEATED IN t9835 ## ############################### -# Please note: this test calls "git-p4.py" rather than "git-p4", because the -# latter references a specific path so we can't easily force it to run under -# the python version we need to. - -python_major_version=$(python -V 2>&1 | cut -c 8) -python_target_binary=$(which python$python_target_version) -if ! test "$python_major_version" = "$python_target_version" && test "$python_target_binary" +# These tests are specific to Python 3. Write a custom script that executes +# git-p4 directly with the Python 3 interpreter to ensure that we use that +# version even if Git was compiled with Python 2. +python_target_binary=$(which python3) +if test -n "$python_target_binary" then mkdir temp_python - PATH="$(pwd)/temp_python:$PATH" && export PATH - ln -s $python_target_binary temp_python/python + PATH="$(pwd)/temp_python:$PATH" + export PATH + + write_script temp_python/git-p4-python3 <<-EOF + exec "$python_target_binary" "$(git --exec-path)/git-p4" "\$@" + EOF fi -python_major_version=$(python -V 2>&1 | cut -c 8) -if ! test "$python_major_version" = "$python_target_version" +git p4-python3 >err +if ! grep 'valid commands' err 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 fi @@ -81,14 +81,14 @@ test_expect_success 'init depot' ' test_expect_success 'clone non-utf8 repo with strict encoding' ' test_when_finished cleanup_git && 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 ' test_expect_success 'check utf-8 contents with passthrough strategy' ' test_when_finished cleanup_git && 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" && 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_when_finished cleanup_git && 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" && 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_when_finished cleanup_git && 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" && 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_when_finished cleanup_git && 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" && 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_when_finished cleanup_git && 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" && 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_when_finished cleanup_git && 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" && 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_when_finished cleanup_git && 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" && 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_when_finished cleanup_git && 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" && P4USER=cp1252_author && @@ -186,7 +186,7 @@ test_expect_success 'check cp-1252 contents on later sync after clone with fallb ( cd "$git" && - git p4.py sync --branch=master && + git p4-python3 sync --branch=master && git log p4/master >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_when_finished cleanup_git && test_when_finished remove_user_cache && - git p4.py clone --dest="$git" //depot@all && + git p4-python3 clone --dest="$git" //depot@all && ( cd "$git" && git log >actual && diff --git a/t/unit-tests/generate-clar-decls.sh b/t/unit-tests/generate-clar-decls.sh index 688e0885f4..3b315c64b3 100755 --- a/t/unit-tests/generate-clar-decls.sh +++ b/t/unit-tests/generate-clar-decls.sh @@ -11,6 +11,9 @@ shift for suite in "$@" 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 done >"$OUTPUT" diff --git a/t/unit-tests/ctype.c b/t/unit-tests/u-ctype.c index 32e65867cd..32e65867cd 100644 --- a/t/unit-tests/ctype.c +++ b/t/unit-tests/u-ctype.c diff --git a/t/unit-tests/strvec.c b/t/unit-tests/u-strvec.c index e66b7bbfae..e66b7bbfae 100644 --- a/t/unit-tests/strvec.c +++ b/t/unit-tests/u-strvec.c diff --git a/t/unit-tests/unit-test.c b/t/unit-tests/unit-test.c index a474cdcfd3..fa8818842a 100644 --- a/t/unit-tests/unit-test.c +++ b/t/unit-tests/unit-test.c @@ -18,8 +18,25 @@ int cmd_main(int argc, const char **argv) N_("immediately exit upon the first failed test")), OPT_STRING_LIST('r', "run", &run_args, N_("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>")), + /* + * 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(), }; struct strvec args = STRVEC_INIT; |