tests: stabilize `test-clonebundles-autogen.t` on Windows
The problem was that the commands are spun up with `shell=True`, which uses
`cmd.exe`, which doesn't understand `$foo` style variables. The HGCB variable
expansion has to be delayed, because it's figured out right before launching
the command. We could probably add a conditional for Windows, and rewrite the
config to use `%foo%` style variables, but it's more maintainable to just wrap
the command in a bash shell invocation.
The forward style slashes in the path are needed to avoid accruing double
backslashes (when switching between shells- the url template seems fine). Also
need to strong quote the command so that the double quotes don't get stripped
off of `$HGCB_BUNDLE_PATH`, which results in:
sh: 1: Syntax error: Unterminated quoted string
abort: command returned status 2: sh -c "cp $HGCB_BUNDLE_PATH $TESTTMP/final-upload/"
--- a/tests/test-clonebundles-autogen.t Tue Oct 15 22:19:30 2024 -0400
+++ b/tests/test-clonebundles-autogen.t Tue Oct 15 22:30:10 2024 -0400
@@ -10,8 +10,8 @@
>
> [clone-bundles]
> auto-generate.on-change = yes
- > upload-command = cp "\$HGCB_BUNDLE_PATH" "$TESTTMP"/final-upload/
- > delete-command = rm -f "$TESTTMP/final-upload/\$HGCB_BASENAME"
+ > upload-command = sh -c 'cp "\$HGCB_BUNDLE_PATH" $TESTTMP_FORWARD_SLASH/final-upload/'
+ > delete-command = sh -c 'rm -f $TESTTMP_FORWARD_SLASH/final-upload/\$HGCB_BASENAME'
> url-template = file://$TESTTMP/final-upload/{basename}
>
> [devel]