🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.git
2 messages
2 total messages Started by Phillip Wood Tue, 27 Oct 2026 14:53
Re: [PATCH 8/8] t/test-lib: make feature-testbed job more accessible
#1633
Author: Phillip Wood
Date: Tue, 27 Oct 2026 14:53
98 lines
14653 bytes
Hi Patrick

On 27/10/2026 08:18, Patrick Steinhardt wrote:
> Our "feature-testbed" job sets up a bunch of GIT_TEST environment
> variables and then executes our tests. This is mostly intended as a
> testbed for features that aren't default-enabled, but that may
> eventually become so.
> 
> Due to the job being special it has a higher potential of failing even
> though a local test run succeeds. But running these tests locally with
> the same environment is somewhat painful, as the developer has to
> manually set all of these environment variables.
> 
> Introduce a new "--feature-testbed" toggle for our test suite that, when
> set, sets up exactly these environment variables. Migrate our CI to use
> this toggle so that we have a single source of truth, only.
> 
> Note that we only set these GIT_TEST variables in the case where they
> haven't already been configured. This serves two purposes:
> 
>    - The user can continue to manually override a subset of those
>      variables, if they desire.
> 
>    - Test scripts typically source "t/test-lib.sh" after they already
>      overrode GIT_TEST variables, and we don't want to discard that.

That all sounds sensible, the commit message could maybe flag that the 
"feature-testbed" also sets OPENSSL_SHA1_UNSAFE which 
"--feature-testbed" does not because it is only concerned with GIT_TEST_*.

> diff --git a/t/test-lib.sh b/t/test-lib.sh
> index de566309861..8863bcac930 100644
> --- a/t/test-lib.sh
> +++ b/t/test-lib.sh
> @@ -202,6 +202,14 @@ finalize_test_case_output () { :; }
>   finalize_test_leak_output () { :; }
>   finalize_test_output () { :; }
>   
> +set_default_env () {
> +	if eval "test -z \"\${$1+set}\""

This made me scratch my head for a couple of minutes, but I think it is 
correct

	set_default_env ABC 1

evaluates

	test -z "${ABC+set}"

to see if $ABC is unset.

Thanks

Phillip
> +	then
> +		eval "$1=\$2"
> +	fi
> +	export "$1"
> +}
> +
>   parse_option () {
>   	local opt="$1"
>   
> @@ -212,6 +220,19 @@ parse_option () {
>   		immediate=t ;;
>   	-l|--l|--lo|--lon|--long|--long-|--long-t|--long-te|--long-tes|--long-test|--long-tests)
>   		GIT_TEST_LONG=true; export GIT_TEST_LONG ;;
> +	--feature-testbed)
> +		set_default_env GIT_TEST_SPLIT_INDEX yes
> +		set_default_env GIT_TEST_FULL_IN_PACK_ARRAY true
> +		set_default_env GIT_TEST_OE_SIZE 10
> +		set_default_env GIT_TEST_OE_DELTA_SIZE 5
> +		set_default_env GIT_TEST_COMMIT_GRAPH 1
> +		set_default_env GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS 1
> +		set_default_env GIT_TEST_MULTI_PACK_INDEX 1
> +		set_default_env GIT_TEST_MULTI_PACK_INDEX_WRITE_INCREMENTAL 1
> +		set_default_env GIT_TEST_NO_WRITE_REV_INDEX 1
> +		set_default_env GIT_TEST_CHECKOUT_WORKERS 2
> +		set_default_env GIT_TEST_PACK_USE_BITMAP_BOUNDARY_TRAVERSAL 1
> +		;;
>   	-r)
>   		mark_option_requires_arg "$opt" run_list
>   		;;
> diff --git a/t/unit-tests/unit-test.c b/t/unit-tests/unit-test.c
> index 752fb38fb32..f4898353045 100644
> --- a/t/unit-tests/unit-test.c
> +++ b/t/unit-tests/unit-test.c
> @@ -27,6 +27,7 @@ int cmd_main(int argc, const char **argv)
>   		 * options understood by integration tests.
>   		 */
>   		OPT_NOOP_NOARG('d', "debug"),
> +		OPT_NOOP_NOARG(0, "feature-testbed"),
>   		OPT_NOOP_NOARG(0, "github-workflow-markup"),
>   		OPT_NOOP_NOARG(0, "no-bin-wrappers"),
>   		OPT_NOOP_ARG(0, "no-chain-lint"),
> 
Re: [PATCH 8/8] t/test-lib: make feature-testbed job more accessible
#1684
Author: Junio C Hamano
Date: Tue, 27 Oct 2026 20:59
43 lines
13861 bytes
Phillip Wood <phillip.wood123@gmail.com> writes:

> That all sounds sensible, the commit message could maybe flag that the 
> "feature-testbed" also sets OPENSSL_SHA1_UNSAFE which 
> "--feature-testbed" does not because it is only concerned with GIT_TEST_*.
>
>> diff --git a/t/test-lib.sh b/t/test-lib.sh
>> index de566309861..8863bcac930 100644
>> --- a/t/test-lib.sh
>> +++ b/t/test-lib.sh
>> @@ -202,6 +202,14 @@ finalize_test_case_output () { :; }
>>   finalize_test_leak_output () { :; }
>>   finalize_test_output () { :; }
>>   
>> +set_default_env () {
>> +	if eval "test -z \"\${$1+set}\""
>
> This made me scratch my head for a couple of minutes, but I think it is 
> correct
>
> 	set_default_env ABC 1
>
> evaluates
>
> 	test -z "${ABC+set}"
>
> to see if $ABC is unset.
>
> Thanks
>
> Phillip
>> +	then
>> +		eval "$1=\$2"

This one may want to quote the right hand side to be more widely
portable, i.e., eval "$1=\"\$2\"" or something along that line.
POSIX Bourne shell does not require the right hand side 

    VARIABLE=$VAR

to be quoted, but CodingGuidelines has observed some buggy shells.
It may be better to be extra clear than sorry.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads