Skip to content

Conversation

carlopi
Copy link
Contributor

@carlopi carlopi commented Jul 16, 2025

This is a stripped down version of #18230, that adds support for --autoloading none|available|all to unittester, without removing support for previous mode (via env variable LOCAL_EXTENSION_REPO). Keeping both possibility in place is somehow less nice, but has the big advantage that can disentangle fixing issues connected to rolling-in this in CI and allows for easier backport of this if deemed useful.

After this PR, the following modes are available for running unittester:

--autoloading none or `` (this is the default)

Same as current default, only statically linked extensions are ever used.
require in test will run a test only if the needed extension is statically linked-in.

LOCAL_EXTENSION_REPO=path/to/repo

This stays as now.
LOCAL_EXTENSION_REPO points to the repository folder.
require in tests will run a test only if the needed extension is statically linked-in OR if the extension is autoloadable
No checks are performed, so setting LOCAL_EXTENSION_REPO will fail tests at runtime where a given extension is not present on the local machine.

--autoloading available

This is similar to the previous, but:
If defined LOCAL_EXTENSION_REPO points to the repository folder, otherwise build/$BUILD_MODE/repository will be used (the default where builds place extensions)
require in tests will run a test only if:

  • the needed extension is statically linked-in
  • OR if the extension is autoloadable and available (in this case INSTALL will be performed on require, LOAD via autoloading)
  • OR if the extension is not autoloadable and available (in this case both INSTALL and LOAD to be performed on require)

--autoloading all

This is similar to the previous with regard to LOCAL_EXTENSION_REPO
require in tests will run a test always:

  • if the extension is autoloadable, both INSTALL and LOAD to happen at runtime
  • if the extension is not autoloadable, both INSTALL and LOAD to be performed on require
    This mode require either to have a complete set of extensions or pre-filtering the tests to be executed, since require aws with aws extension not available will be a test failure.

An interesting usage for --autoloading all is paired with setting LOCAL_EXTENSION_REPO=http://extensions.duckdb.org, since this will correspond to use the remote available extensions (if there).


Limitation of current PR:

  • information about whether a PR is statically linked in is implied from the fact that a given extension can be installed, and NOT from the list of statically linked in extensions. This can be improved on.
  • this is currently not run on CI due to 3 issues:
    • run_tests_one_by_one.py needs to be adapted to take more arguments
    • some vss and spatial tests needs to be adapted due to missing requires
    • this allow easier to backport this PR, if one would find that handy

@duckdb-draftbot duckdb-draftbot marked this pull request as draft July 16, 2025 11:08
@carlopi carlopi marked this pull request as ready for review July 16, 2025 11:09
@carlopi carlopi marked this pull request as draft July 16, 2025 12:56
@carlopi carlopi force-pushed the unittester_autoloading_option branch from e9be7b4 to f62d94d Compare July 16, 2025 13:35
@carlopi carlopi marked this pull request as ready for review July 16, 2025 13:35
@carlopi carlopi closed this Jul 17, 2025
@carlopi
Copy link
Contributor Author

carlopi commented Jul 17, 2025

Moved on v1.3-ossivalis via #18290

Mytherin added a commit that referenced this pull request Jul 17, 2025
This is #18266 on `v1.3-ossivalis`,
plus fix from #18289.
This is a stripped down version of
#18230, that adds support for
`--autoloading none|available|all` to unittester, without removing
support for previous mode (via env variable `LOCAL_EXTENSION_REPO`).
Keeping both possibility in place is somehow less nice, but has the big
advantage that can disentangle fixing issues connected to rolling-in
this in CI and allows for easier backport of this if deemed useful.

After this PR, the following modes are available for running unittester:

#### `--autoloading none` or `` (this is the default)
Same as current default, only statically linked extensions are ever
used.
`require` in test will run a test only if the needed extension is
statically linked-in.

#### `LOCAL_EXTENSION_REPO=path/to/repo`
This stays as now.
`LOCAL_EXTENSION_REPO` points to the repository folder.
`require` in tests will run a test only if the needed extension is
statically linked-in OR if the extension is autoloadable
No checks are performed, so setting LOCAL_EXTENSION_REPO will fail tests
at runtime where a given extension is not present on the local machine.

#### `--autoloading available`
This is similar to the previous, but:
If defined `LOCAL_EXTENSION_REPO` points to the repository folder,
otherwise `build/$BUILD_MODE/repository` will be used (the default where
builds place extensions)
`require` in tests will run a test only if:
* the needed extension is statically linked-in
* OR if the extension is autoloadable and available (in this case
INSTALL will be performed on require, LOAD via autoloading)
* OR if the extension is not autoloadable and available (in this case
both INSTALL and LOAD to be performed on require)

#### `--autoloading all`
This is similar to the previous with regard to `LOCAL_EXTENSION_REPO`
`require` in tests will run a test always:
* if the extension is autoloadable, both INSTALL and LOAD to happen at
runtime
* if the extension is not autoloadable, both INSTALL and LOAD to be
performed on `require`
This mode require either to have a complete set of extensions or
pre-filtering the tests to be executed, since `require aws` with aws
extension not available will be a test failure.

An interesting usage for `--autoloading all` is paired with setting
`LOCAL_EXTENSION_REPO=http://extensions.duckdb.org`, since this will
correspond to use the remote available extensions (if there).

---

Limitation of current PR:
* information about whether a PR is statically linked in is implied from
the fact that a given extension can be installed, and NOT from the list
of statically linked in extensions. This can be improved on.
* this is currently not run on CI due to 3 issues:
   * run_tests_one_by_one.py needs to be adapted to take more arguments
* some `vss` and `spatial` tests needs to be adapted due to missing
`requires`
   * this allow easier to backport this PR, if one would find that handy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant