diff mbox series

[RFC/PoC,3/5] test-lib: add GIT_BUNDLE_DIR setup

Message ID 20221102224843.2104-4-philipoakley@iee.email (mailing list archive)
State New, archived
Headers show
Series Provide example docbundles | expand

Commit Message

Philip Oakley Nov. 2, 2022, 10:48 p.m. UTC
The test system may output a number of documentation bundles containing
test repositories of interest to users, including those explicitly
documented.

Provide a default location for holding those bundles.
As build artefact's this location, along with `.bndl` files, was
ignored in an earlier commit.

This may need further refinement.

Signed-off-by: Philip Oakley <philipoakley@iee.email>
---
 t/test-lib.sh | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Ævar Arnfjörð Bjarmason Nov. 3, 2022, 9:14 a.m. UTC | #1
On Wed, Nov 02 2022, Philip Oakley wrote:

> The test system may output a number of documentation bundles containing
> test repositories of interest to users, including those explicitly
> documented.
>
> Provide a default location for holding those bundles.
> As build artefact's this location, along with `.bndl` files, was
> ignored in an earlier commit.
>
> This may need further refinement.
>
> Signed-off-by: Philip Oakley <philipoakley@iee.email>
> ---
>  t/test-lib.sh | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
>
> diff --git a/t/test-lib.sh b/t/test-lib.sh
> index 4e45bc7c4f..b18cd8a34e 100644
> --- a/t/test-lib.sh
> +++ b/t/test-lib.sh
> @@ -56,6 +56,20 @@ then
>  	echo "PANIC: Running in a $TEST_DIRECTORY that doesn't end in '/t'?" >&2
>  	exit 1
>  fi
> +if test -z "$GIT_BUNDLE_DIR"
> +then
> +	# Similarly, override this to store the documentation bundles subdir
> +	# elsewhere
> +	GIT_BUNDLE_DIR=$TEST_DIRECTORY/GIT_BUNDLE_DIR
> +	if test ! -d "$GIT_BUNDLE_DIR"
> +	then
> +		mkdir -p "$GIT_BUNDLE_DIR"

Okey, so "mkdir -p", not "mkdir" once one thinks about it for a second:
Because we might be testing in parallel, so this will be racy.

> +	fi
> +elif test ! -d "$GIT_BUNDLE_DIR"
> +then
> +	echo "PANIC: Your "$GIT_BUNDLE_DIR" doesn't exist!" >&2
> +	exit 1
> +fi

I think it's better just to put these in the "test-results" dir.

For leak testing I have local patches to e.g. create test-results/<test
number>.leak, and then after a run I slurp that up and process it.

So, same idea, you could just add stuff there, and afterwards grab it
there. No need for specifying the dir etc., you just need a test-lib.sh
flag to say "yes, write these out".
Philip Oakley Nov. 3, 2022, 7:50 p.m. UTC | #2
On 03/11/2022 09:14, Ævar Arnfjörð Bjarmason wrote:
> On Wed, Nov 02 2022, Philip Oakley wrote:
>
>> The test system may output a number of documentation bundles containing
>> test repositories of interest to users, including those explicitly
>> documented.
>>
>> Provide a default location for holding those bundles.
>> As build artefact's this location, along with `.bndl` files, was
>> ignored in an earlier commit.
>>
>> This may need further refinement.
>>
>> Signed-off-by: Philip Oakley <philipoakley@iee.email>
>> ---
>>  t/test-lib.sh | 14 ++++++++++++++
>>  1 file changed, 14 insertions(+)
>>
>> diff --git a/t/test-lib.sh b/t/test-lib.sh
>> index 4e45bc7c4f..b18cd8a34e 100644
>> --- a/t/test-lib.sh
>> +++ b/t/test-lib.sh
>> @@ -56,6 +56,20 @@ then
>>  	echo "PANIC: Running in a $TEST_DIRECTORY that doesn't end in '/t'?" >&2
>>  	exit 1
>>  fi
>> +if test -z "$GIT_BUNDLE_DIR"
>> +then
>> +	# Similarly, override this to store the documentation bundles subdir
>> +	# elsewhere
>> +	GIT_BUNDLE_DIR=$TEST_DIRECTORY/GIT_BUNDLE_DIR
>> +	if test ! -d "$GIT_BUNDLE_DIR"
>> +	then
>> +		mkdir -p "$GIT_BUNDLE_DIR"
> Okey, so "mkdir -p", not "mkdir" once one thinks about it for a second:
> Because we might be testing in parallel, so this will be racy.
>
>> +	fi
>> +elif test ! -d "$GIT_BUNDLE_DIR"
>> +then
>> +	echo "PANIC: Your "$GIT_BUNDLE_DIR" doesn't exist!" >&2
>> +	exit 1
>> +fi
> I think it's better just to put these in the "test-results" dir.
>
> For leak testing I have local patches to e.g. create test-results/<test
> number>.leak, and then after a run I slurp that up and process it.
>
> So, same idea, you could just add stuff there, and afterwards grab it
> there. No need for specifying the dir etc., you just need a test-lib.sh
> flag to say "yes, write these out".
Ok, I suppose it depends on the choice between pre-slurp and
post-slurping these delivery artefact bundles.

Taylor and Junio maybe able to suggest ideas about approaches that would
fit the documentation delivery pipeline.

Philip
diff mbox series

Patch

diff --git a/t/test-lib.sh b/t/test-lib.sh
index 4e45bc7c4f..b18cd8a34e 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -56,6 +56,20 @@  then
 	echo "PANIC: Running in a $TEST_DIRECTORY that doesn't end in '/t'?" >&2
 	exit 1
 fi
+if test -z "$GIT_BUNDLE_DIR"
+then
+	# Similarly, override this to store the documentation bundles subdir
+	# elsewhere
+	GIT_BUNDLE_DIR=$TEST_DIRECTORY/GIT_BUNDLE_DIR
+	if test ! -d "$GIT_BUNDLE_DIR"
+	then
+		mkdir -p "$GIT_BUNDLE_DIR"
+	fi
+elif test ! -d "$GIT_BUNDLE_DIR"
+then
+	echo "PANIC: Your "$GIT_BUNDLE_DIR" doesn't exist!" >&2
+	exit 1
+fi
 
 # Prepend a string to a VAR using an arbitrary ":" delimiter, not
 # adding the delimiter if VAR or VALUE is empty. I.e. a generalized: